Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfs: don't allow reexport reclaims

In the reexport case, nfsd is currently passing along locks with the
reclaim bit set. The client sends a new lock request, which is granted
if there's currently no conflict--even if it's possible a conflicting
lock could have been briefly held in the interim.

We don't currently have any way to safely grant reclaim, so for now
let's just deny them all.

I'm doing this by passing the reclaim bit to nfs and letting it fail the
call, with the idea that eventually the client might be able to do
something more forgiving here.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

J. Bruce Fields and committed by
Chuck Lever
bb0a55bb b840be2f

+9
+3
fs/nfs/file.c
··· 806 806 807 807 nfs_inc_stats(inode, NFSIOS_VFSLOCK); 808 808 809 + if (fl->fl_flags & FL_RECLAIM) 810 + return -ENOGRACE; 811 + 809 812 /* No mandatory locks over NFS */ 810 813 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) 811 814 goto out_err;
+3
fs/nfsd/nfs4state.c
··· 6903 6903 if (!locks_in_grace(net) && lock->lk_reclaim) 6904 6904 goto out; 6905 6905 6906 + if (lock->lk_reclaim) 6907 + fl_flags |= FL_RECLAIM; 6908 + 6906 6909 fp = lock_stp->st_stid.sc_file; 6907 6910 switch (lock->lk_type) { 6908 6911 case NFS4_READW_LT:
+1
fs/nfsd/nfsproc.c
··· 881 881 { nfserr_serverfault, -ENFILE }, 882 882 { nfserr_io, -EUCLEAN }, 883 883 { nfserr_perm, -ENOKEY }, 884 + { nfserr_no_grace, -ENOGRACE}, 884 885 }; 885 886 int i; 886 887
+1
include/linux/errno.h
··· 31 31 #define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ 32 32 #define EIOCBQUEUED 529 /* iocb queued, will get completion event */ 33 33 #define ERECALLCONFLICT 530 /* conflict with recalled state */ 34 + #define ENOGRACE 531 /* NFS file lock reclaim refused */ 34 35 35 36 #endif
+1
include/linux/fs.h
··· 997 997 #define FL_UNLOCK_PENDING 512 /* Lease is being broken */ 998 998 #define FL_OFDLCK 1024 /* lock is "owned" by struct file */ 999 999 #define FL_LAYOUT 2048 /* outstanding pNFS layout */ 1000 + #define FL_RECLAIM 4096 /* reclaiming from a reboot server */ 1000 1001 1001 1002 #define FL_CLOSE_POSIX (FL_POSIX | FL_CLOSE) 1002 1003