On Thu, Sep 06, 2018 at 05:18:14PM -0400, jeffm@xxxxxxxx wrote: > From: Jeff Mahoney <jeffm@xxxxxxxx> > > btrfs_trim_fs iterates over the fs_devices->alloc_list while holding > the device_list_mutex. The problem is that ->alloc_list is protected > by the chunk mutex. We don't want to hold the chunk mutex over > the trim of the entire file system. Fortunately, the ->dev_list > list is protected by the dev_list mutex and while it will give us > all devices, including read-only devices, we already just skip the > read-only devices. Then we can continue to take and release the chunk > mutex while scanning each device. > > Fixes: 499f377f49f (btrfs: iterate over unused chunk space in FITRIM) > Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx>
