public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v5 6/6] NFSD: Ignore vfs_getattr() failure in nfsd_file_get_dio_attrs()
Date: Mon, 29 Sep 2025 12:51:16 -0400	[thread overview]
Message-ID: <7e1d03ee35e6948908e70001ade6e45491193bd1.camel@kernel.org> (raw)
In-Reply-To: <20250929155646.4818-7-cel@kernel.org>

On Mon, 2025-09-29 at 11:56 -0400, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> A vfs_getattr() failure is rare but not totally impossible.
> 
> There's no recovery logic in that case; nfsd_do_file_acquire()'s
> caller will fail but the wonky nfsd_file is left in the file cache.
> 
> It doesn't seem necessary for nfsd_file_do_acquire() to fail
> outright if it successfully opened the file but some problem
> prevented the collection of the dio alignment parameters.
> 

Agreed

> Fixes: bc70aaeba7df ("NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/filecache.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 78cca0d751ac..b34cc8d2cb5e 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -1051,7 +1051,7 @@ nfsd_file_is_cached(struct inode *inode)
>  	return ret;
>  }
>  
> -static __be32
> +static void
>  nfsd_file_get_dio_attrs(const struct svc_fh *fhp, struct nfsd_file *nf)
>  {
>  	struct inode *inode = file_inode(nf->nf_file);
> @@ -1060,11 +1060,12 @@ nfsd_file_get_dio_attrs(const struct svc_fh *fhp, struct nfsd_file *nf)
>  
>  	/* Currently only need to get DIO alignment info for regular files */
>  	if (!S_ISREG(inode->i_mode))
> -		return nfs_ok;
> +		return;
>  
>  	status = fh_getattr(fhp, &stat);
>  	if (status != nfs_ok)
> -		return status;
> +		/* Use default dio alignment parameters (all zero) */
> +		return;
>  
>  	trace_nfsd_file_get_dio_attrs(inode, &stat);
>  
> @@ -1076,8 +1077,6 @@ nfsd_file_get_dio_attrs(const struct svc_fh *fhp, struct nfsd_file *nf)
>  		nf->nf_dio_read_offset_align = stat.dio_read_offset_align;
>  	else
>  		nf->nf_dio_read_offset_align = nf->nf_dio_offset_align;
> -
> -	return nfs_ok;
>  }
>  
>  static __be32
> @@ -1199,7 +1198,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,
>  			status = nfserrno(ret);
>  			trace_nfsd_file_open(nf, status);
>  			if (status == nfs_ok)
> -				status = nfsd_file_get_dio_attrs(fhp, nf);
> +				nfsd_file_get_dio_attrs(fhp, nf);
>  		}
>  	} else
>  		status = nfserr_jukebox;

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2025-09-29 16:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 15:56 [PATCH v5 0/6] NFSD direct I/O read Chuck Lever
2025-09-29 15:56 ` [PATCH v5 1/6] NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support Chuck Lever
2025-10-03  7:09   ` Christoph Hellwig
2025-09-29 15:56 ` [PATCH v5 2/6] NFSD: pass nfsd_file to nfsd_iter_read() Chuck Lever
2025-10-03  7:09   ` Christoph Hellwig
2025-09-29 15:56 ` [PATCH v5 3/6] NFSD: Relocate the xdr_reserve_space_vec() call site Chuck Lever
2025-09-29 15:56 ` [PATCH v5 4/6] NFSD: Implement NFSD_IO_DIRECT for NFS READ Chuck Lever
2025-10-03  7:19   ` Christoph Hellwig
2025-10-03 15:06     ` Chuck Lever
2025-09-29 15:56 ` [PATCH v5 5/6] NFSD: Prevent a NULL pointer dereference in fh_getattr() Chuck Lever
2025-09-29 16:13   ` Jeff Layton
2025-09-29 17:39   ` Mike Snitzer
2025-10-03  7:11   ` Christoph Hellwig
2025-10-03 14:18     ` Chuck Lever
2025-09-29 15:56 ` [PATCH v5 6/6] NFSD: Ignore vfs_getattr() failure in nfsd_file_get_dio_attrs() Chuck Lever
2025-09-29 16:51   ` Jeff Layton [this message]
2025-09-29 17:39   ` Mike Snitzer
2025-10-03  7:13   ` Christoph Hellwig
2025-10-03 14:23     ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e1d03ee35e6948908e70001ade6e45491193bd1.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox