On 8/7/25 12:25 PM, Mike Snitzer wrote: > Suggested-by: Jeff Layton <jlayton@xxxxxxxxxx> > Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> > --- > fs/nfsd/filecache.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c > index 5447dba6c5da0..5601e839a72da 100644 > --- a/fs/nfsd/filecache.c > +++ b/fs/nfsd/filecache.c > @@ -1058,8 +1058,12 @@ nfsd_file_getattr(const struct svc_fh *fhp, struct nfsd_file *nf) > struct kstat stat; > __be32 status; > > - /* Currently only need to get DIO alignment info for regular files */ > - if (!S_ISREG(inode->i_mode)) > + /* Currently only need to get DIO alignment info for regular files > + * IFF NFSD_IO_DIRECT is enabled for nfsd_io_cache_{read,write}. What happens if the I/O mode is changed from buffered to direct I/O while there are open files? I think you will need to collect the alignment parameters on all opens regardless of the I/O mode setting. > + */ > + if (!S_ISREG(inode->i_mode) || > + (nfsd_io_cache_read != NFSD_IO_DIRECT && > + nfsd_io_cache_write != NFSD_IO_DIRECT)) > return nfs_ok; > > status = fh_getattr(fhp, &stat); -- Chuck Lever