Skip to content

Commit 7c53e84

Browse files
Alexander Aringteigland
authored andcommitted
dlm: fix plock lookup when using multiple lockspaces
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: 57e2c2f ("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>
1 parent a3d85fc commit 7c53e84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/dlm/plock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
556556
op = plock_lookup_waiter(&info);
557557
} else {
558558
list_for_each_entry(iter, &recv_list, list) {
559-
if (!iter->info.wait) {
559+
if (!iter->info.wait &&
560+
iter->info.fsid == info.fsid) {
560561
op = iter;
561562
break;
562563
}
@@ -568,8 +569,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
568569
if (info.wait)
569570
WARN_ON(op->info.optype != DLM_PLOCK_OP_LOCK);
570571
else
571-
WARN_ON(op->info.fsid != info.fsid ||
572-
op->info.number != info.number ||
572+
WARN_ON(op->info.number != info.number ||
573573
op->info.owner != info.owner ||
574574
op->info.optype != info.optype);
575575

0 commit comments

Comments
 (0)