diff options
| author | Mike Snitzer <snitzer@kernel.org> | 2025-02-10 19:25:53 +0300 |
|---|---|---|
| committer | Chuck Lever <chuck.lever@oracle.com> | 2025-03-10 16:11:08 +0300 |
| commit | 9254c8ae9b8172d9ad26e620a4bbc604a1efa7fa (patch) | |
| tree | 18e570061387209e273374459ea9ed87e11b1001 /include/linux/exportfs.h | |
| parent | fbfdc9fc0f66e7877a6d1a6e44c6acac46c5b811 (diff) | |
| download | linux-9254c8ae9b8172d9ad26e620a4bbc604a1efa7fa.tar.xz | |
nfsd: disallow file locking and delegations for NFSv4 reexport
We do not and cannot support file locking with NFS reexport over
NFSv4.x for the same reason we don't do it for NFSv3: NFS reexport
server reboot cannot allow clients to recover locks because the source
NFS server has not rebooted, and so it is not in grace. Since the
source NFS server is not in grace, it cannot offer any guarantees that
the file won't have been changed between the locks getting lost and
any attempt to recover/reclaim them. The same applies to delegations
and any associated locks, so disallow them too.
Clients are no longer allowed to get file locks or delegations from a
reexport server, any attempts will fail with operation not supported.
Update the "Reboot recovery" section accordingly in
Documentation/filesystems/nfs/reexport.rst
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include/linux/exportfs.h')
| -rw-r--r-- | include/linux/exportfs.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index a087606ace19..fc93f0abf513 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -279,10 +279,22 @@ struct export_operations { atomic attribute updates */ #define EXPORT_OP_FLUSH_ON_CLOSE (0x20) /* fs flushes file data on close */ -#define EXPORT_OP_ASYNC_LOCK (0x40) /* fs can do async lock request */ +#define EXPORT_OP_NOLOCKS (0x40) /* no file locking support */ unsigned long flags; }; +/** + * exportfs_cannot_lock() - check if export implements file locking + * @export_ops: the nfs export operations to check + * + * Returns true if the export does not support file locking. + */ +static inline bool +exportfs_cannot_lock(const struct export_operations *export_ops) +{ + return export_ops->flags & EXPORT_OP_NOLOCKS; +} + extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, int *max_len, struct inode *parent, int flags); |
