Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp221762lqp; Tue, 11 Jun 2024 22:09:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHEsCC2wxQJg+3lQZh6AzfDOu2hgziF/QVZ6UM+GKM6zbxS330cDALOhexEPhpXi1Me5VkkTVsmxlnjP4K+bl5cHnHW0yxmxwVyWv5Gw== X-Google-Smtp-Source: AGHT+IETiKKjD3WzsRKZhGnhhVIuQG1w0UmfyyrEMrimCRgJFzLzH16+fupQsPsu9QLLuYnacI/l X-Received: by 2002:a05:6a00:1792:b0:704:24fb:11c6 with SMTP id d2e1a72fcca58-705bce19d6amr894783b3a.12.1718168947889; Tue, 11 Jun 2024 22:09:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718168947; cv=pass; d=google.com; s=arc-20160816; b=w2/SJY0Vs++ZbbfwYuKooBG3hIJXbGzhN+bxXJeGH+dXICaHxK44Nc7+oYGs5Zpik4 cioeyOwhh4kOfJy8bocG1nGPimu1i3/WuPMy+39YLYW+K0B4WQBpyLzee/UT3TOcGhrP QfiVOhhO/ugpLKzkcH1iQ50JHwy4xMDvZZ5DrS0N8Sc/lY0uIgeGSzx85dEI0HxXfmkt YEYCLB/uY2jWIfZ4oSWKpXHUf4xNqrikO1H1QKThjPDW1FlG0bR1+o092csOlJn/5IVz 3Mg0/M8GFlfh/4XqvhtJAQDxBgRngqMVzspgUUcz97hxn0uOQN5pHBPYokAmxw09avSm EFaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=tu3bFzh9YMsHPy4125gOcuAnXEXMGEnP07yzvjdZLjU=; fh=1J3QgTUVtIZ0UqWI5GaVhzKoKmLQCda34p6Pdea+9LQ=; b=VkJFSLrcLm6k/vm602qMsriX2T+fodmX6OP27PyJFlBJ1146ujrQ+EEOR8uRUh+U8S lTwhR9ouNFju5aCHjGE+uaSyT3+OVk46QgdN+piqJU0DVRnAGXoeVDD/om3C10dbxlqj N7uNFo9gSmGsz8fxQ0T3M/5qHjRfOBqGFP8dddXWjklpXGt2IzAzbGHuvYUWYcAN19j8 1cd1nC9bXGrZwD4TIn48Q+w61q0BI9D2HcRAJD//5/JyMZRIHXxRgiP6aT3eu4DAYkjP YAC9jjKjgSKWLzq1KdB7szurozyszdQDl9xq3gxDfqJSgIK7V63q48otqegFvHY9VLsd pNtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-nfs+bounces-3685-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3685-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de262c0794si10708298a12.365.2024.06.11.22.09.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 22:09:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3685-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-nfs+bounces-3685-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3685-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 47F35280EE7 for ; Wed, 12 Jun 2024 05:09:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 724172C1BA; Wed, 12 Jun 2024 05:09:06 +0000 (UTC) X-Original-To: linux-nfs@vger.kernel.org Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BE6728DD1 for ; Wed, 12 Jun 2024 05:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718168946; cv=none; b=iEpwuiKNuLnvfuoIKXAhV6iH5LJqDghqsKpGXvzg8cAeBEhbaYXxskL7O8chN6DXo8xYCTjB62k1FJWJK6ObKMR8mrUyRQP9fNNQGIvEQGZeF0yR03o2YWGx1hVoSnXpls4Rvb7qZrynHrDn3tWLlXl/5rTJQ8+qnEB5pmOE/Oc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718168946; c=relaxed/simple; bh=7vAdgrn/NamW2RuhsHIwT9Gl3uy2GoPF7IR6O+pZVVc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XsmxZG6/v7GM41+9F+nSdMRXOC78gpdtJY5iwh4K2tRJ29GhoDMBzWnRzK0lMWPVY5ug0x+i3CDybnc4Whm3cp3jmG014XGXzkr8lKdmnx0Xq/0LYgZX4Th+GS/B77aDIknbuaFi4BBmi/cUkrM42xmDgSqDpWy16oRfhqnI8ic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 448BF68BEB; Wed, 12 Jun 2024 07:09:00 +0200 (CEST) Date: Wed, 12 Jun 2024 07:08:59 +0200 From: Christoph Hellwig To: cel@kernel.org Cc: linux-nfs@vger.kernel.org, Jeff Layton , Neil Brown , Dai Ngo , Olga Kornievskaia , Tom Talpey , Chuck Lever , Christoph Hellwig Subject: Re: [PATCH v2] NFSD: Support write delegations in LAYOUTGET Message-ID: <20240612050859.GA27147@lst.de> References: <20240611193645.65792-2-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240611193645.65792-2-cel@kernel.org> User-Agent: Mutt/1.5.17 (2007-11-01) On Tue, Jun 11, 2024 at 03:36:46PM -0400, cel@kernel.org wrote: > From: Chuck Lever > > I noticed LAYOUTGET(LAYOUTIOMODE4_RW) returning NFS4ERR_ACCESS > unexpectedly. The NFS client had created a file with mode 0444, and > the server had returned a write delegation on the OPEN(CREATE). The > client was requesting a RW layout using the write delegation stateid > so that it could flush file modifications. > > Creating a read-only file does not seem to be problematic for > NFSv4.1 without pNFS, so I began looking at NFSD's implementation of > LAYOUTGET. > > The failure was because fh_verify() was doing a permission check as > part of verifying the FH presented during the LAYOUTGET. It uses the > loga_iomode value to specify the @accmode argument to fh_verify(). > fh_verify(MAY_WRITE) on a file whose mode is 0444 fails with -EACCES. > > To permit LAYOUT* operations in this case, add OWNER_OVERRIDE when > checking the access permission of the incoming file handle for > LAYOUTGET and LAYOUTCOMMIT. This looks reasonable to me: Reviewed-by: Christoph Hellwig