From: OGAWA Hirofumi Date: Tue, 29 Apr 2008 07:59:42 +0000 (-0700) Subject: vfs: fix unconditional write_super() call in file_fsync() X-Git-Tag: v2.6.26-rc1~607 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=762873c251b056c6c1b29e83a4dabafb064e5421;p=linux-2.6 vfs: fix unconditional write_super() call in file_fsync() We need to check ->s_dirt before calling write_super(). It became the cause of an unneeded write. This bug was noticed by Sudhanshu Saxena. Signed-off-by: OGAWA Hirofumi Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/sync.c b/fs/sync.c index 7cd005ea76..228e17b5e9 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -64,7 +64,7 @@ int file_fsync(struct file *filp, struct dentry *dentry, int datasync) /* sync the superblock to buffers */ sb = inode->i_sb; lock_super(sb); - if (sb->s_op->write_super) + if (sb->s_dirt && sb->s_op->write_super) sb->s_op->write_super(sb); unlock_super(sb);