diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-02-03 08:27:35 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-02-03 08:27:35 -0500 |
commit | 387c149b54b4321cbc790dadbd4f8eedb5a90468 (patch) | |
tree | 535d63dd9b80ff239fa914449f89718db1f0bfd3 /fs/nfs | |
parent | 9f557cd8073104b39528794d44e129331ded649f (diff) |
NFS: Fix a umount race
Ensure that we unregister the bdi before kill_anon_super() calls
ida_remove() on our device name.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/super.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index ce907efc5508..f1afee4eea77 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -243,6 +243,7 @@ static int nfs_show_stats(struct seq_file *, struct vfsmount *); | |||
243 | static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); | 243 | static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); |
244 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, | 244 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, |
245 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); | 245 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); |
246 | static void nfs_put_super(struct super_block *); | ||
246 | static void nfs_kill_super(struct super_block *); | 247 | static void nfs_kill_super(struct super_block *); |
247 | static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); | 248 | static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); |
248 | 249 | ||
@@ -266,6 +267,7 @@ static const struct super_operations nfs_sops = { | |||
266 | .alloc_inode = nfs_alloc_inode, | 267 | .alloc_inode = nfs_alloc_inode, |
267 | .destroy_inode = nfs_destroy_inode, | 268 | .destroy_inode = nfs_destroy_inode, |
268 | .write_inode = nfs_write_inode, | 269 | .write_inode = nfs_write_inode, |
270 | .put_super = nfs_put_super, | ||
269 | .statfs = nfs_statfs, | 271 | .statfs = nfs_statfs, |
270 | .clear_inode = nfs_clear_inode, | 272 | .clear_inode = nfs_clear_inode, |
271 | .umount_begin = nfs_umount_begin, | 273 | .umount_begin = nfs_umount_begin, |
@@ -335,6 +337,7 @@ static const struct super_operations nfs4_sops = { | |||
335 | .alloc_inode = nfs_alloc_inode, | 337 | .alloc_inode = nfs_alloc_inode, |
336 | .destroy_inode = nfs_destroy_inode, | 338 | .destroy_inode = nfs_destroy_inode, |
337 | .write_inode = nfs_write_inode, | 339 | .write_inode = nfs_write_inode, |
340 | .put_super = nfs_put_super, | ||
338 | .statfs = nfs_statfs, | 341 | .statfs = nfs_statfs, |
339 | .clear_inode = nfs4_clear_inode, | 342 | .clear_inode = nfs4_clear_inode, |
340 | .umount_begin = nfs_umount_begin, | 343 | .umount_begin = nfs_umount_begin, |
@@ -2258,6 +2261,17 @@ error_splat_super: | |||
2258 | } | 2261 | } |
2259 | 2262 | ||
2260 | /* | 2263 | /* |
2264 | * Ensure that we unregister the bdi before kill_anon_super | ||
2265 | * releases the device name | ||
2266 | */ | ||
2267 | static void nfs_put_super(struct super_block *s) | ||
2268 | { | ||
2269 | struct nfs_server *server = NFS_SB(s); | ||
2270 | |||
2271 | bdi_unregister(&server->backing_dev_info); | ||
2272 | } | ||
2273 | |||
2274 | /* | ||
2261 | * Destroy an NFS2/3 superblock | 2275 | * Destroy an NFS2/3 superblock |
2262 | */ | 2276 | */ |
2263 | static void nfs_kill_super(struct super_block *s) | 2277 | static void nfs_kill_super(struct super_block *s) |
@@ -2265,7 +2279,6 @@ static void nfs_kill_super(struct super_block *s) | |||
2265 | struct nfs_server *server = NFS_SB(s); | 2279 | struct nfs_server *server = NFS_SB(s); |
2266 | 2280 | ||
2267 | kill_anon_super(s); | 2281 | kill_anon_super(s); |
2268 | bdi_unregister(&server->backing_dev_info); | ||
2269 | nfs_fscache_release_super_cookie(s); | 2282 | nfs_fscache_release_super_cookie(s); |
2270 | nfs_free_server(server); | 2283 | nfs_free_server(server); |
2271 | } | 2284 | } |