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