Re: 回复: 回复: [PATCH] btrfs: Fix missing close devices

From: Johannes Thumshirn
Date: Wed Sep 23 2020 - 04:17:13 EST


On 23/09/2020 08:03, Zhang, Qiang wrote:
> Hello Johannes Thumshirn
>
> the crash happend in "snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev)" in btrfs_mount_root func, the "bdev" may be destroyed in btrfs_close_devices.
> I think add btrfs_close_devices func before deactivate_locked_super is reasonable.
> I'm not sure if that's another problem .
> What's your point of view ?
>

I think this is generally unneeded.
Think of this call chain:
deactivate_locked_super()
`-> fs->kill_sb()
`-> btrfs_kill_super()
`-> kill_anon_super()
`-> generic_shutdown_super()
`-> sop->put_super()
`-> btrfs_put_super()
`-> close_ctree()
`-> btrfs_close_devices()