* [PATCH] scsi: target: core: add missing file_{start,end}_write()
@ 2023-11-23 9:20 Amir Goldstein
2023-11-23 15:16 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Amir Goldstein @ 2023-11-23 9:20 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Christian Brauner, Christoph Hellwig, Jan Kara, Josef Bacik,
David Howells, Jens Axboe, Miklos Szeredi, Al Viro, linux-fsdevel,
linux-scsi, target-devel, stable
The callers of vfs_iter_write() are required to hold file_start_write().
file_start_write() is a no-op for the S_ISBLK() case, but it is really
needed when the backing file is a regular file.
We are going to move file_{start,end}_write() into vfs_iter_write(), but
we need to fix this first, so that the fix could be backported to stable
kernels.
Suggested-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/ZV8ETIpM+wZa33B5@infradead.org/
Cc: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
Hi Martin,
This bug is already fixed by commit "fs: move file_start_write() into
vfs_iter_write()" on the vfs.rw branch in Christian's vfs tree, but
Christoph suggested that I post a separate backportable fix for the scsi
target code.
You may decide if this is worth expediting to v6.7-rc or not.
If not, then I think it would be best if Christian insert this patch
at the bottom of the vfs.rw branch and revert in the later aformentioned
commit.
If you prefer to expedite it to v6.7-rc, then it's probably best to
rebase vfs.rw branch after the fix hits master.
Please let us know how you prefer to handle this patch.
Thanks,
Amir.
drivers/target/target_core_file.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 4d447520bab8..4e4cf6c34a77 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -332,11 +332,13 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd,
}
iov_iter_bvec(&iter, is_write, bvec, sgl_nents, len);
- if (is_write)
+ if (is_write) {
+ file_start_write(fd);
ret = vfs_iter_write(fd, &iter, &pos, 0);
- else
+ file_end_write(fd);
+ } else {
ret = vfs_iter_read(fd, &iter, &pos, 0);
-
+ }
if (is_write) {
if (ret < 0 || ret != data_length) {
pr_err("%s() write returned %d\n", __func__, ret);
@@ -467,7 +469,9 @@ fd_execute_write_same(struct se_cmd *cmd)
}
iov_iter_bvec(&iter, ITER_SOURCE, bvec, nolb, len);
+ file_start_write(fd_dev->fd_file);
ret = vfs_iter_write(fd_dev->fd_file, &iter, &pos, 0);
+ file_end_write(fd_dev->fd_file);
kfree(bvec);
if (ret < 0 || ret != len) {
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: target: core: add missing file_{start,end}_write()
2023-11-23 9:20 [PATCH] scsi: target: core: add missing file_{start,end}_write() Amir Goldstein
@ 2023-11-23 15:16 ` Christoph Hellwig
2023-11-23 20:04 ` Jens Axboe
2023-11-24 8:23 ` Christian Brauner
2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2023-11-23 15:16 UTC (permalink / raw)
To: Amir Goldstein
Cc: Martin K . Petersen, Christian Brauner, Christoph Hellwig,
Jan Kara, Josef Bacik, David Howells, Jens Axboe, Miklos Szeredi,
Al Viro, linux-fsdevel, linux-scsi, target-devel, stable
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: target: core: add missing file_{start,end}_write()
2023-11-23 9:20 [PATCH] scsi: target: core: add missing file_{start,end}_write() Amir Goldstein
2023-11-23 15:16 ` Christoph Hellwig
@ 2023-11-23 20:04 ` Jens Axboe
2023-11-24 7:54 ` Amir Goldstein
2023-11-24 8:23 ` Christian Brauner
2 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2023-11-23 20:04 UTC (permalink / raw)
To: Amir Goldstein, Martin K . Petersen
Cc: Christian Brauner, Christoph Hellwig, Jan Kara, Josef Bacik,
David Howells, Miklos Szeredi, Al Viro, linux-fsdevel, linux-scsi,
target-devel, stable
On 11/23/23 2:20 AM, Amir Goldstein wrote:
> The callers of vfs_iter_write() are required to hold file_start_write().
> file_start_write() is a no-op for the S_ISBLK() case, but it is really
> needed when the backing file is a regular file.
>
> We are going to move file_{start,end}_write() into vfs_iter_write(), but
> we need to fix this first, so that the fix could be backported to stable
> kernels.
Reviewed-by: Jens Axboe <axboe@kernel.dk>
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: target: core: add missing file_{start,end}_write()
2023-11-23 20:04 ` Jens Axboe
@ 2023-11-24 7:54 ` Amir Goldstein
2023-11-24 8:24 ` Christian Brauner
0 siblings, 1 reply; 7+ messages in thread
From: Amir Goldstein @ 2023-11-24 7:54 UTC (permalink / raw)
To: Christian Brauner
Cc: Martin K . Petersen, Christoph Hellwig, Jan Kara, Josef Bacik,
David Howells, Miklos Szeredi, Al Viro, linux-fsdevel, linux-scsi,
target-devel, stable, Jens Axboe
On Thu, Nov 23, 2023 at 10:04 PM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 11/23/23 2:20 AM, Amir Goldstein wrote:
> > The callers of vfs_iter_write() are required to hold file_start_write().
> > file_start_write() is a no-op for the S_ISBLK() case, but it is really
> > needed when the backing file is a regular file.
> >
> > We are going to move file_{start,end}_write() into vfs_iter_write(), but
> > we need to fix this first, so that the fix could be backported to stable
> > kernels.
>
> Reviewed-by: Jens Axboe <axboe@kernel.dk>
>
Christian,
Shall we just stash this at the bottom of vfs.rw and fixup
"move file_{start,end}_write() into vfs_iter_write()" patch?
I see no strong reason to expedite a fix for something rare
that has been broken for a long time.
If Martin decides to expedite it, we can alway rebase vfs.rw
once the fix is merged to master.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: target: core: add missing file_{start,end}_write()
2023-11-24 7:54 ` Amir Goldstein
@ 2023-11-24 8:24 ` Christian Brauner
2023-11-24 22:46 ` Martin K. Petersen
0 siblings, 1 reply; 7+ messages in thread
From: Christian Brauner @ 2023-11-24 8:24 UTC (permalink / raw)
To: Amir Goldstein
Cc: Martin K . Petersen, Christoph Hellwig, Jan Kara, Josef Bacik,
David Howells, Miklos Szeredi, Al Viro, linux-fsdevel, linux-scsi,
target-devel, stable, Jens Axboe
On Fri, Nov 24, 2023 at 09:54:49AM +0200, Amir Goldstein wrote:
> On Thu, Nov 23, 2023 at 10:04 PM Jens Axboe <axboe@kernel.dk> wrote:
> >
> > On 11/23/23 2:20 AM, Amir Goldstein wrote:
> > > The callers of vfs_iter_write() are required to hold file_start_write().
> > > file_start_write() is a no-op for the S_ISBLK() case, but it is really
> > > needed when the backing file is a regular file.
> > >
> > > We are going to move file_{start,end}_write() into vfs_iter_write(), but
> > > we need to fix this first, so that the fix could be backported to stable
> > > kernels.
> >
> > Reviewed-by: Jens Axboe <axboe@kernel.dk>
> >
>
> Christian,
>
> Shall we just stash this at the bottom of vfs.rw and fixup
> "move file_{start,end}_write() into vfs_iter_write()" patch?
Ok.
>
> I see no strong reason to expedite a fix for something rare
> that has been broken for a long time.
Agreed.
>
> If Martin decides to expedite it, we can alway rebase vfs.rw
> once the fix is merged to master.
It's now the first commit on that branch. Let me know if I should drop it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: target: core: add missing file_{start,end}_write()
2023-11-24 8:24 ` Christian Brauner
@ 2023-11-24 22:46 ` Martin K. Petersen
0 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2023-11-24 22:46 UTC (permalink / raw)
To: Christian Brauner
Cc: Amir Goldstein, Martin K . Petersen, Christoph Hellwig, Jan Kara,
Josef Bacik, David Howells, Miklos Szeredi, Al Viro,
linux-fsdevel, linux-scsi, target-devel, stable, Jens Axboe
Christian,
>> If Martin decides to expedite it, we can alway rebase vfs.rw
>> once the fix is merged to master.
>
> It's now the first commit on that branch.
That's fine.
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: target: core: add missing file_{start,end}_write()
2023-11-23 9:20 [PATCH] scsi: target: core: add missing file_{start,end}_write() Amir Goldstein
2023-11-23 15:16 ` Christoph Hellwig
2023-11-23 20:04 ` Jens Axboe
@ 2023-11-24 8:23 ` Christian Brauner
2 siblings, 0 replies; 7+ messages in thread
From: Christian Brauner @ 2023-11-24 8:23 UTC (permalink / raw)
To: Martin K . Petersen, Amir Goldstein
Cc: Christian Brauner, Christoph Hellwig, Jan Kara, Josef Bacik,
David Howells, Jens Axboe, Miklos Szeredi, Al Viro, linux-fsdevel,
linux-scsi, target-devel, stable
On Thu, 23 Nov 2023 11:20:00 +0200, Amir Goldstein wrote:
> The callers of vfs_iter_write() are required to hold file_start_write().
> file_start_write() is a no-op for the S_ISBLK() case, but it is really
> needed when the backing file is a regular file.
>
> We are going to move file_{start,end}_write() into vfs_iter_write(), but
> we need to fix this first, so that the fix could be backported to stable
> kernels.
>
> [...]
Applied to the vfs.rw branch of the vfs/vfs.git tree.
Patches in the vfs.rw branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.rw
[1/1] scsi: target: core: add missing file_{start,end}_write()
https://git.kernel.org/vfs/vfs/c/c85ff53e59e8
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-24 22:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 9:20 [PATCH] scsi: target: core: add missing file_{start,end}_write() Amir Goldstein
2023-11-23 15:16 ` Christoph Hellwig
2023-11-23 20:04 ` Jens Axboe
2023-11-24 7:54 ` Amir Goldstein
2023-11-24 8:24 ` Christian Brauner
2023-11-24 22:46 ` Martin K. Petersen
2023-11-24 8:23 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).