summaryrefslogtreecommitdiffstats
path: root/fs/sync.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-09-16 15:02:33 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-09-16 15:18:51 +0200
commit32a88aa1b6dfb901cec64e1898cac78d0f25028a (patch)
tree51aa6f56ccfca53f495d015645373317bdee3647 /fs/sync.c
parentc4a77a6c7dcff04a2abc7fe4b6b2ae605be41c5b (diff)
fs: Assign bdi in super_block
We do this automatically in get_sb_bdev() from the set_bdev_super() callback. Filesystems that have their own private backing_dev_info must assign that in ->fill_super(). Note that ->s_bdi assignment is required for proper writeback! Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/sync.c')
-rw-r--r--fs/sync.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/sync.c b/fs/sync.c
index 192340930bb..c08467a5d7c 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -27,6 +27,13 @@
*/
static int __sync_filesystem(struct super_block *sb, int wait)
{
+ /*
+ * This should be safe, as we require bdi backing to actually
+ * write out data in the first place
+ */
+ if (!sb->s_bdi)
+ return 0;
+
/* Avoid doing twice syncing and cache pruning for quota sync */
if (!wait) {
writeout_quota_sb(sb, -1);
@@ -101,7 +108,7 @@ restart:
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
- if (!(sb->s_flags & MS_RDONLY) && sb->s_root)
+ if (!(sb->s_flags & MS_RDONLY) && sb->s_root && sb->s_bdi)
__sync_filesystem(sb, wait);
up_read(&sb->s_umount);