diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-08 12:14:51 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-06-11 06:58:07 -0400 |
commit | cf37e972478ec58a8a54a6b4f951815f0ae28f78 (patch) | |
tree | b14d75074692ddb213e22e098a64087950f4cf78 /fs/fs-writeback.c | |
parent | 3c4d716538f3eefb1c1f10961a047a6456a2b590 (diff) |
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/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 6 |
1 files changed, 6 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) | |||
1180 | .sync_mode = WB_SYNC_NONE, | 1180 | .sync_mode = WB_SYNC_NONE, |
1181 | }; | 1181 | }; |
1182 | 1182 | ||
1183 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); | ||
1184 | |||
1183 | args.nr_pages = nr_dirty + nr_unstable + | 1185 | args.nr_pages = nr_dirty + nr_unstable + |
1184 | (inodes_stat.nr_inodes - inodes_stat.nr_unused); | 1186 | (inodes_stat.nr_inodes - inodes_stat.nr_unused); |
1185 | 1187 | ||
@@ -1197,7 +1199,9 @@ EXPORT_SYMBOL(writeback_inodes_sb); | |||
1197 | int writeback_inodes_sb_if_idle(struct super_block *sb) | 1199 | int writeback_inodes_sb_if_idle(struct super_block *sb) |
1198 | { | 1200 | { |
1199 | if (!writeback_in_progress(sb->s_bdi)) { | 1201 | if (!writeback_in_progress(sb->s_bdi)) { |
1202 | down_read(&sb->s_umount); | ||
1200 | writeback_inodes_sb(sb); | 1203 | writeback_inodes_sb(sb); |
1204 | up_read(&sb->s_umount); | ||
1201 | return 1; | 1205 | return 1; |
1202 | } else | 1206 | } else |
1203 | return 0; | 1207 | return 0; |
@@ -1220,6 +1224,8 @@ void sync_inodes_sb(struct super_block *sb) | |||
1220 | .range_cyclic = 0, | 1224 | .range_cyclic = 0, |
1221 | }; | 1225 | }; |
1222 | 1226 | ||
1227 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); | ||
1228 | |||
1223 | bdi_queue_work_onstack(&args); | 1229 | bdi_queue_work_onstack(&args); |
1224 | wait_sb_inodes(sb); | 1230 | wait_sb_inodes(sb); |
1225 | } | 1231 | } |