cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] GFS2: return conflicts for GETLK
@ 2007-06-08 21:51 David Teigland
  2007-06-08 22:01 ` David Teigland
  0 siblings, 1 reply; 3+ messages in thread
From: David Teigland @ 2007-06-08 21:51 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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 <adas@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

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);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] [PATCH] GFS2: return conflicts for GETLK
  2007-06-08 21:51 [Cluster-devel] [PATCH] GFS2: return conflicts for GETLK David Teigland
@ 2007-06-08 22:01 ` David Teigland
  2007-06-09 14:33   ` [Cluster-devel] " Steven Whitehouse
  0 siblings, 1 reply; 3+ messages in thread
From: David Teigland @ 2007-06-08 22:01 UTC (permalink / raw)
  To: cluster-devel.redhat.com

We weren't returning the correct result when GETLK found a conflict,
which is indicated by userspace passing back a 1.
(Typo in the previous post of this patch.)

Signed-off-by: Abhijith Das <adas redhat com>
Signed-off-by: David Teigland <teigland redhat com>

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:59:54.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 > 0) {
 		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);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] Re: [PATCH] GFS2: return conflicts for GETLK
  2007-06-08 22:01 ` David Teigland
@ 2007-06-09 14:33   ` Steven Whitehouse
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Whitehouse @ 2007-06-09 14:33 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Now added to the GFS2 -nmw git tree. Thanks,

Steve.

On Fri, 2007-06-08 at 17:01 -0500, David Teigland wrote:
> We weren't returning the correct result when GETLK found a conflict,
> which is indicated by userspace passing back a 1.
> (Typo in the previous post of this patch.)
> 
> Signed-off-by: Abhijith Das <adas redhat com>
> Signed-off-by: David Teigland <teigland redhat com>
> 
> 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:59:54.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 > 0) {
>  		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);



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-09 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-08 21:51 [Cluster-devel] [PATCH] GFS2: return conflicts for GETLK David Teigland
2007-06-08 22:01 ` David Teigland
2007-06-09 14:33   ` [Cluster-devel] " Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).