]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fs: dlm: return positive pid value for F_GETLK
authorAlexander Aring <aahringo@redhat.com>
Fri, 19 May 2023 15:21:24 +0000 (11:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 09:33:45 +0000 (11:33 +0200)
commit 92655fbda5c05950a411eaabc19e025e86e2a291 upstream.

The GETLK pid values have all been negated since commit 9d5b86ac13c5
("fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks").
Revert this for local pids, and leave in place negative pids for remote
owners.

Cc: stable@vger.kernel.org
Fixes: 9d5b86ac13c5 ("fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks")
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>
fs/dlm/plock.c

index b53ca4df7e773fd139af294fba1cb1f15b82b7dd..25bf72c15d161744f701a64b8fba8ca4e6c8c5b9 100644 (file)
@@ -366,7 +366,9 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
                locks_init_lock(fl);
                fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK;
                fl->fl_flags = FL_POSIX;
-               fl->fl_pid = -op->info.pid;
+               fl->fl_pid = op->info.pid;
+               if (op->info.nodeid != dlm_our_nodeid())
+                       fl->fl_pid = -fl->fl_pid;
                fl->fl_start = op->info.start;
                fl->fl_end = op->info.end;
                rv = 0;