Thread (25 messages) 25 messages, 7 authors, 2021-06-15

Re: [syzbot] possible deadlock in del_gendisk

From: Tyler Hicks <hidden>
Date: 2021-06-09 16:46:44

On 2021-06-10 01:31:17, Tetsuo Handa wrote:
Hello, Christoph.

I'm currently trying full bisection.

  # bad: [fc0586062816559defb14c947319ef8c4c326fb3] Merge tag 'for-5.13/drivers-2021-04-27' of git://git.kernel.dk/linux-block
  # good: [42dec9a936e7696bea1f27d3c5a0068cd9aa95fd] Merge tag 'perf-core-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
  # good: [68a32ba14177d4a21c4a9a941cf1d7aea86d436f] Merge tag 'drm-next-2021-04-28' of git://anongit.freedesktop.org/drm/drm
  # good: [a800abd3ecb9acc55821f7ac9bba6c956b36a595] net: enetc: move skb creation into enetc_build_skb
  # good: [6cc8e7430801fa238bd7d3acae1eb406c6e02fe1] loop: scale loop device by introducing per device lock
Thanks for doing this. I haven't had a chance to retry this commit with
lockdep but I did re-review it and didn't think that it would be the
cause of this lockdep report since it strictly reduced the usage of the
loop_ctl_mutex.

Tyler
  git bisect start 'fc0586062816559defb14c947319ef8c4c326fb3' '42dec9a936e7696bea1f27d3c5a0068cd9aa95fd' '68a32ba14177d4a21c4a9a941cf1d7aea86d436f' 'a800abd3ecb9acc55821f7ac9bba6c956b36a595' '6cc8e7430801fa238bd7d3acae1eb406c6e02fe1'
  # good: [2958a995edc94654df690318df7b9b49e5a3ef88] block/rnbd-clt: Support polling mode for IO latency optimization
  git bisect good 2958a995edc94654df690318df7b9b49e5a3ef88

I think we will bisect this problem to

  commit c76f48eb5c084b1e ("block: take bd_mutex around delete_partitions in del_gendisk")

because that commit introduced new locking dependency bdev_lookup_sem => disk->part0->bd_mutex
which matches the lockdep's report.

  ======================================================
  WARNING: possible circular locking dependency detected
  5.12.0-rc6-next-20210409-syzkaller #0 Not tainted
  ------------------------------------------------------
  syz-executor.4/10285 is trying to acquire lock:
  ffff8881423245a0 (&bdev->bd_mutex){+.+.}-{3:3}, at: del_gendisk+0x250/0x9e0 block/genhd.c:618
  
  but task is already holding lock:
  ffffffff8c7d9430 (bdev_lookup_sem){++++}-{3:3}, at: del_gendisk+0x222/0x9e0 block/genhd.c:616

Do we need to revert "partition iteration simplifications" work?

On 2021/06/07 19:56, Tetsuo Handa wrote:
quoted
Hello.

syzbot is reporting "possible deadlock in del_gendisk" problem.

I guess this is caused by commit 6cc8e7430801fa23 ("loop: scale loop device
by introducing per device lock") because it touches loop_ctl_mutex usage
between v5.11 and v5.12-rc1. Please have a look.

On 2021/04/14 2:33, syzbot wrote:
quoted
Hello,

syzbot found the following issue on:

HEAD commit:    e99d8a84 Add linux-next specific files for 20210409
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13b01681d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7cd69574979bfeb7
dashboard link: https://syzkaller.appspot.com/bug?extid=61e04e51b7ac86930589
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=148265d9d00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16a981a1d00000
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help