提交 387c149b 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
上级 9f557cd8
...@@ -243,6 +243,7 @@ static int nfs_show_stats(struct seq_file *, struct vfsmount *); ...@@ -243,6 +243,7 @@ static int nfs_show_stats(struct seq_file *, struct vfsmount *);
static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
static int nfs_xdev_get_sb(struct file_system_type *fs_type, static int nfs_xdev_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
static void nfs_put_super(struct super_block *);
static void nfs_kill_super(struct super_block *); static void nfs_kill_super(struct super_block *);
static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); static int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
...@@ -266,6 +267,7 @@ static const struct super_operations nfs_sops = { ...@@ -266,6 +267,7 @@ static const struct super_operations nfs_sops = {
.alloc_inode = nfs_alloc_inode, .alloc_inode = nfs_alloc_inode,
.destroy_inode = nfs_destroy_inode, .destroy_inode = nfs_destroy_inode,
.write_inode = nfs_write_inode, .write_inode = nfs_write_inode,
.put_super = nfs_put_super,
.statfs = nfs_statfs, .statfs = nfs_statfs,
.clear_inode = nfs_clear_inode, .clear_inode = nfs_clear_inode,
.umount_begin = nfs_umount_begin, .umount_begin = nfs_umount_begin,
...@@ -335,6 +337,7 @@ static const struct super_operations nfs4_sops = { ...@@ -335,6 +337,7 @@ static const struct super_operations nfs4_sops = {
.alloc_inode = nfs_alloc_inode, .alloc_inode = nfs_alloc_inode,
.destroy_inode = nfs_destroy_inode, .destroy_inode = nfs_destroy_inode,
.write_inode = nfs_write_inode, .write_inode = nfs_write_inode,
.put_super = nfs_put_super,
.statfs = nfs_statfs, .statfs = nfs_statfs,
.clear_inode = nfs4_clear_inode, .clear_inode = nfs4_clear_inode,
.umount_begin = nfs_umount_begin, .umount_begin = nfs_umount_begin,
...@@ -2257,6 +2260,17 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -2257,6 +2260,17 @@ static int nfs_get_sb(struct file_system_type *fs_type,
goto out; goto out;
} }
/*
* Ensure that we unregister the bdi before kill_anon_super
* releases the device name
*/
static void nfs_put_super(struct super_block *s)
{
struct nfs_server *server = NFS_SB(s);
bdi_unregister(&server->backing_dev_info);
}
/* /*
* Destroy an NFS2/3 superblock * Destroy an NFS2/3 superblock
*/ */
...@@ -2265,7 +2279,6 @@ static void nfs_kill_super(struct super_block *s) ...@@ -2265,7 +2279,6 @@ static void nfs_kill_super(struct super_block *s)
struct nfs_server *server = NFS_SB(s); struct nfs_server *server = NFS_SB(s);
kill_anon_super(s); kill_anon_super(s);
bdi_unregister(&server->backing_dev_info);
nfs_fscache_release_super_cookie(s); nfs_fscache_release_super_cookie(s);
nfs_free_server(server); nfs_free_server(server);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册