Re: [PATCH 2/6] block: loop: don't hold lo_ctl_mutex in lo_open

2015-04-06 Thread Christoph Hellwig
On Mon, Apr 06, 2015 at 12:28:22AM +0800, Ming Lei wrote: > Another simpler way is to make lo_refcnt as atomic_t and remove > lo_ctrl_mutext in lo_open(), and freeze request queue during clearing > fd, and better to freeze queue during setting fd too, so will update in > v1 with this way. Using an

Re: [PATCH 2/6] block: loop: don't hold lo_ctl_mutex in lo_open

2015-04-05 Thread Ming Lei
On Sun, Apr 5, 2015 at 3:24 PM, Ming Lei wrote: > The lo_ctl_mutex is held for running all ioctl handlers, and > in some ioctl handlers, ioctl_by_bdev(BLKRRPART) is called for > rereading partitions, which requires bd_mutex. > > So it is easy to cause failure because trylock(bd_mutex) may > fail i

[PATCH 2/6] block: loop: don't hold lo_ctl_mutex in lo_open

2015-04-05 Thread Ming Lei
The lo_ctl_mutex is held for running all ioctl handlers, and in some ioctl handlers, ioctl_by_bdev(BLKRRPART) is called for rereading partitions, which requires bd_mutex. So it is easy to cause failure because trylock(bd_mutex) may fail inside blkdev_reread_part(), and follows the lock context: b