On Fri, Dec 24, 2021 at 09:05:53PM +0900, Tetsuo Handa wrote: > By the way, is it safe to use single global WQ if (4) is a synchronous I/O request? > Since there can be up to 1048576 loop devices, and one loop device can use another > loop device as lo->lo_backing_file (unless loop_validate_file() finds a circular > usage), one synchronous I/O request in (4) might recursively involve up to 1048576 > works (which would be too many concurrency to be handled by a WQ) ? Indeed, this will cause problems with stacked loop devices. > Also, is > > blk_mq_start_request(rq); > > if (lo->lo_state != Lo_bound) > return BLK_STS_IOERR; > > in loop_queue_rq() correct? (Not only lo->lo_state test is racy, but wants > blk_mq_end_request() like lo_complete_rq() does? Besides the racyness this should be fine, the caller can cope with errors both before and after blk_mq_start_request is called.