Skip to content

Commit bdd5c28

Browse files
geyslanericvh
authored andcommitted
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: Geyslan G. Bem <[email protected]> Signed-off-by: Eric Van Hensbergen <[email protected]>
1 parent 72fe18c commit bdd5c28

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/9p/xattr.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
138138
if (retval < 0) {
139139
p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
140140
retval);
141-
p9_client_clunk(fid);
142-
return retval;
141+
goto err;
143142
}
144143
msize = fid->clnt->msize;
145144
while (value_len) {
@@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
152151
if (write_count < 0) {
153152
/* error in xattr write */
154153
retval = write_count;
155-
break;
154+
goto err;
156155
}
157156
offset += write_count;
158157
value_len -= write_count;
159158
}
160-
return p9_client_clunk(fid);
159+
retval = offset;
160+
err:
161+
p9_client_clunk(fid);
162+
return retval;
161163
}
162164

163165
ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)

0 commit comments

Comments
 (0)