Commit bdd5c28d authored by Geyslan G. Bem's avatar Geyslan G. Bem Committed by Eric Van Hensbergen

9p: fix return value in case in v9fs_fid_xattr_set()

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: default avatarGeyslan G. Bem <geyslan@gmail.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 72fe18c9
...@@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, ...@@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
if (retval < 0) { if (retval < 0) {
p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n", p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
retval); retval);
p9_client_clunk(fid); goto err;
return retval;
} }
msize = fid->clnt->msize; msize = fid->clnt->msize;
while (value_len) { while (value_len) {
...@@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, ...@@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
if (write_count < 0) { if (write_count < 0) {
/* error in xattr write */ /* error in xattr write */
retval = write_count; retval = write_count;
break; goto err;
} }
offset += write_count; offset += write_count;
value_len -= 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) ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment