linux-stable/fs/nfsd
Jeff Layton bdce62f68e nfsd: eliminate the NFSD_FILE_BREAK_* flags
commit 23ba98de6d upstream.

We had a report from the spring Bake-a-thon of data corruption in some
nfstest_interop tests. Looking at the traces showed the NFS server
allowing a v3 WRITE to proceed while a read delegation was still
outstanding.

Currently, we only set NFSD_FILE_BREAK_* flags if
NFSD_MAY_NOT_BREAK_LEASE was set when we call nfsd_file_alloc.
NFSD_MAY_NOT_BREAK_LEASE was intended to be set when finding files for
COMMIT ops, where we need a writeable filehandle but don't need to
break read leases.

It doesn't make any sense to consult that flag when allocating a file
since the file may be used on subsequent calls where we do want to break
the lease (and the usage of it here seems to be reverse from what it
should be anyway).

Also, after calling nfsd_open_break_lease, we don't want to clear the
BREAK_* bits. A lease could end up being set on it later (more than
once) and we need to be able to break those leases as well.

This means that the NFSD_FILE_BREAK_* flags now just mirror
NFSD_MAY_{READ,WRITE} flags, so there's no need for them at all. Just
drop those flags and unconditionally call nfsd_open_break_lease every
time.

Reported-by: Olga Kornieskaia <kolga@netapp.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2107360
Fixes: 65294c1f2c (nfsd: add a new struct file caching facility to nfsd)
Cc: <stable@vger.kernel.org> # 5.4.x : bb283ca18d NFSD: Clean up the show_nf_flags() macro
Cc: <stable@vger.kernel.org> # 5.4.x
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-17 14:40:02 +02:00
..
Kconfig NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
Makefile NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
acl.h
auth.c
auth.h
blocklayout.c block: remove genhd.h 2022-02-02 07:49:59 -07:00
blocklayoutxdr.c
blocklayoutxdr.h
cache.h
current_stateid.h
export.c fs: add is_idmapped_mnt() helper 2021-12-03 18:44:06 +01:00
export.h nfsd: report per-export stats 2021-01-25 09:36:28 -05:00
fault_inject.c
filecache.c nfsd: eliminate the NFSD_FILE_BREAK_* flags 2022-08-17 14:40:02 +02:00
filecache.h nfsd: eliminate the NFSD_FILE_BREAK_* flags 2022-08-17 14:40:02 +02:00
flexfilelayout.c nfsd: use correct format characters 2022-03-17 19:47:38 -04:00
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
lockd.c NFSD: simplify struct nfsfh 2021-10-02 15:51:10 -04:00
netns.h NFSD: Rename boot verifier functions 2022-01-08 14:42:02 -05:00
nfs2acl.c SUNRPC: Return true/false (not 1/0) from bool functions 2022-03-27 23:25:52 -04:00
nfs3acl.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
nfs3proc.c Notable bug fixes: 2022-02-09 09:56:57 -08:00
nfs3xdr.c NFSD: Deprecate NFS_OFFSET_MAX 2022-02-09 09:24:40 -05:00
nfs4acl.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
nfs4callback.c NFSD: simplify struct nfsfh 2021-10-02 15:51:10 -04:00
nfs4idmap.c
nfs4layouts.c nfsd: fix using the correct variable for sizeof() 2022-03-20 12:49:38 -04:00
nfs4proc.c NFSD: Clamp WRITE offsets 2022-02-09 09:24:01 -05:00
nfs4recover.c nfsd: Fix nsfd startup race (again) 2021-12-10 11:54:59 -05:00
nfs4state.c NFSD: Fix possible sleep during nfsd4_release_lockowner() 2022-06-06 08:48:59 +02:00
nfs4xdr.c NFSD: Decode NFSv4 birth time attribute 2022-07-22 10:21:35 +02:00
nfscache.c nfsd: destroy percpu stats counters after reply cache shutdown 2022-06-09 10:30:33 +02:00
nfsctl.c SUNRPC: Rename svc_close_xprt() 2022-02-28 10:26:40 -05:00
nfsd.h NFSD: Decode NFSv4 birth time attribute 2022-07-22 10:21:35 +02:00
nfsfh.c NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
nfsfh.h NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
nfsproc.c NFSD: prevent underflow in nfssvc_decode_writeargs() 2022-03-15 09:35:56 -04:00
nfssvc.c NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
nfsxdr.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
pnfs.h
state.h nfsd4: add refcount for nfsd4_blocked_lock 2022-01-08 14:42:01 -05:00
stats.c nfsd: make nfsd_stats.th_cnt atomic_t 2021-12-13 13:42:51 -05:00
stats.h nfsd: make nfsd_stats.th_cnt atomic_t 2021-12-13 13:42:51 -05:00
trace.c NFSD: Add SPDX header for fs/nfsd/trace.c 2020-11-30 13:00:24 -05:00
trace.h nfsd: eliminate the NFSD_FILE_BREAK_* flags 2022-08-17 14:40:02 +02:00
vfs.c vfs: fix copy_file_range() regression in cross-fs copies 2022-07-07 17:54:52 +02:00
vfs.h NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
xdr.h NFSD: prevent underflow in nfssvc_decode_writeargs() 2022-03-15 09:35:56 -04:00
xdr3.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4cb.h