diff options
author | Alexander Aring | 2023-08-24 16:51:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-09-13 09:43:02 +0200 |
commit | 9667854e69a7b42cd9ae0fa8a0e7bcf437644a02 (patch) | |
tree | df5d26e76d4d9206ad3364d84166f495fd293164 /fs/dlm/plock.c | |
parent | c96c67991aac6401b4c6996093bccb704bb2ea4b (diff) |
dlm: fix plock lookup when using multiple lockspaces
commit 7c53e847ff5e97f033fdd31f71949807633d506b upstream.
All posix lock ops, for all lockspaces (gfs2 file systems) are
sent to userspace (dlm_controld) through a single misc device.
The dlm_controld daemon reads the ops from the misc device
and sends them to other cluster nodes using separate, per-lockspace
cluster api communication channels. The ops for a single lockspace
are ordered at this level, so that the results are received in
the same sequence that the requests were sent. When the results
are sent back to the kernel via the misc device, they are again
funneled through the single misc device for all lockspaces. When
the dlm code in the kernel processes the results from the misc
device, these results will be returned in the same sequence that
the requests were sent, on a per-lockspace basis. A recent change
in this request/reply matching code missed the "per-lockspace"
check (fsid comparison) when matching request and reply, so replies
could be incorrectly matched to requests from other lockspaces.
Cc: stable@vger.kernel.org
Reported-by: Barry Marson <bmarson@redhat.com>
Fixes: 57e2c2f2d94c ("fs: dlm: fix mismatch of plock results from userspace")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/dlm/plock.c')
-rw-r--r-- | fs/dlm/plock.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index 739e7d55c9e3..1bf5c51a4c23 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -455,7 +455,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, } } else { list_for_each_entry(iter, &recv_list, list) { - if (!iter->info.wait) { + if (!iter->info.wait && + iter->info.fsid == info.fsid) { op = iter; break; } @@ -467,8 +468,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, if (info.wait) WARN_ON(op->info.optype != DLM_PLOCK_OP_LOCK); else - WARN_ON(op->info.fsid != info.fsid || - op->info.number != info.number || + WARN_ON(op->info.number != info.number || op->info.owner != info.owner || op->info.optype != info.optype); |