summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-06-08 18:14:51 +0200
committerJens Axboe <jaxboe@fusionio.com>2010-06-11 12:58:07 +0200
commitcf37e972478ec58a8a54a6b4f951815f0ae28f78 (patch)
treeb14d75074692ddb213e22e098a64087950f4cf78 /fs
parent3c4d716538f3eefb1c1f10961a047a6456a2b590 (diff)
downloadlinux-stable-cf37e972478ec58a8a54a6b4f951815f0ae28f78.tar.gz
linux-stable-cf37e972478ec58a8a54a6b4f951815f0ae28f78.tar.bz2
linux-stable-cf37e972478ec58a8a54a6b4f951815f0ae28f78.zip
writeback: enforce s_umount locking in writeback_inodes_sb
Make sure that not only sync_filesystem but all callers of writeback_inodes_sb have the superblock protected against remount. As-is this disables all functionality for these callers, but the next patch relies on this locking to fix writeback_inodes_sb for sync_filesystem. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs-writeback.c6
-rw-r--r--fs/ubifs/budget.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 759666966c6d..2627f0dfcd9c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1180,6 +1180,8 @@ void writeback_inodes_sb(struct super_block *sb)
.sync_mode = WB_SYNC_NONE,
};
+ WARN_ON(!rwsem_is_locked(&sb->s_umount));
+
args.nr_pages = nr_dirty + nr_unstable +
(inodes_stat.nr_inodes - inodes_stat.nr_unused);
@@ -1197,7 +1199,9 @@ EXPORT_SYMBOL(writeback_inodes_sb);
int writeback_inodes_sb_if_idle(struct super_block *sb)
{
if (!writeback_in_progress(sb->s_bdi)) {
+ down_read(&sb->s_umount);
writeback_inodes_sb(sb);
+ up_read(&sb->s_umount);
return 1;
} else
return 0;
@@ -1220,6 +1224,8 @@ void sync_inodes_sb(struct super_block *sb)
.range_cyclic = 0,
};
+ WARN_ON(!rwsem_is_locked(&sb->s_umount));
+
bdi_queue_work_onstack(&args);
wait_sb_inodes(sb);
}
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 076ca50e9933..c8ff0d1ae5d3 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -62,7 +62,9 @@
*/
static void shrink_liability(struct ubifs_info *c, int nr_to_write)
{
+ down_read(&c->vfs_sb->s_umount);
writeback_inodes_sb(c->vfs_sb);
+ up_read(&c->vfs_sb->s_umount);
}
/**