On 9/11/19 10:02 PM, Ming Lei wrote: > cecf5d87ff20 ("block: split .sysfs_lock into two locks") starts to > release & actuire sysfs_lock again during switching elevator. So it > isn't enough to prevent switching elevator from happening by simply > clearing QUEUE_FLAG_REGISTERED with holding sysfs_lock, because > in-progress switch still can move on after re-acquiring the lock, > meantime the flag of QUEUE_FLAG_REGISTERED won't get checked. > > Fixes this issue by checking 'q->elevator' directly & locklessly after > q->kobj is removed in blk_unregister_queue(), this way is safe because > q->elevator can't be changed at that time. Thanks Ming, looks good to me and cleaner than before too. -- Jens Axboe