Re: [RFC PATCH 17/17] netfs: Combine prepare and issue ops and grab the buffers on request

From: ChenXiaoSong

Date: Mon Mar 23 2026 - 15:05:58 EST


Hi David,

https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=netfs-next&id=a99af9686490fa9a099679bcbfa1b56c839b8d98

I reviewed this patch in your repository's netfs-next branch (it looks slightly different from the version posted to the mailing list) and found two issues, the following additional changes are needed:

```
--- a/fs/netfs/direct_write.c
+++ b/fs/netfs/direct_write.c
@@ -161,8 +161,8 @@ static int netfs_unbuffered_write(struct netfs_io_request *wreq)
break;
}
netfs_put_subrequest(subreq, netfs_sreq_trace_put_failed);
- subreq = NULL;
ret = subreq->error;
+ subreq = NULL;
goto failed;
}
break;
diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c
index 697a47e96d2a..112363f17a84 100644
--- a/fs/netfs/write_issue.c
+++ b/fs/netfs/write_issue.c
@@ -808,6 +808,7 @@ struct netfs_writethrough *netfs_begin_writethrough(struct kiocb *iocb, size_t l
if (bvecq_buffer_init(&wreq->load_cursor, GFP_NOFS) < 0) {
netfs_put_failed_request(wreq);
mutex_unlock(&ictx->wb_lock);
+ kfree(wthru);
return ERR_PTR(-ENOMEM);
}
```