Skip to contentSkip to conversation

fuse: unnecessary fsync for read-only mounts

PATCH New Peng Hao 1 participant 1 message Nov 18, 2021

Subsystems (2)
lore
Share & tools
lore

Peng Hao

author
#0 lore raw

PATCH 1/1 fuse: unnecessary fsync for read-only mounts

File/directory fsync is not necessary for read-only mounts.

---
 fs/fuse/dir.c  | 3 +++
 fs/fuse/file.c | 2 ++
 2 files changed, 5 insertions(+)
fs/fuse/dir.c +3 -0
index 656e921f3506..1d4fed556c93 100644
@@ -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) {
fs/fuse/file.c +2 -0
index 9d6c5f6361f7..18668fc00c3b 100644
@@ -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);
 
Signature · 1 line
2.27.0