In principle, a filesystem may want to have ->sync_fs() called during sync(1) although it does not have a bdi (i.e. s_bdi is set to noop_backing_dev_info). Only writeback code really needs bdi set to something reasonable. So move the checks where they are more logical. Signed-off-by: Jan Kara <jack@xxxxxxx> --- fs/fs-writeback.c | 6 ++++++ fs/sync.c | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 04cf3b9..9794dfe 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1214,6 +1214,9 @@ void writeback_inodes_sb_nr(struct super_block *sb, unsigned long nr) .nr_pages = nr, }; + /* Nothing to do? */ + if (sb->s_bdi == &noop_backing_dev_info) + return; WARN_ON(!rwsem_is_locked(&sb->s_umount)); bdi_queue_work(sb->s_bdi, &work); wait_for_completion(&done); @@ -1292,6 +1295,9 @@ void sync_inodes_sb(struct super_block *sb) .done = &done, }; + /* Nothing to do? */ + if (sb->s_bdi == &noop_backing_dev_info) + return; WARN_ON(!rwsem_is_locked(&sb->s_umount)); bdi_queue_work(sb->s_bdi, &work); diff --git a/fs/sync.c b/fs/sync.c index c98a747..38e942b 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -30,13 +30,6 @@ */ 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 == &noop_backing_dev_info) - return 0; - if (sb->s_qcop && sb->s_qcop->quota_sync) sb->s_qcop->quota_sync(sb, -1, wait); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html