Thread (6 messages) 6 messages, 2 authors, 2021-12-23

Re: [PATCH 2/2] loop: use task_work for autoclear operation

flat view

From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Date: 2021-12-23 07:02:05

On 2021/12/23 0:56, Jens Axboe wrote:
On 12/22/21 8:27 AM, Tetsuo Handa wrote:
quoted
The kernel test robot is reporting that xfstest can fail at

  umount ext2 on xfs
  umount xfs

sequence, for commit 322c4293ecc58110 ("loop: make autoclear operation
asynchronous") broke what commit ("loop: Make explicit loop device
destruction lazy") wanted to achieve.

Although we cannot guarantee that nobody is holding a reference when
"umount xfs" is called, we should try to close a race window opened
by asynchronous autoclear operation.

Try to make the autoclear operation upon close() synchronous, by calling
__loop_clr_fd() from current thread's task work rather than a WQ thread.
Doesn't this potentially race with fput?
What race?

loop_schedule_rundown() is called from lo_release() from blkdev_put() from
blkdev_close() from __fput() from task_work_run(). And loop_schedule_rundown()
calls kobject_get(&bdev->bd_device.kobj) before put_device() from
blkdev_put_no_open() from blkdev_put() from blkdev_close() from __fput() from
task_work_run() calls kobject_put(&bdev->bd_device.kobj).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help