On 1/2/20 6:27 AM, Qu Wenruo wrote:
There are 4 locations where device size or used space get updated: - Chunk allocation - Chunk removal - Device grow - Device shrink Now also update per-profile available space at those timings. For __btrfs_alloc_chunk() we can't acquire device_list_mutex as in btrfs_finish_chunk_alloc() we could hold device_list_mutex and cause dead lock.
These are protecting two different things though, holding the chunk_mutex doesn't keep things from being removed from the device list.
Looking at patch 1 can't we just do the device list traversal under RCU and then not have to worry about the locking at all? Thanks,
Josef
