diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2011-03-17 11:13:12 +0100 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2011-06-06 18:19:10 -0700 |
commit | 0d265ae5c754b6e079eec89f911c8815da835639 (patch) | |
tree | b96435690734a2f58d7d194b9afd91236253fe00 /fs | |
parent | e3406d78b92c711773eb399cbc1d788c7550bc90 (diff) |
fs: assign sb->s_bdi to default_backing_dev_info if the bdi is going away
We don't have proper reference counting for this yet, so we run into
cases where the device is pulled and we OOPS on flushing the fs data.
This happens even though the dirty inodes have already been
migrated to the default_backing_dev_info.
Bug 808894
(cherry picked from commit 95f28604a65b1c40b6c6cd95e58439cd7ded3add
of kernel.org, linux-2.6 tree)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Change-Id: I56476eb6d33d0fbc0472c0a35dec02e13c4202c9
Reviewed-on: http://git-master/r/32921
Reviewed-by: Venkata Jagadish <vjagadish@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Venkata Jagadish <vjagadish@nvidia.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/super.c | 2 | ||||
-rw-r--r-- | fs/sync.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/super.c b/fs/super.c index 8819e3a7ff20..06df4921d431 100644 --- a/fs/super.c +++ b/fs/super.c @@ -70,6 +70,7 @@ static struct super_block *alloc_super(struct file_system_type *type) #else INIT_LIST_HEAD(&s->s_files); #endif + s->s_bdi = &default_backing_dev_info; INIT_LIST_HEAD(&s->s_instances); INIT_HLIST_HEAD(&s->s_anon); INIT_LIST_HEAD(&s->s_inodes); @@ -947,6 +948,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void goto out_free_secdata; BUG_ON(!mnt->mnt_sb); WARN_ON(!mnt->mnt_sb->s_bdi); + WARN_ON(mnt->mnt_sb->s_bdi == &default_backing_dev_info); mnt->mnt_sb->s_flags |= MS_BORN; error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); diff --git a/fs/sync.c b/fs/sync.c index ba76b9623e7e..412dc89163d3 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -33,7 +33,7 @@ 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 || sb->s_bdi == &noop_backing_dev_info) + if (sb->s_bdi == &noop_backing_dev_info) return 0; if (sb->s_qcop && sb->s_qcop->quota_sync) @@ -79,7 +79,7 @@ EXPORT_SYMBOL_GPL(sync_filesystem); static void sync_one_sb(struct super_block *sb, void *arg) { - if (!(sb->s_flags & MS_RDONLY) && sb->s_bdi) + if (!(sb->s_flags & MS_RDONLY)) __sync_filesystem(sb, *(int *)arg); } /* |