On Sat, Dec 16, 2023 at 05:12:21AM +0100, Christoph Hellwig wrote: > On Fri, Dec 15, 2023 at 04:45:50PM -0500, Josef Bacik wrote: > > I ran it through, you broke a test that isn't upstream yet to test the old mount > > api double mount thing that I have a test for > > > > https://github.com/btrfs/fstests/commit/2796723e77adb0f9da1059acf13fc402467f7ac4 > > > > In this case we end up leaking a reference on the fs_devices. If you add this > > fixup to "btrfs: call btrfs_close_devices from ->kill_sb" it fixes that failure. > > I'm re-running with that fixup applied, but I assume the rest is fine. Thanks, > > Is "this fixup" referring to a patch that was supposed to be attached > but is't? :) Sorry, vacation brain, here you go. Josef diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f93fe2e5e378..2dfa2274b193 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1950,10 +1950,20 @@ static int btrfs_get_tree_super(struct fs_context *fc) */ static struct vfsmount *btrfs_reconfigure_for_mount(struct fs_context *fc) { + struct btrfs_fs_info *fs_info = fc->s_fs_info; struct vfsmount *mnt; int ret; const bool ro2rw = !(fc->sb_flags & SB_RDONLY); + /* + * We got a reference to our fs_devices, so we need to close it here to + * make sure we don't leak our reference on the fs_devices. + */ + if (fs_info->fs_devices) { + btrfs_close_devices(fs_info->fs_devices); + fs_info->fs_devices = NULL; + } + /* * We got an EBUSY because our SB_RDONLY flag didn't match the existing * super block, so invert our setting here and retry the mount so we