aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-19 13:19:40 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-19 13:19:40 +0200
commitd2083a3152716c3a280a8dad1b93fb9092294639 (patch)
treefc7ebc6756666b65392c217eca151da1be3e8d14
parent22fdb8b99e074acb73ca6e3f4a38e7c67f522822 (diff)
downloadstable-queue-d2083a3152716c3a280a8dad1b93fb9092294639.tar.gz
5.15-stable patches
added patches: revert-lockd-introduce-safe-async-lock-op.patch
-rw-r--r--queue-5.15/revert-lockd-introduce-safe-async-lock-op.patch130
-rw-r--r--queue-5.15/series1
2 files changed, 131 insertions, 0 deletions
diff --git a/queue-5.15/revert-lockd-introduce-safe-async-lock-op.patch b/queue-5.15/revert-lockd-introduce-safe-async-lock-op.patch
new file mode 100644
index 0000000000..ee671281e7
--- /dev/null
+++ b/queue-5.15/revert-lockd-introduce-safe-async-lock-op.patch
@@ -0,0 +1,130 @@
+From 76e1aeedb29f3c198624b3ee2d11af1d5b13f4bc Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Fri, 19 Apr 2024 13:18:36 +0200
+Subject: Revert "lockd: introduce safe async lock op"
+
+From: Chuck Lever <chuck.lever@oracle.com>
+
+This reverts commit 2267b2e84593bd3d61a1188e68fba06307fa9dab.
+
+ltp test fcntl17 fails on v5.15.154. This was bisected to commit
+2267b2e84593 ("lockd: introduce safe async lock op").
+
+Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/filesystems/nfs/exporting.rst | 7 -------
+ fs/lockd/svclock.c | 4 +++-
+ fs/nfsd/nfs4state.c | 10 +++-------
+ include/linux/exportfs.h | 14 --------------
+ 4 files changed, 6 insertions(+), 29 deletions(-)
+
+--- a/Documentation/filesystems/nfs/exporting.rst
++++ b/Documentation/filesystems/nfs/exporting.rst
+@@ -241,10 +241,3 @@ following flags are defined:
+ all of an inode's dirty data on last close. Exports that behave this
+ way should set EXPORT_OP_FLUSH_ON_CLOSE so that NFSD knows to skip
+ waiting for writeback when closing such files.
+-
+- EXPORT_OP_ASYNC_LOCK - Indicates a capable filesystem to do async lock
+- requests from lockd. Only set EXPORT_OP_ASYNC_LOCK if the filesystem has
+- it's own ->lock() functionality as core posix_lock_file() implementation
+- has no async lock request handling yet. For more information about how to
+- indicate an async lock request from a ->lock() file_operations struct, see
+- fs/locks.c and comment for the function vfs_lock_file().
+--- a/fs/lockd/svclock.c
++++ b/fs/lockd/svclock.c
+@@ -470,7 +470,9 @@ nlmsvc_lock(struct svc_rqst *rqstp, stru
+ struct nlm_host *host, struct nlm_lock *lock, int wait,
+ struct nlm_cookie *cookie, int reclaim)
+ {
++#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
+ struct inode *inode = nlmsvc_file_inode(file);
++#endif
+ struct nlm_block *block = NULL;
+ int error;
+ int mode;
+@@ -484,7 +486,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, stru
+ (long long)lock->fl.fl_end,
+ wait);
+
+- if (!exportfs_lock_op_is_async(inode->i_sb->s_export_op)) {
++ if (nlmsvc_file_file(file)->f_op->lock) {
+ async_block = wait;
+ wait = 0;
+ }
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -7420,7 +7420,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
+ struct nfsd4_blocked_lock *nbl = NULL;
+ struct file_lock *file_lock = NULL;
+ struct file_lock *conflock = NULL;
+- struct super_block *sb;
+ __be32 status = 0;
+ int lkflg;
+ int err;
+@@ -7442,7 +7441,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
+ dprintk("NFSD: nfsd4_lock: permission denied!\n");
+ return status;
+ }
+- sb = cstate->current_fh.fh_dentry->d_sb;
+
+ if (lock->lk_is_new) {
+ if (nfsd4_has_session(cstate))
+@@ -7494,8 +7492,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
+ fp = lock_stp->st_stid.sc_file;
+ switch (lock->lk_type) {
+ case NFS4_READW_LT:
+- if (nfsd4_has_session(cstate) ||
+- exportfs_lock_op_is_async(sb->s_export_op))
++ if (nfsd4_has_session(cstate))
+ fl_flags |= FL_SLEEP;
+ fallthrough;
+ case NFS4_READ_LT:
+@@ -7507,8 +7504,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
+ fl_type = F_RDLCK;
+ break;
+ case NFS4_WRITEW_LT:
+- if (nfsd4_has_session(cstate) ||
+- exportfs_lock_op_is_async(sb->s_export_op))
++ if (nfsd4_has_session(cstate))
+ fl_flags |= FL_SLEEP;
+ fallthrough;
+ case NFS4_WRITE_LT:
+@@ -7536,7 +7532,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
+ * for file locks), so don't attempt blocking lock notifications
+ * on those filesystems:
+ */
+- if (!exportfs_lock_op_is_async(sb->s_export_op))
++ if (nf->nf_file->f_op->lock)
+ fl_flags &= ~FL_SLEEP;
+
+ nbl = find_or_allocate_block(lock_sop, &fp->fi_fhandle, nn);
+--- a/include/linux/exportfs.h
++++ b/include/linux/exportfs.h
+@@ -222,23 +222,9 @@ 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 */
+ unsigned long flags;
+ };
+
+-/**
+- * exportfs_lock_op_is_async() - export op supports async lock operation
+- * @export_ops: the nfs export operations to check
+- *
+- * Returns true if the nfs export_operations structure has
+- * EXPORT_OP_ASYNC_LOCK in their flags set
+- */
+-static inline bool
+-exportfs_lock_op_is_async(const struct export_operations *export_ops)
+-{
+- return export_ops->flags & EXPORT_OP_ASYNC_LOCK;
+-}
+-
+ extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,
+ int *max_len, struct inode *parent);
+ extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
diff --git a/queue-5.15/series b/queue-5.15/series
index ee8e0f8174..eb3855a64c 100644
--- a/queue-5.15/series
+++ b/queue-5.15/series
@@ -11,3 +11,4 @@ bpf-fix-out-of-bounds-access-for-ringbuf-helpers.patch
bpf-fix-ringbuf-memory-type-confusion-when-passing-to-helpers.patch
kprobes-fix-possible-use-after-free-issue-on-kprobe-registration.patch
revert-tracing-trigger-fix-to-return-error-if-failed-to-alloc-snapshot.patch
+revert-lockd-introduce-safe-async-lock-op.patch