[PATCH] Fix unconditional write_super() call in file_fsync()

From: OGAWA Hirofumi
Date: Tue Apr 22 2008 - 08:07:16 EST


This fixes 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 <hirofumi@xxxxxxxxxxxxxxxxxx>
---

fs/sync.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/sync.c~file_fsync-fix fs/sync.c
--- linux-2.6/fs/sync.c~file_fsync-fix 2008-04-22 15:14:50.000000000 +0900
+++ linux-2.6-hirofumi/fs/sync.c 2008-04-22 15:16:58.000000000 +0900
@@ -64,7 +64,7 @@ int file_fsync(struct file *filp, struct
/* 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);

_

--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/