From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Teigland Date: Fri, 8 Jun 2007 16:51:57 -0500 Subject: [Cluster-devel] [PATCH] GFS2: return conflicts for GETLK Message-ID: <20070608215157.GN31758@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit We weren't returning the correct result when GETLK found a conflict, which is indicated by userspace passing back a 1. Signed-off-by: Abhijith Das Signed-off-by: David Teigland Index: linux-quilt/fs/gfs2/locking/dlm/plock.c =================================================================== --- linux-quilt.orig/fs/gfs2/locking/dlm/plock.c 2007-06-08 15:26:03.000000000 -0500 +++ linux-quilt/fs/gfs2/locking/dlm/plock.c 2007-06-08 16:43:40.000000000 -0500 @@ -254,16 +254,20 @@ } spin_unlock(&ops_lock); + /* info.rv from userspace is 1 for conflict, 0 for no-conflict, + -ENOENT if there are no locks on the file */ + rv = op->info.rv; fl->fl_type = F_UNLCK; if (rv == -ENOENT) rv = 0; - else if (rv == 0 && op->info.pid != fl->fl_pid) { + else if (rv > 1) { fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; fl->fl_pid = op->info.pid; fl->fl_start = op->info.start; fl->fl_end = op->info.end; + rv = 0; } kfree(op);