All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/9p/: don't treat error as status value in file locking
@ 2014-06-22 23:44 Sasha Levin
  2014-08-06  0:53 ` Sasha Levin
  2014-08-10  7:41 ` [V9fs-developer] " Aneesh Kumar K.V
  0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2014-06-22 23:44 UTC (permalink / raw)
  To: ericvh, rminnich, lucho; +Cc: v9fs-developer, linux-kernel, Sasha Levin

When trying to lock a file we didn't properly handle the case where a
failure in p9_client_lock_dotl() occurs and treated the status value
as valid instead of discarding it due to the error.

This would usually trigger a BUG() since the status value would
just be stack garbage.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 fs/9p/vfs_file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 520c11c..06077f3 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	for (;;) {
 		res = p9_client_lock_dotl(fid, &flock, &status);
 		if (res < 0)
-			break;
+			return res;
 
 		if (status != P9_LOCK_BLOCKED)
 			break;
-- 
1.7.10.4


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

* Re: [PATCH] fs/9p/: don't treat error as status value in file locking
  2014-06-22 23:44 [PATCH] fs/9p/: don't treat error as status value in file locking Sasha Levin
@ 2014-08-06  0:53 ` Sasha Levin
  2014-08-10  7:41 ` [V9fs-developer] " Aneesh Kumar K.V
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2014-08-06  0:53 UTC (permalink / raw)
  To: Sasha Levin, ericvh, rminnich, lucho; +Cc: v9fs-developer, linux-kernel

Ping?

On 06/22/2014 07:44 PM, Sasha Levin wrote:
> When trying to lock a file we didn't properly handle the case where a
> failure in p9_client_lock_dotl() occurs and treated the status value
> as valid instead of discarding it due to the error.
> 
> This would usually trigger a BUG() since the status value would
> just be stack garbage.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  fs/9p/vfs_file.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 520c11c..06077f3 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
>  	for (;;) {
>  		res = p9_client_lock_dotl(fid, &flock, &status);
>  		if (res < 0)
> -			break;
> +			return res;
>  
>  		if (status != P9_LOCK_BLOCKED)
>  			break;
> 


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

* Re: [V9fs-developer] [PATCH] fs/9p/: don't treat error as status value in file locking
  2014-06-22 23:44 [PATCH] fs/9p/: don't treat error as status value in file locking Sasha Levin
  2014-08-06  0:53 ` Sasha Levin
@ 2014-08-10  7:41 ` Aneesh Kumar K.V
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2014-08-10  7:41 UTC (permalink / raw)
  To: Sasha Levin, ericvh, rminnich, lucho
  Cc: v9fs-developer, linux-kernel, Sasha Levin

Sasha Levin <sasha.levin@oracle.com> writes:

> When trying to lock a file we didn't properly handle the case where a
> failure in p9_client_lock_dotl() occurs and treated the status value
> as valid instead of discarding it due to the error.
>
> This would usually trigger a BUG() since the status value would
> just be stack garbage.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  fs/9p/vfs_file.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 520c11c..06077f3 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
>  	for (;;) {
>  		res = p9_client_lock_dotl(fid, &flock, &status);
>  		if (res < 0)
> -			break;
> +			return res;
>
>  		if (status != P9_LOCK_BLOCKED)
>  			break;

We may want to do the local revert of the posix lock held. ie,

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 520c11c2dcca..20ed603e60b2 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	for (;;) {
 		res = p9_client_lock_dotl(fid, &flock, &status);
 		if (res < 0)
-			break;
+			goto err_out;
 
 		if (status != P9_LOCK_BLOCKED)
 			break;
@@ -220,6 +220,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 		BUG();
 	}
 
+err_out:
 	/*
 	 * incase server returned error for lock request, revert
 	 * it locally


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

end of thread, other threads:[~2014-08-10  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-22 23:44 [PATCH] fs/9p/: don't treat error as status value in file locking Sasha Levin
2014-08-06  0:53 ` Sasha Levin
2014-08-10  7:41 ` [V9fs-developer] " Aneesh Kumar K.V

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.