Skip to contentSkip to conversation

fuse: make written data persistent after writing

PATCH In review Liu Bo 3 participants 6 messages Mar 3, 2020 – Mar 11, 2020

Subsystems (2)
lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 fuse: make written data persistent after writing

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

---
This patch is based on 5.5-rc5.

 fs/fuse/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/fuse/file.c +2 -0
index a63d779eac10..08e3df618d7f 100644
@@ -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;
 }
Signature · 1 line
1.8.3.1
maintainer
#2 lore raw
In reply to Liu Bo
Quoted 3 lines · Liu Bo

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

author
#3 lore raw
Quoted 10 lines · Miklos Szeredi
Quoted 3 lines · Liu Bo

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

maintainer
#4 lore raw
Quoted 9 lines · Liu Bo
Quoted 7 lines · Miklos Szeredi
Quoted 3 lines · Liu Bo

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?

Quoted 7 lines
Quoted 3 lines

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

author
#5 lore raw
Quoted 14 lines · Miklos Szeredi
Quoted 13 lines · Liu Bo
Quoted 10 lines · Miklos Szeredi
Quoted 3 lines · Liu Bo

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.

Quoted 6 lines
Quoted 3 lines

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