Linux block layer
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Josef Bacik <josef@toxicpanda.com>, Eric Dumazet <edumazet@google.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	Christian Brauner <brauner@kernel.org>,
	linux-block@vger.kernel.org, nbd@other.debian.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nbd: reclassify u->iolock of AF_UNIX sockets
Date: Mon, 27 Jul 2026 18:25:36 +0200	[thread overview]
Message-ID: <e9d4fbca-ca91-4b92-a1be-950d0fde79b4@linux.ibm.com> (raw)
In-Reply-To: <b15b5fcd-441d-40a8-9055-4d232f3780bb@linux.ibm.com>

Am 14.07.26 um 18:19 schrieb Christian Borntraeger:
> Am 13.07.26 um 20:14 schrieb Christian Borntraeger:
> 
> I just realized I had my kernel.org address in from.
> question is, is this the right fix and shall I do a proper patch wit correct from and signoff.
> 
> [..]
> 
>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>> index 8f10762e90ef..a811e431b47a 100644
>> --- a/drivers/block/nbd.c
>> +++ b/drivers/block/nbd.c
>> @@ -32,6 +32,7 @@
>>   #include <linux/err.h>
>>   #include <linux/kernel.h>
>>   #include <linux/slab.h>
>> +#include <net/af_unix.h>
>>   #include <net/sock.h>
>>   #include <linux/net.h>
>>   #include <linux/kthread.h>
>> @@ -1241,6 +1242,7 @@ static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd,
>>   #ifdef CONFIG_DEBUG_LOCK_ALLOC
>>   static struct lock_class_key nbd_key[3];
>>   static struct lock_class_key nbd_slock_key[3];
>> +static struct lock_class_key nbd_unix_iolock_key;
>>   static void nbd_reclassify_socket(struct socket *sock)
>>   {
>> @@ -1267,6 +1269,17 @@ static void nbd_reclassify_socket(struct socket *sock)
>>                             &nbd_slock_key[2],
>>                             "sk_lock-AF_UNIX-NBD",
>>                             &nbd_key[2]);
>> +        /*
>> +         * The AF_UNIX stream recvmsg/sendmsg paths serialize on
>> +         * u->iolock, not sk_lock, so it must be reclassified as
>> +         * well.  A held mutex cannot be reclassified; skip it in
>> +         * that case, as sock_allow_reclassification() does for
>> +         * sk_lock.
>> +         */
>> +        if (!mutex_is_locked(&unix_sk(sk)->iolock))
>> +            lockdep_set_class_and_name(&unix_sk(sk)->iolock,
>> +                           &nbd_unix_iolock_key,
>> +                           "&u->iolock-NBD");
>>           break;
>>       }
>>   }


Ping. I can respin with all the fixes (NBD_CMD_RECONFIGURE and correct from address) but
I at least want to get some feedback from the ndb maintainers if this is the right approach.

I definitely want to get rid of the lockdep false positive in our CI.

  parent reply	other threads:[~2026-07-27 16:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 18:14 [PATCH] nbd: reclassify u->iolock of AF_UNIX sockets Christian Borntraeger
2026-07-14 16:19 ` Christian Borntraeger
2026-07-16 13:57   ` Christian Borntraeger
2026-07-27 16:25   ` Christian Borntraeger [this message]
2026-07-15 15:47 ` Christian Borntraeger

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=e9d4fbca-ca91-4b92-a1be-950d0fde79b4@linux.ibm.com \
    --to=borntraeger@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=edumazet@google.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@other.debian.org \
    /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