From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCA811DDC3F for ; Tue, 23 Jun 2026 00:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.160.172 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782174128; cv=pass; b=gYLWL0Sd6KRFxNa2VWBcVc201I0oe3pzkBi0zgPfXGmPyxqYhpYJdo/jKLa27HOnnR7L9x61sggakdBtqFL68euASQsDei13rBDTYdoZM5RNS8jFx2ZrILlTsfZmvWtSK79SncnTX+84eyA5ymtMOrOqurTZatCS9qy+zB43lh0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782174128; c=relaxed/simple; bh=RIuY5a2HKJO6h14/lkjaRYtOWipwqSkPLwZPgqIxLZI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=q3Nt9ztHUG/l0GKvm2sa1gxFxyjJkSr4YKY3D4cN+F1d6ALX5mipHbmL7oDwG/K1cDiPtQQ4xziljc2Oh9UqBe0ViWbNw3lRr24fDp3sBqZgThk0DaD84HOJGIAG3WL7ir5I/0Ima1+f+tAyU1yiBBfz3DQffOG6zL8GF+gt1/I= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=S+CdHzpB; arc=pass smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="S+CdHzpB" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-5176ca6bab1so4988141cf.0 for ; Mon, 22 Jun 2026 17:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782174126; cv=none; d=google.com; s=arc-20240605; b=FFPImwdt1R1M6AgYkcwOB9G1xy4oxbvH1BsKJpJ8tCacwCs8fYQ0KjNjzzBnyBehmf AvA9yCjHCse0LsRIW5VBbtZ1VHJ2Dp+S8G2YAX3Q0dFWc0OPZaDfojwaO50T88sH9FuZ ou8WfHGskUAnhcwJJdS1lKGVtWMOY4AhZFjW2xzTYOjeB4P7K9KRwmGYeBCqPztGRJpx USJqsMNsNGOzH+My96NrqyOOVNCwR8x+XppaiqMobj4rPrXDWfz9/s0BPfCWxFoklGsv 7ZdZs75QpTXZXU5VMxtHJrt1+g0ecv0njO+oUnWnkGRE0EvJ/AcFxs3G+VT3rlADn7YQ AdPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=RIuY5a2HKJO6h14/lkjaRYtOWipwqSkPLwZPgqIxLZI=; fh=XrSmLQrQM+Pg9PIADLc8W4+JpnyObrUbDkVuCxsoPdI=; b=Dv/RC0kXD3Uy2116MVG4faTu//t8Bri1hm9UEDawUCgy88JvtBHNsgAEGXk2AXFVz8 cRddhMeb8CwUprCKk4ZCHg+bTRX47O9yhsc+v4VYcFaL3qUazwdIIIUroteJW5ODm3Y7 RP6yobgf4WYgC7qw8A7s77lokwrV9tYF+roV/JOiFBBmt+47JqBtqnUEoi+vkovwNVd3 dbGTEVsVP6xvBr/ljkFrmcVfPic2MS+lys6ERiV9S4sZSEecNLi3XMxQYn6kpy6QC+p0 fV6tIuD/O8JznfyzPhiOKXBcZc8MvXoJdbf8xqCDmWGVTOEB69uUBrbOpDwaEtGPfy9n dmeA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782174126; x=1782778926; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RIuY5a2HKJO6h14/lkjaRYtOWipwqSkPLwZPgqIxLZI=; b=S+CdHzpBt3EBLTYO97ql3ho/BHCviK1NFAEbp/XOvS5FAqXbwds813OObslItxQ5NR 3OcOUD1PgMyLcXzqQPhtVm2i+9hBlWTJV1HaOZRpNpGzZTqglb5W1qdsWCIo3UllUL6y VvLPTP8qLEdYofnZCihKdT5zp1HJENHJLdRFPIlLAPRU1l5tSRYBy/WKS2P2kCpf9Quy N3UxJ1fXatkgSpghHoRjXK4PvxrtM9pm6jUUQ8pd+uWpIqbT7fayEGtsnbtMRRYoMciy +bmWrPBK+Y4bu+f2QUR/OeQVLwVnioJbNJld3J2CAFchcJ22rSBdl6T1kTLxlXPSDXRK c+fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782174126; x=1782778926; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RIuY5a2HKJO6h14/lkjaRYtOWipwqSkPLwZPgqIxLZI=; b=PCysWiZCu2o98MIOrhXTuotY3Tsl6u+9f8tJZfNLWqjMJBsN1WDM9yAQNSprTHc+pQ W1e4ZXc6tHYRPkm0DndpaVdu4ZRsW0mPrwd0xiDXd7y82IwnriLpiSknfDCy4PX1f1ny xYiFTb7oRpdxy6s4a/O9qcgxoyHjeS6IIAuGmrY1HVTwe2f5eHMPFy3EKIpORjTcIZR7 CYX18uxWkfIGXm2IilywhLZeTT4P3KXlOCMX8lgw6znNSuZSojWA7UEVr0PoV0QB/9A+ Z64cuHGiX5emU9g8iisqInZ5gHmf29ioiEezE0a8nwHYpMXIvK7OKJHff6aFbF2mtyRs f1tA== X-Forwarded-Encrypted: i=1; AFNElJ8xTPv1tKpfrSc/xn9hcGXbCAOlsEpqqeyWOcvENFfWXo+n130jnUVKG8URP47KbVH4hm1al3PsXoXCg2M=@vger.kernel.org X-Gm-Message-State: AOJu0Yyo/RPs+HKsiWAlPzP+EstdPxn3Q4b0DNg1PmwD2sZmi423n3DK Jv+YOS2S9a2UkLRJeR5Mw3dcbDhn8BHknN/QsjR2JpFh6k6Ou+8VTbWRCg9FPoxopmL661U9bhn MZem79+9c7S8o9jSmPYSoqLtik1vx10evo8qC5Qkd X-Gm-Gg: AfdE7cnoxkou5Tr/NH1rXCYWFrC/8CFrsyCyYyVHSX22W/qW3yEfm4AwBFoZa6KTFH6 HUJIizo4Ai28R+mN5roUl+VGOLmd6xYOjHsnz7CPxoSoAYZzjQ9hTLPyUnZ196WE0jK08Lz9uXU TBfBULlCW7nPG7FJ5eAgeP0jEvuofxHQpPBLEw/k0PStQtXq/rOVNG3bqKshPIRuSzJoX0JxaXP hZmdWVVnCjHWZTLgwcsEECC2t2ZmWDNc8H5NM31lCpLeXBADfIDYmxo2Cwa0wc37LSMkixFE/zL SC3g09gGJHulGRXL3pEPNitKDOjNhxTax6hNu+7+k4KxlLHGO30PLNug3NJg0Sl+mFjSZp7GwUW 45OzgdYE5 X-Received: by 2002:ac8:57c8:0:b0:513:e686:b361 with SMTP id d75a77b69052e-51a51794604mr23792491cf.2.1782174124992; Mon, 22 Jun 2026 17:22:04 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260623000723.135-1-hdanton@sina.com> In-Reply-To: <20260623000723.135-1-hdanton@sina.com> From: Eric Dumazet Date: Mon, 22 Jun 2026 17:21:53 -0700 X-Gm-Features: AVVi8CfjcFjX-lSy17ur8ZhZC6YM0G5CgTrGQiRsMgjOp8hORMT5Fa9cgvOgEO4 Message-ID: Subject: Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock To: Hillf Danton Cc: Deepanshu Kartikey , linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org, syzbot+6b85d1e39a5b8ed9a954@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 22, 2026 at 5:07=E2=80=AFPM Hillf Danton wro= te: > > On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote: > >On Sun, Jun 21, 2026 at 6:43=E2=80=AFPM 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 fro= m > >> > 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 sysca= ll > >> > 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 fals= e > >> > 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 delive= red > >> another half-baked croissant, and feel free to cut it off instead to m= ake > >> 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 tri= gger. I had about 50 syzbot duplicates (that I did not release) before d532cddb6c= 60 ("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. I suggest you send a patch so we can discuss it.