mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 9p: fix return value in case in v9fs_fid_xattr_set()
@ 2013-10-21 19:47 Geyslan G. Bem
  2013-10-21 20:33 ` Geyslan Gregório Bem
  0 siblings, 1 reply; 2+ messages in thread
From: Geyslan G. Bem @ 2013-10-21 19:47 UTC (permalink / raw)
  To: kernel-br
  Cc: Geyslan G. Bem, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, open list:9P FILE SYSTEM, open list

In case of error in the p9_client_write, the function v9fs_fid_xattr_set
should return its negative value, what was never being done.

In case of success it only retuned 0. Now it returns the 'offset'
variable (write_count total).

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 fs/9p/xattr.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index 3c28cdf..04133a1 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
 	if (retval < 0) {
 		p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
 			 retval);
-		p9_client_clunk(fid);
-		return retval;
+		goto err;
 	}
 	msize = fid->clnt->msize;
 	while (value_len) {
@@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
 		if (write_count < 0) {
 			/* error in xattr write */
 			retval = write_count;
-			break;
+			goto err;
 		}
 		offset += write_count;
 		value_len -= write_count;
 	}
-	return p9_client_clunk(fid);
+	retval = offset;
+err:
+	p9_client_clunk(fid);
+	return retval;
 }
 
 ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
-- 
1.8.4


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

* Re: [PATCH] 9p: fix return value in case in v9fs_fid_xattr_set()
  2013-10-21 19:47 [PATCH] 9p: fix return value in case in v9fs_fid_xattr_set() Geyslan G. Bem
@ 2013-10-21 20:33 ` Geyslan Gregório Bem
  0 siblings, 0 replies; 2+ messages in thread
From: Geyslan Gregório Bem @ 2013-10-21 20:33 UTC (permalink / raw)
  To: kernel-br
  Cc: Geyslan G. Bem, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, open list:9P FILE SYSTEM, open list

2013/10/21 Geyslan G. Bem <geyslan@gmail.com>:
> In case of error in the p9_client_write, the function v9fs_fid_xattr_set
> should return its negative value, what was never being done.
>
> In case of success it only retuned 0. Now it returns the 'offset'
> variable (write_count total).
>
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
>  fs/9p/xattr.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
> index 3c28cdf..04133a1 100644
> --- a/fs/9p/xattr.c
> +++ b/fs/9p/xattr.c
> @@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
>         if (retval < 0) {
>                 p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
>                          retval);
> -               p9_client_clunk(fid);
> -               return retval;
> +               goto err;
>         }
>         msize = fid->clnt->msize;
>         while (value_len) {
> @@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
>                 if (write_count < 0) {
>                         /* error in xattr write */
>                         retval = write_count;
> -                       break;
> +                       goto err;
>                 }
>                 offset += write_count;
>                 value_len -= write_count;
>         }
> -       return p9_client_clunk(fid);
> +       retval = offset;
> +err:
> +       p9_client_clunk(fid);
> +       return retval;
>  }
>
>  ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
> --
> 1.8.4
>

Eric,

As you can see, I modified the success return value to the offset
(write_count sum), following the same principle of
v9fs_fid_xattr_get():
http://lxr.free-electrons.com/source/fs/9p/xattr.c#L65

What do you think?

Regards.

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

end of thread, other threads:[~2013-10-21 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21 19:47 [PATCH] 9p: fix return value in case in v9fs_fid_xattr_set() Geyslan G. Bem
2013-10-21 20:33 ` Geyslan Gregório Bem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®