9p: Use length of data written to the server in preference to error
authorDavid Howells <dhowells@redhat.com>
Wed, 3 Jan 2024 14:30:48 +0000 (14:30 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 4 Jan 2024 13:15:31 +0000 (13:15 +0000)
commit252cf7b2eaf7cb904580ffbb0126d23411bcb43d
tree81f7cb65ba9f47e8a08569feaf8264b980e1282f
parent6c2c1e0009e97381a032d8c84747a46082fd327c
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
fs/9p/vfs_addr.c