]> Git Repo - linux.git/commitdiff
dlm: fix plock lookup when using multiple lockspaces
authorAlexander Aring <[email protected]>
Thu, 24 Aug 2023 20:51:42 +0000 (16:51 -0400)
committerDavid Teigland <[email protected]>
Fri, 25 Aug 2023 15:31:39 +0000 (10:31 -0500)
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: [email protected]
Reported-by: Barry Marson <[email protected]>
Fixes: 57e2c2f2d94c ("fs: dlm: fix mismatch of plock results from userspace")
Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: David Teigland <[email protected]>
fs/dlm/plock.c

index 00e1d802a81cb71c33af93033c66b17e578a94c5..e6b4c1a2144668bbeec54b5be177e754782ecfca 100644 (file)
@@ -556,7 +556,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
                op = plock_lookup_waiter(&info);
        } 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;
                        }
@@ -568,8 +569,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);
 
This page took 0.057899 seconds and 4 git commands to generate.