* [PATCH] fuse: unnecessary fsync for read-only mounts
@ 2021-11-18 3:31 Peng Hao
0 siblings, 0 replies; 2+ messages in thread
From: Peng Hao @ 2021-11-18 3:31 UTC (permalink / raw)
To: miklos; +Cc: linux-fsdevel
File/directory fsync is not necessary for read-only mounts.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
fs/fuse/dir.c | 3 +++
fs/fuse/file.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 656e921f3506..1d4fed556c93 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1448,6 +1448,9 @@ static int fuse_dir_fsync(struct file *file, loff_t start, loff_t end,
if (fc->no_fsyncdir)
return 0;
+ if (sb_rdonly(inode->i_sb))
+ return 0;
+
inode_lock(inode);
err = fuse_fsync_common(file, start, end, datasync, FUSE_FSYNCDIR);
if (err == -ENOSYS) {
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d6c5f6361f7..18668fc00c3b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -550,6 +550,8 @@ static int fuse_fsync(struct file *file, loff_t start, loff_t end,
if (fuse_is_bad(inode))
return -EIO;
+ if (sb_rdonly(inode->i_sb))
+ return 0;
inode_lock(inode);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] fuse: unnecessary fsync for read-only mounts
@ 2021-11-29 2:38 Peng Hao
0 siblings, 0 replies; 2+ messages in thread
From: Peng Hao @ 2021-11-29 2:38 UTC (permalink / raw)
To: miklos; +Cc: linux-fsdevel
File/directory fsync is not necessary for read-only mounts.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
fs/fuse/dir.c | 3 +++
fs/fuse/file.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 656e921f3506..1d4fed556c93 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1448,6 +1448,9 @@ static int fuse_dir_fsync(struct file *file, loff_t start, loff_t end,
if (fc->no_fsyncdir)
return 0;
+ if (sb_rdonly(inode->i_sb))
+ return 0;
+
inode_lock(inode);
err = fuse_fsync_common(file, start, end, datasync, FUSE_FSYNCDIR);
if (err == -ENOSYS) {
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d6c5f6361f7..18668fc00c3b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -550,6 +550,8 @@ static int fuse_fsync(struct file *file, loff_t start, loff_t end,
if (fuse_is_bad(inode))
return -EIO;
+ if (sb_rdonly(inode->i_sb))
+ return 0;
inode_lock(inode);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-29 2:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-18 3:31 [PATCH] fuse: unnecessary fsync for read-only mounts Peng Hao
-- strict thread matches above, loose matches on Subject: below --
2021-11-29 2:38 Peng Hao
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).