Skip to content

Commit 252cf7b

Browse files
committed
9p: Use length of data written to the server in preference to error
In v9fs_upload_to_server(), we pass the error to netfslib to terminate the subreq rather than the amount of data written - even if we did actually write something. Further, we assume that the write is always entirely done if successful - but it might have been partially complete - as returned by p9_client_write(), but we ignore that. Fix this by indicating the amount written by preference and only returning the error if we didn't write anything. (We might want to return both in future if both are available as this might be useful as to whether we retry or not.) Suggested-by: Dominique Martinet <asmadeus@codewreck.org> Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/ Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Dominique Martinet <asmadeus@codewreck.org> cc: Eric Van Hensbergen <ericvh@kernel.org> cc: Latchesar Ionkov <lucho@ionkov.net> cc: Christian Schoenebeck <linux_oss@crudebyte.com> cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org
1 parent 6c2c1e0 commit 252cf7b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fs/9p/vfs_addr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@
2929
static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq)
3030
{
3131
struct p9_fid *fid = subreq->rreq->netfs_priv;
32-
int err;
32+
int err, len;
3333

3434
trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
35-
p9_client_write(fid, subreq->start, &subreq->io_iter, &err);
36-
netfs_write_subrequest_terminated(subreq, err < 0 ? err : subreq->len,
37-
false);
35+
len = p9_client_write(fid, subreq->start, &subreq->io_iter, &err);
36+
netfs_write_subrequest_terminated(subreq, len ?: err, false);
3837
}
3938

4039
static void v9fs_upload_to_server_worker(struct work_struct *work)

0 commit comments

Comments
 (0)