On Tue, Dec 10, 2019 at 04:28:17PM -0500, Josef Bacik wrote: > >>>> If we fsync on a subvolume and create a log root for that volume, and > >>>> then later delete that subvolume we'll never clean up its log root. Fix > >>>> this by making switch_commit_roots free the log for any dropped roots we > >>>> encounter. > >>>> + btrfs_free_log(trans, root); > >>> > >>> THis patch should really have been this line and converting > >>> switch_commit_roots to taking a trans handle another patch. Otherwise > >>> this is lost in the mechanical refactoring. > >> > >> We need the trans handle to even call btrfs_free_log, we're just fixing > >> it so the trans handle can be passed in, making its separate is just > >> superfluous. Thanks, > > > > Actually no because callees handle the case when trans is not passed > > (i.e. walk_log_tree and walk_(up|down)_log_tree. If passing valid > > trances changes the call logic then this needs to be explained in the > > changelog. And there is currently one caller calling that function > > without a trans - btrfs_drop_and_free_fs_root in BTRFS_FS_STATE_ERROR case. > > Yeah, it's clear that NULL is used only in the error case. I'm not going to > explain the entirety of how the log tree works in a basic fix for not freeing up > a tree log when we should be doing it. Thanks, Sure you can at least note that the parameter type needs to be changed, so we don't have to spend too much time looking for the real fix.
