From: Aibing Chen <chenaibing@cmss.chinamobile.com>
To: bvanassche@acm.org
Cc: axboe@kernel.dk, chenaibing@cmss.chinamobile.com,
davem@davemloft.net, edumazet@kernel.org, horms@kernel.org,
josef@toxicpanda.com, kuba@kernel.org, kuniyu@google.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
nbd@other.debian.org, pabeni@redhat.com, stable@vger.kernel.org,
syzbot+b29ed72382b0e218323a@syzkaller.appspotmail.com,
willemb@google.com
Subject: Re: [PATCH] nbd: do not reinitialize a live socket lock when reclassifying
Date: Sun, 15 Nov 2026 11:37:49 +0800 [thread overview]
Message-ID: <20261115033749.827-1-chenaibing@cmss.chinamobile.com> (raw)
In-Reply-To: <426d5936-54aa-4b4a-b70f-73f506c5a902@acm.org>
Hi Bart,
Thanks for the detailed review - all three points are valid, and I
agree the reclassification approach cannot be made safe for a live
socket:
1. Right - sock_allow_reclassification() is an unsynchronized check
and lockdep_init_map_type() clears lock->class_cache[] without
synchronization. I also missed that lock_sock_nested() keeps
sk->sk_lock.dep_map acquired in lockdep while sleeping in
__lock_sock(), so reinitializing the dep_map while another task
holds it breaks match_held_lock().
2. Right - sk_owner_set() calls __module_get() unconditionally, so
repeated NBD_SET_SOCK on the same fd leaks module references.
3. Understood: as long as userspace can still issue sendmsg() on the
socket, the original sk_lock -> mmap_lock -> fs_reclaim cycle is
recreated regardless of the lock class, so reclassification does
not fix what d532cddb6c60 aimed at.
I will drop this patch. Are you (or Eric) planning to prepare the
revert of d532cddb6c60 and 9280e6edf656 together with the TX/shutdown
deferral to a workqueue, or would you like me to prepare it? If you
would like me to prepare it, I would appreciate your guidance on the
workqueue design (nbd_queue_rq() currently transmits inline via
nbd_handle_cmd()).
Thanks again,
Aibing Chen
next prev parent reply other threads:[~2026-11-15 3:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 15:05 Aibing Chen
2026-11-14 19:17 ` Bart Van Assche
2026-11-15 3:37 ` Aibing Chen [this message]
2026-11-15 4:22 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115033749.827-1-chenaibing@cmss.chinamobile.com \
--to=chenaibing@cmss.chinamobile.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+b29ed72382b0e218323a@syzkaller.appspotmail.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®