From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-164.sinamail.sina.com.cn (mail3-164.sinamail.sina.com.cn [202.108.3.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E59D914EC73 for ; Tue, 23 Jun 2026 00:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.164 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782175527; cv=none; b=YzPgczziTDM9uzMKFbDEp0C8ykaCT1MY8kwyV1FSz1B9NfinNPRqmBnwyqUOZjwxgpMNaCTDBDxUZwt9xxkYLXruw2HfVqk14M7ESzqINlOg+F029MqnTXqUwP+cXFpDOx3Cc/HOB9/ZsVbwsAlt2hdq2/4n97PiHidcCM9Tmgc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782175527; c=relaxed/simple; bh=TBlMC/6ipN0ztiR+wR5M0zG63VDi28vd+iXPGuLt8YM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tDuUcX8qMS1nvuirkGyrqKVFe9896jCTAYmdoxpgdpT4Y88GPEt9r3gV7vle75o9Pc7ZsfsEhR+1Pk28nioy+w+PoT2Ryd1paAkChD0DDexw+LY04Se5Er0B18/OujBWUztp3FE5MtF5w6+ExkKm4Cu4TTtUVh242oA0/o8nqjk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b=NkMIHuPr; arc=none smtp.client-ip=202.108.3.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b="NkMIHuPr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1782175523; bh=TBlMC/6ipN0ztiR+wR5M0zG63VDi28vd+iXPGuLt8YM=; h=From:Subject:Date:Message-ID; b=NkMIHuPr4QTuBzJRAXyIfsoIgyAIP2QQjs9R17XLm3a0s8p2BYTG4d1NVFY8ksBDX AOn6YeiuDIefQ+rO4bApy/YVUls+2vGmH3WpePBbvuh2bwYT0yvlWptUy0w8WAiO/H 05PewFWZWkIMyRCmMg5BUWLfBGgmD6QXyln7FTVg= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.62.144]) by sina.com (10.54.253.32) with ESMTP id 6A39D715000061BB; Tue, 23 Jun 2026 08:45:12 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 4748724456880 X-SMAIL-UIID: B58136ECF32A43DBA052AC41868A9B6E-20260623-084512-1 From: Hillf Danton To: Eric Dumazet Cc: Deepanshu Kartikey , linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org, syzbot+6b85d1e39a5b8ed9a954@syzkaller.appspotmail.com Subject: Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock Date: Tue, 23 Jun 2026 08:44:58 +0800 Message-ID: <20260623004500.151-1-hdanton@sina.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Mon, 22 Jun 2026 17:21:53 -0700 Eric Dumazet wrote: >On Mon, Jun 22, 2026 at 5:07 PM Hillf Danton wrote: >> On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote: >> >On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton wrote: >> >> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote: >> >> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is >> >> > held at the point of reclassification. That assertion was copied from >> >> > nvme-tcp, where the socket is created internally by the kernel >> >> > (sock_create_kern()) and is never visible to user space, so the lock >> >> > is guaranteed to be free. >> >> > >> >> > NBD is different: the socket is looked up from a user-supplied fd in >> >> > nbd_get_socket(), and user space retains that fd. A concurrent syscall >> >> > on the same socket (or softirq processing taking bh_lock_sock() on a >> >> > connected TCP socket) can legitimately hold the lock at the instant >> >> > NBD reclassifies it. sock_allow_reclassification() then returns false >> >> > and the WARN_ON_ONCE() fires, which turns into a crash under >> >> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT >> >> > against socket activity on the same fd, as reported by syzbot. >> >> > >> >> Given the syzbot report, if you are right (I suspect) then Eric delivered >> >> another half-baked croissant, and feel free to cut it off instead to make >> >> room for correct fix. >> > >> > Nobody (including you) caught this.difference between nbd and other >> > sock_allow_reclassification() callers. >> > >> Nope, actually it raises the question -- does the deadlock still remain >> after your fix without the lock key you added applied? > >LOCKDEP might have a false positive, but it will be much much harder to trigger. > >I had about 50 syzbot duplicates (that I did not release) before d532cddb6c60 > ("nbd: Reclassify sockets to avoid lockdep circular dependency"). > >> >> > What was the "correct fix" you envisioned exactly? >> > >> Frankly I had no evidence against your fix a couple days back, but now I >> see your lock key approach fails to take off. And the correct fix is to >> erase the incorrect locking order ffa1e7ada456 tries to catch, more >> difficult than you thought so far. > >Which incorrect locking order are you referring to? This is a LOCKDEP >false positive. > In addition to 50 syzbot reports, your fix has a Fixes tag, no? >I suggest you send a patch so we can discuss it. The deadlock existed before ffa1e7ada456, why is a chance left for your fix?