All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fuse: make written data persistent after writing
@ 2020-03-03 21:15 ` Liu Bo
  0 siblings, 0 replies; 12+ messages in thread
From: Liu Bo @ 2020-03-03 21:15 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Miklos Szeredi, virtio-fs

If this is a DSYNC write, make sure we push it to stable storage now
that we've written data.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
This patch is based on 5.5-rc5.

 fs/fuse/file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a63d779eac10..08e3df618d7f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1541,6 +1541,8 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	if (res > 0)
 		fuse_write_update_size(inode, iocb->ki_pos);
 	inode_unlock(inode);
+	if (res > 0)
+		res = generic_write_sync(iocb, res);
 
 	return res;
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Virtio-fs] [PATCH] fuse: make written data persistent after writing
@ 2020-03-03 21:15 ` Liu Bo
  0 siblings, 0 replies; 12+ messages in thread
From: Liu Bo @ 2020-03-03 21:15 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: virtio-fs

If this is a DSYNC write, make sure we push it to stable storage now
that we've written data.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
This patch is based on 5.5-rc5.

 fs/fuse/file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a63d779eac10..08e3df618d7f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1541,6 +1541,8 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	if (res > 0)
 		fuse_write_update_size(inode, iocb->ki_pos);
 	inode_unlock(inode);
+	if (res > 0)
+		res = generic_write_sync(iocb, res);
 
 	return res;
 }
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Virtio-fs] [PATCH] fuse: make written data persistent after writing
  2020-03-03 21:15 ` [Virtio-fs] " Liu Bo
@ 2020-03-09 11:20   ` Stefan Hajnoczi
  -1 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2020-03-09 11:20 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, virtio-fs, mszeredi, vgoyal

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

On Wed, Mar 04, 2020 at 05:15:11AM +0800, Liu Bo wrote:
> If this is a DSYNC write, make sure we push it to stable storage now
> that we've written data.
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
> ---
> This patch is based on 5.5-rc5.
> 
>  fs/fuse/file.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Virtio-fs] [PATCH] fuse: make written data persistent after writing
@ 2020-03-09 11:20   ` Stefan Hajnoczi
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2020-03-09 11:20 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, virtio-fs, vgoyal

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

On Wed, Mar 04, 2020 at 05:15:11AM +0800, Liu Bo wrote:
> If this is a DSYNC write, make sure we push it to stable storage now
> that we've written data.
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
> ---
> This patch is based on 5.5-rc5.
> 
>  fs/fuse/file.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fuse: make written data persistent after writing
  2020-03-03 21:15 ` [Virtio-fs] " Liu Bo
@ 2020-03-10 10:14   ` Miklos Szeredi
  -1 siblings, 0 replies; 12+ messages in thread
From: Miklos Szeredi @ 2020-03-10 10:14 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, Miklos Szeredi, virtio-fs

On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
>
> If this is a DSYNC write, make sure we push it to stable storage now
> that we've written data.

If this is direct I/O then why do we need an fysnc() call?

The only thing needed should be correct setting O_DSYNC in the flags
field of the WRITE request, and it appears to me that that is already
being done.

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Virtio-fs] [PATCH] fuse: make written data persistent after writing
@ 2020-03-10 10:14   ` Miklos Szeredi
  0 siblings, 0 replies; 12+ messages in thread
From: Miklos Szeredi @ 2020-03-10 10:14 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, virtio-fs

On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
>
> If this is a DSYNC write, make sure we push it to stable storage now
> that we've written data.

If this is direct I/O then why do we need an fysnc() call?

The only thing needed should be correct setting O_DSYNC in the flags
field of the WRITE request, and it appears to me that that is already
being done.

Thanks,
Miklos



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fuse: make written data persistent after writing
  2020-03-10 10:14   ` [Virtio-fs] " Miklos Szeredi
@ 2020-03-10 18:46     ` Liu Bo
  -1 siblings, 0 replies; 12+ messages in thread
From: Liu Bo @ 2020-03-10 18:46 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, Miklos Szeredi, virtio-fs

On Tue, Mar 10, 2020 at 11:14:17AM +0100, Miklos Szeredi wrote:
> On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> >
> > If this is a DSYNC write, make sure we push it to stable storage now
> > that we've written data.
> 
> If this is direct I/O then why do we need an fysnc() call?
> 
> The only thing needed should be correct setting O_DSYNC in the flags
> field of the WRITE request, and it appears to me that that is already
> being done.

Given direct IO itself doesn't guarantee FUA or FLUSH, I think we
still need such a fsync() call to make sure a FUA/FLUSH is sent after
direct IO.

thanks,
-liubo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Virtio-fs] [PATCH] fuse: make written data persistent after writing
@ 2020-03-10 18:46     ` Liu Bo
  0 siblings, 0 replies; 12+ messages in thread
From: Liu Bo @ 2020-03-10 18:46 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, virtio-fs

On Tue, Mar 10, 2020 at 11:14:17AM +0100, Miklos Szeredi wrote:
> On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> >
> > If this is a DSYNC write, make sure we push it to stable storage now
> > that we've written data.
> 
> If this is direct I/O then why do we need an fysnc() call?
> 
> The only thing needed should be correct setting O_DSYNC in the flags
> field of the WRITE request, and it appears to me that that is already
> being done.

Given direct IO itself doesn't guarantee FUA or FLUSH, I think we
still need such a fsync() call to make sure a FUA/FLUSH is sent after
direct IO.

thanks,
-liubo



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fuse: make written data persistent after writing
  2020-03-10 18:46     ` [Virtio-fs] " Liu Bo
@ 2020-03-10 19:08       ` Miklos Szeredi
  -1 siblings, 0 replies; 12+ messages in thread
From: Miklos Szeredi @ 2020-03-10 19:08 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, Miklos Szeredi, virtio-fs

On Tue, Mar 10, 2020 at 7:46 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
>
> On Tue, Mar 10, 2020 at 11:14:17AM +0100, Miklos Szeredi wrote:
> > On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> > >
> > > If this is a DSYNC write, make sure we push it to stable storage now
> > > that we've written data.
> >
> > If this is direct I/O then why do we need an fysnc() call?
> >
> > The only thing needed should be correct setting O_DSYNC in the flags
> > field of the WRITE request, and it appears to me that that is already
> > being done.
>
> Given direct IO itself doesn't guarantee FUA or FLUSH, I think we
> still need such a fsync() call to make sure a FUA/FLUSH is sent after
> direct IO.

What I mean is that the server itself can call fsync(2) from the WRITE
request if it finds that fi->flags contains O_DSYNC.

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Virtio-fs] [PATCH] fuse: make written data persistent after writing
@ 2020-03-10 19:08       ` Miklos Szeredi
  0 siblings, 0 replies; 12+ messages in thread
From: Miklos Szeredi @ 2020-03-10 19:08 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, virtio-fs

On Tue, Mar 10, 2020 at 7:46 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
>
> On Tue, Mar 10, 2020 at 11:14:17AM +0100, Miklos Szeredi wrote:
> > On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> > >
> > > If this is a DSYNC write, make sure we push it to stable storage now
> > > that we've written data.
> >
> > If this is direct I/O then why do we need an fysnc() call?
> >
> > The only thing needed should be correct setting O_DSYNC in the flags
> > field of the WRITE request, and it appears to me that that is already
> > being done.
>
> Given direct IO itself doesn't guarantee FUA or FLUSH, I think we
> still need such a fsync() call to make sure a FUA/FLUSH is sent after
> direct IO.

What I mean is that the server itself can call fsync(2) from the WRITE
request if it finds that fi->flags contains O_DSYNC.

Thanks,
Miklos



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fuse: make written data persistent after writing
  2020-03-10 19:08       ` [Virtio-fs] " Miklos Szeredi
@ 2020-03-11  4:58         ` Liu Bo
  -1 siblings, 0 replies; 12+ messages in thread
From: Liu Bo @ 2020-03-11  4:58 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, Miklos Szeredi, virtio-fs

On Tue, Mar 10, 2020 at 08:08:49PM +0100, Miklos Szeredi wrote:
> On Tue, Mar 10, 2020 at 7:46 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> >
> > On Tue, Mar 10, 2020 at 11:14:17AM +0100, Miklos Szeredi wrote:
> > > On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> > > >
> > > > If this is a DSYNC write, make sure we push it to stable storage now
> > > > that we've written data.
> > >
> > > If this is direct I/O then why do we need an fysnc() call?
> > >
> > > The only thing needed should be correct setting O_DSYNC in the flags
> > > field of the WRITE request, and it appears to me that that is already
> > > being done.
> >
> > Given direct IO itself doesn't guarantee FUA or FLUSH, I think we
> > still need such a fsync() call to make sure a FUA/FLUSH is sent after
> > direct IO.
> 
> What I mean is that the server itself can call fsync(2) from the WRITE
> request if it finds that fi->flags contains O_DSYNC.

Right, I missed that with no_open FUSE_DIRECT_IO is not possible,
thanks for clarifying it.

thanks,
-liubo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Virtio-fs] [PATCH] fuse: make written data persistent after writing
@ 2020-03-11  4:58         ` Liu Bo
  0 siblings, 0 replies; 12+ messages in thread
From: Liu Bo @ 2020-03-11  4:58 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, virtio-fs

On Tue, Mar 10, 2020 at 08:08:49PM +0100, Miklos Szeredi wrote:
> On Tue, Mar 10, 2020 at 7:46 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> >
> > On Tue, Mar 10, 2020 at 11:14:17AM +0100, Miklos Szeredi wrote:
> > > On Tue, Mar 3, 2020 at 10:15 PM Liu Bo <bo.liu@linux.alibaba.com> wrote:
> > > >
> > > > If this is a DSYNC write, make sure we push it to stable storage now
> > > > that we've written data.
> > >
> > > If this is direct I/O then why do we need an fysnc() call?
> > >
> > > The only thing needed should be correct setting O_DSYNC in the flags
> > > field of the WRITE request, and it appears to me that that is already
> > > being done.
> >
> > Given direct IO itself doesn't guarantee FUA or FLUSH, I think we
> > still need such a fsync() call to make sure a FUA/FLUSH is sent after
> > direct IO.
> 
> What I mean is that the server itself can call fsync(2) from the WRITE
> request if it finds that fi->flags contains O_DSYNC.

Right, I missed that with no_open FUSE_DIRECT_IO is not possible,
thanks for clarifying it.

thanks,
-liubo



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-03-11  4:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 21:15 [PATCH] fuse: make written data persistent after writing Liu Bo
2020-03-03 21:15 ` [Virtio-fs] " Liu Bo
2020-03-09 11:20 ` Stefan Hajnoczi
2020-03-09 11:20   ` Stefan Hajnoczi
2020-03-10 10:14 ` Miklos Szeredi
2020-03-10 10:14   ` [Virtio-fs] " Miklos Szeredi
2020-03-10 18:46   ` Liu Bo
2020-03-10 18:46     ` [Virtio-fs] " Liu Bo
2020-03-10 19:08     ` Miklos Szeredi
2020-03-10 19:08       ` [Virtio-fs] " Miklos Szeredi
2020-03-11  4:58       ` Liu Bo
2020-03-11  4:58         ` [Virtio-fs] " Liu Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.