[PATCH] fuse: unnecessary fsync for read-only mounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux