diff mbox series

NFS: switch back to using kill_anon_super

Message ID 20230831052940.256193-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series NFS: switch back to using kill_anon_super | expand

Commit Message

Christoph Hellwig Aug. 31, 2023, 5:29 a.m. UTC
NFS switch to open coding kill_anon_super in 7b14a213890a
("nfs: don't call bdi_unregister") to avoid the extra bdi_unregister
call.  At that point bdi_destroy was called in nfs_free_server and
thus it required a later freeing of the anon dev_t.  But since
0db10944a76b ("nfs: Convert to separately allocated bdi") the bdi has
been free implicitly by the sb destruction, so this isn't needed
anymore.

By not open coding kill_anon_super, nfs now inherits the fix in
dc3216b14160 ("super: ensure valid info"), and we remove the only
open coded version of kill_anon_super.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/nfs/super.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Christian Brauner Aug. 31, 2023, 7:59 a.m. UTC | #1
On Thu, 31 Aug 2023 07:29:40 +0200, Christoph Hellwig wrote:
> NFS switch to open coding kill_anon_super in 7b14a213890a
> ("nfs: don't call bdi_unregister") to avoid the extra bdi_unregister
> call.  At that point bdi_destroy was called in nfs_free_server and
> thus it required a later freeing of the anon dev_t.  But since
> 0db10944a76b ("nfs: Convert to separately allocated bdi") the bdi has
> been free implicitly by the sb destruction, so this isn't needed
> anymore.
> 
> [...]

This fix is needed to account for new changes to the generic super code.
So I'll put this into the same set of fixes as the mtd superblock changes.
The plan is to have this all fixed up before -rc1 is out.

---

Applied to the vfs.super branch of the vfs/vfs.git tree.
Patches in the vfs.super branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.super

[1/1] NFS: switch back to using kill_anon_super
      https://git.kernel.org/vfs/vfs/c/db80f8437753
Jan Kara Aug. 31, 2023, 10:54 a.m. UTC | #2
On Thu 31-08-23 07:29:40, Christoph Hellwig wrote:
> NFS switch to open coding kill_anon_super in 7b14a213890a
> ("nfs: don't call bdi_unregister") to avoid the extra bdi_unregister
> call.  At that point bdi_destroy was called in nfs_free_server and
> thus it required a later freeing of the anon dev_t.  But since
> 0db10944a76b ("nfs: Convert to separately allocated bdi") the bdi has
> been free implicitly by the sb destruction, so this isn't needed
> anymore.
> 
> By not open coding kill_anon_super, nfs now inherits the fix in
> dc3216b14160 ("super: ensure valid info"), and we remove the only
> open coded version of kill_anon_super.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/nfs/super.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index 2284f749d89246..0d6473cb00cb3e 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -1339,15 +1339,13 @@ int nfs_get_tree_common(struct fs_context *fc)
>  void nfs_kill_super(struct super_block *s)
>  {
>  	struct nfs_server *server = NFS_SB(s);
> -	dev_t dev = s->s_dev;
>  
>  	nfs_sysfs_move_sb_to_server(server);
> -	generic_shutdown_super(s);
> +	kill_anon_super(s);
>  
>  	nfs_fscache_release_super_cookie(s);
>  
>  	nfs_free_server(server);
> -	free_anon_bdev(dev);
>  }
>  EXPORT_SYMBOL_GPL(nfs_kill_super);
>  
> -- 
> 2.39.2
>
Jeff Layton Aug. 31, 2023, 1:29 p.m. UTC | #3
On Thu, 2023-08-31 at 07:29 +0200, Christoph Hellwig wrote:
> NFS switch to open coding kill_anon_super in 7b14a213890a
> ("nfs: don't call bdi_unregister") to avoid the extra bdi_unregister
> call.  At that point bdi_destroy was called in nfs_free_server and
> thus it required a later freeing of the anon dev_t.  But since
> 0db10944a76b ("nfs: Convert to separately allocated bdi") the bdi has
> been free implicitly by the sb destruction, so this isn't needed
> anymore.
> 
> By not open coding kill_anon_super, nfs now inherits the fix in
> dc3216b14160 ("super: ensure valid info"), and we remove the only
> open coded version of kill_anon_super.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/nfs/super.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index 2284f749d89246..0d6473cb00cb3e 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -1339,15 +1339,13 @@ int nfs_get_tree_common(struct fs_context *fc)
>  void nfs_kill_super(struct super_block *s)
>  {
>  	struct nfs_server *server = NFS_SB(s);
> -	dev_t dev = s->s_dev;
>  
>  	nfs_sysfs_move_sb_to_server(server);
> -	generic_shutdown_super(s);
> +	kill_anon_super(s);
>  
>  	nfs_fscache_release_super_cookie(s);
>  
>  	nfs_free_server(server);
> -	free_anon_bdev(dev);
>  }
>  EXPORT_SYMBOL_GPL(nfs_kill_super);
>  

Nice. Long overdue. This also might explain why ceph was once this way
before we changed it here:

    470a5c77eac0 ceph: use kill_anon_super helper

In any case:

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Christoph Hellwig Aug. 31, 2023, 1:32 p.m. UTC | #4
On Thu, Aug 31, 2023 at 09:29:14AM -0400, Jeff Layton wrote:
> Nice. Long overdue. This also might explain why ceph was once this way
> before we changed it here:
> 
>     470a5c77eac0 ceph: use kill_anon_super helper

Yes, that looks like the same workaround for bdi lifetimes.
diff mbox series

Patch

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2284f749d89246..0d6473cb00cb3e 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1339,15 +1339,13 @@  int nfs_get_tree_common(struct fs_context *fc)
 void nfs_kill_super(struct super_block *s)
 {
 	struct nfs_server *server = NFS_SB(s);
-	dev_t dev = s->s_dev;
 
 	nfs_sysfs_move_sb_to_server(server);
-	generic_shutdown_super(s);
+	kill_anon_super(s);
 
 	nfs_fscache_release_super_cookie(s);
 
 	nfs_free_server(server);
-	free_anon_bdev(dev);
 }
 EXPORT_SYMBOL_GPL(nfs_kill_super);