Skip to content

Commit 7b14a21

Browse files
Christoph Hellwigaxboe
authored andcommitted
nfs: don't call bdi_unregister
bdi_destroy already does all the work, and if we delay freeing the anon bdev we can get away with just that single call. Addintionally remove the call during mount failure, as deactivate_super_locked will already call ->kill_sb and clean up the bdi for us. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e4d2750 commit 7b14a21

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

fs/nfs/internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ int nfs_show_options(struct seq_file *, struct dentry *);
416416
int nfs_show_devname(struct seq_file *, struct dentry *);
417417
int nfs_show_path(struct seq_file *, struct dentry *);
418418
int nfs_show_stats(struct seq_file *, struct dentry *);
419-
void nfs_put_super(struct super_block *);
420419
int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
421420

422421
/* write.c */

fs/nfs/nfs4super.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ static const struct super_operations nfs4_sops = {
5353
.destroy_inode = nfs_destroy_inode,
5454
.write_inode = nfs4_write_inode,
5555
.drop_inode = nfs_drop_inode,
56-
.put_super = nfs_put_super,
5756
.statfs = nfs_statfs,
5857
.evict_inode = nfs4_evict_inode,
5958
.umount_begin = nfs_umount_begin,

fs/nfs/super.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ const struct super_operations nfs_sops = {
311311
.destroy_inode = nfs_destroy_inode,
312312
.write_inode = nfs_write_inode,
313313
.drop_inode = nfs_drop_inode,
314-
.put_super = nfs_put_super,
315314
.statfs = nfs_statfs,
316315
.evict_inode = nfs_evict_inode,
317316
.umount_begin = nfs_umount_begin,
@@ -2569,7 +2568,7 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
25692568
error = nfs_bdi_register(server);
25702569
if (error) {
25712570
mntroot = ERR_PTR(error);
2572-
goto error_splat_bdi;
2571+
goto error_splat_super;
25732572
}
25742573
server->super = s;
25752574
}
@@ -2601,9 +2600,6 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
26012600
dput(mntroot);
26022601
mntroot = ERR_PTR(error);
26032602
error_splat_super:
2604-
if (server && !s->s_root)
2605-
bdi_unregister(&server->backing_dev_info);
2606-
error_splat_bdi:
26072603
deactivate_locked_super(s);
26082604
goto out;
26092605
}
@@ -2650,28 +2646,20 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
26502646
}
26512647
EXPORT_SYMBOL_GPL(nfs_fs_mount);
26522648

2653-
/*
2654-
* Ensure that we unregister the bdi before kill_anon_super
2655-
* releases the device name
2656-
*/
2657-
void nfs_put_super(struct super_block *s)
2658-
{
2659-
struct nfs_server *server = NFS_SB(s);
2660-
2661-
bdi_unregister(&server->backing_dev_info);
2662-
}
2663-
EXPORT_SYMBOL_GPL(nfs_put_super);
2664-
26652649
/*
26662650
* Destroy an NFS2/3 superblock
26672651
*/
26682652
void nfs_kill_super(struct super_block *s)
26692653
{
26702654
struct nfs_server *server = NFS_SB(s);
2655+
dev_t dev = s->s_dev;
2656+
2657+
generic_shutdown_super(s);
26712658

2672-
kill_anon_super(s);
26732659
nfs_fscache_release_super_cookie(s);
2660+
26742661
nfs_free_server(server);
2662+
free_anon_bdev(dev);
26752663
}
26762664
EXPORT_SYMBOL_GPL(nfs_kill_super);
26772665

0 commit comments

Comments
 (0)