From: David Howells <dhowells@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: David Howells <dhowells@redhat.com>,
Paulo Alcantara <pc@manguebit.org>,
netfs@lists.linux.dev, linux-afs@lists.infradead.org,
linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 04/10] netfs: Fix i_size update for partial transfer
Date: Thu, 27 Aug 2026 10:38:19 +0100 [thread overview]
Message-ID: <20260827093828.1956211-5-dhowells@redhat.com> (raw)
In-Reply-To: <20260827093828.1956211-1-dhowells@redhat.com>
Fix netfs_unbuffered_write_done() to pass the amount written to
netfs_update_i_size() in the event of a partial transfer that ends in an
error.
That said, it might be better for the filesystem to mark the inode data as
invalid and recheck it in case something like a network error occurred that
prevented the reply from the server from being received.
Fixes: a0b4c7a49137e ("netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence")
Link: https://sashiko.dev/#/patchset/20260824120224.504575-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
---
fs/netfs/direct_write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c
index f7d7e1b54653..f33ccddaa826 100644
--- a/fs/netfs/direct_write.c
+++ b/fs/netfs/direct_write.c
@@ -21,7 +21,7 @@ static void netfs_unbuffered_write_done(struct netfs_io_request *wreq)
/* Okay, declare that all I/O is complete. */
trace_netfs_rreq(wreq, netfs_rreq_trace_write_done);
- if (!wreq->error)
+ if (wreq->transferred)
netfs_update_i_size(ictx, &ictx->inode, wreq->start, wreq->transferred);
if (wreq->origin == NETFS_DIO_WRITE &&
next prev parent reply other threads:[~2026-08-27 9:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 9:38 [PATCH v3 00/10] netfs, cachefiles: Miscellaneous fixes David Howells
2026-08-27 9:38 ` [PATCH v3 01/10] netfs: Fix uninitialized return value in netfs_unbuffered_write() David Howells
2026-08-27 9:38 ` [PATCH v3 02/10] netfs: Fix unbuffered/DIO write partial transfer error return David Howells
2026-08-27 9:38 ` [PATCH v3 03/10] netfs: Fix error vs transferred passed to ->ki_complete() David Howells
2026-08-27 9:38 ` David Howells [this message]
2026-08-27 9:38 ` [PATCH v3 05/10] netfs: Fix subreq ref leak David Howells
2026-08-27 9:38 ` [PATCH v3 06/10] netfs: break unbuffered write when netfs_alloc_subrequest() fails David Howells
2026-08-27 9:38 ` [PATCH v3 07/10] netfs: Fix readahead synchronisation issues by loading all folios upfront David Howells
2026-08-27 9:38 ` [PATCH v3 08/10] netfs: Mark folios with COPY_TO_CACHE whilst issuing subreqs David Howells
2026-08-27 9:38 ` [PATCH v3 09/10] netfs: Fix read progress reporting David Howells
2026-08-27 9:38 ` [PATCH v3 10/10] cachefiles: Fix potential UAF/KASAN warning David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827093828.1956211-5-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=christian@brauner.io \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netfs@lists.linux.dev \
--cc=pc@manguebit.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox