linux-stable/fs/nfsd
Jeff Layton 435cc7d18c nfsd: don't call nfsd_file_put from client states seqfile display
[ Upstream commit e0aa651068 ]

We had a report of this:

    BUG: sleeping function called from invalid context at fs/nfsd/filecache.c:440

...with a stack trace showing nfsd_file_put being called from
nfs4_show_open. This code has always tried to call fput while holding a
spinlock, but we recently changed this to use the filecache, and that
started triggering the might_sleep() in nfsd_file_put.

states_start takes and holds the cl_lock while iterating over the
client's states, and we can't sleep with that held.

Have the various nfs4_show_* functions instead hold the fi_lock instead
of taking a nfsd_file reference.

Fixes: 78599c42ae ("nfsd4: add file to display list of client's opens")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2138357
Reported-by: Zhi Li <yieli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:14:03 +01:00
..
acl.h
auth.c
auth.h
blocklayout.c block: remove REQ_OP_SCSI_{IN,OUT} 2021-06-30 15:34:19 -06:00
blocklayoutxdr.c
blocklayoutxdr.h
cache.h
current_stateid.h
export.c fs: add is_idmapped_mnt() helper 2022-07-02 16:41:14 +02:00
export.h
fault_inject.c
filecache.c nfsd: eliminate the NFSD_FILE_BREAK_* flags 2022-08-17 14:22:45 +02:00
filecache.h nfsd: eliminate the NFSD_FILE_BREAK_* flags 2022-08-17 14:22:45 +02:00
flexfilelayout.c
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
Kconfig scsi: core: Rename CONFIG_BLK_SCSI_REQUEST to CONFIG_SCSI_COMMON 2021-07-28 22:24:27 -04:00
lockd.c Keep read and write fds with each nlm_file 2021-08-23 18:05:31 -04:00
Makefile
netns.h NFSD: delay unmount source's export after inter-server copy completed. 2021-05-25 17:06:51 -04:00
nfs2acl.c NFSD: Finish converting the NFSv2 GETACL result encoder 2022-12-31 13:14:03 +01:00
nfs3acl.c nfsd: fix NULL dereference in nfs3svc_encode_getaclres 2021-07-06 20:14:44 -04:00
nfs3proc.c NFSD: Protect against send buffer overflow in NFSv3 READ 2022-10-26 12:34:25 +02:00
nfs3xdr.c Revert "nfsd: skip some unnecessary stats in the v4 case" 2022-03-08 19:12:36 +01:00
nfs4acl.c
nfs4callback.c nfsd: rpc_peeraddr2str needs rcu lock 2021-07-06 20:14:42 -04:00
nfs4idmap.c
nfs4layouts.c
nfs4proc.c NFSD: Fix handling of oversized NFSv4 COMPOUND requests 2022-10-26 12:34:38 +02:00
nfs4recover.c nfsd: Fix a memory leak in an error handling path 2022-10-26 12:34:37 +02:00
nfs4state.c nfsd: don't call nfsd_file_put from client states seqfile display 2022-12-31 13:14:03 +01:00
nfs4xdr.c NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data 2022-10-26 12:35:32 +02:00
nfscache.c nfsd: destroy percpu stats counters after reply cache shutdown 2022-06-09 10:23:12 +02:00
nfsctl.c fsnotify: fix fsnotify hooks in pseudo filesystems 2022-02-01 17:27:01 +01:00
nfsd.h NFSD: delay unmount source's export after inter-server copy completed. 2021-05-25 17:06:51 -04:00
nfsfh.c NFSD: Update the GETATTR3res encoder to use struct xdr_stream 2021-03-22 10:18:51 -04:00
nfsfh.h NFSD: Constify @fh argument of knfsd_fh_hash() 2021-05-18 13:44:03 -04:00
nfsproc.c NFSD: Protect against send buffer overflow in NFSv2 READDIR 2022-10-26 12:34:38 +02:00
nfssvc.c NFSD: delay unmount source's export after inter-server copy completed. 2021-05-25 17:06:51 -04:00
nfsxdr.c NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
pnfs.h
state.h nfsd: track filehandle aliasing in nfs4_files 2021-04-19 16:41:36 -04:00
stats.c
stats.h
trace.c
trace.h nfsd: eliminate the NFSD_FILE_BREAK_* flags 2022-08-17 14:22:45 +02:00
vfs.c vfs: fix copy_file_range() averts filesystem freeze protection 2022-12-19 12:36:39 +01:00
vfs.h NFSD: COMMIT operations must not return NFS?ERR_INVAL 2022-07-12 16:35:01 +02:00
xdr.h NFSD: prevent underflow in nfssvc_decode_writeargs() 2022-04-08 14:22:52 +02:00
xdr3.h NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
xdr4.h NFSD: Fix handling of oversized NFSv4 COMPOUND requests 2022-10-26 12:34:38 +02:00
xdr4cb.h