From: NeilBrown <neilb@suse.de>
To: Keith Busch <keith.busch@intel.com>
Cc: Jens Axboe <axboe@fb.com>, lkml <linux-kernel@vger.kernel.org>
Subject: LOCKDEP warning due to ext_devt_lock
Date: Thu, 28 May 2015 12:32:33 +1000 [thread overview]
Message-ID: <20150528123233.3df8ff55@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]
Hi Keith,
I'm getting lockdep warning around use of ext_devt_lock.
[11428.266019] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
As you say in
2da78092dda1 ("block: Fix dev_t minor allocation lifetime")
ext_devt_lock can be taken from call_rcu's soft-irq.
I think that means it should always use the _irq verion of spinlock.
I've been using the following patch and the LOCKDEP message are gone.
If you agree, could you forward it or something similar upstream?
Thanks,
NeilBrown
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/block/genhd.c b/block/genhd.c
index 666e11b83983..d1338934562e 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -422,9 +422,9 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt)
/* allocate ext devt */
idr_preload(GFP_KERNEL);
- spin_lock(&ext_devt_lock);
+ spin_lock_irq(&ext_devt_lock);
idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT);
- spin_unlock(&ext_devt_lock);
+ spin_unlock_irq(&ext_devt_lock);
idr_preload_end();
if (idx < 0)
@@ -449,9 +449,9 @@ void blk_free_devt(dev_t devt)
return;
if (MAJOR(devt) == BLOCK_EXT_MAJOR) {
- spin_lock(&ext_devt_lock);
+ spin_lock_irq(&ext_devt_lock);
idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
- spin_unlock(&ext_devt_lock);
+ spin_unlock_irq(&ext_devt_lock);
}
}
@@ -690,13 +690,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno)
} else {
struct hd_struct *part;
- spin_lock(&ext_devt_lock);
+ spin_lock_irq(&ext_devt_lock);
part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
if (part && get_disk(part_to_disk(part))) {
*partno = part->partno;
disk = part_to_disk(part);
}
- spin_unlock(&ext_devt_lock);
+ spin_unlock_irq(&ext_devt_lock);
}
return disk;
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
next reply other threads:[~2015-05-28 2:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 2:32 NeilBrown [this message]
2015-05-28 3:32 ` LOCKDEP warning due to ext_devt_lock Jens Axboe
2015-05-28 3:45 ` NeilBrown
2015-05-28 16:13 ` Jens Axboe
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=20150528123233.3df8ff55@notabene.brown \
--to=neilb@suse.de \
--cc=axboe@fb.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).