Skip to content

Commit

Permalink
9p: fix return value in case in v9fs_fid_xattr_set()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
  • Loading branch information
Geyslan G. Bem authored and Eric Van Hensbergen committed Nov 23, 2013
1 parent 72fe18c commit bdd5c28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/9p/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit bdd5c28

Please sign in to comment.