public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@linux.intel.com>
To: Keith Busch <keith.busch@intel.com>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	axboe@kernel.dk
Subject: Re: [PATCH] block: Fix dev_t liftime allocations
Date: Tue, 26 Aug 2014 08:32:42 -0400	[thread overview]
Message-ID: <20140826123242.GC3285@linux.intel.com> (raw)
In-Reply-To: <1408999975-9976-1-git-send-email-keith.busch@intel.com>

On Mon, Aug 25, 2014 at 02:52:55PM -0600, Keith Busch wrote:
> Since the partition's release may be invoked from call_rcu's soft-irq
> context, the ext_dev_idr's mutex had to be replaced with a spinlock so
> as not so sleep.

> @@ -420,9 +420,9 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt)
>  	}
>  
>  	/* allocate ext devt */
> -	mutex_lock(&ext_devt_mutex);
> +	spin_lock(&ext_devt_lock);
>  	idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_KERNEL);
> -	mutex_unlock(&ext_devt_mutex);
> +	spin_unlock(&ext_devt_lock);

Can't use GFP_KERNEL if we're protected with a spinlock.  See the comment
in lib/idr.c about idr_preload:

+	idr_preload(GFP_KERNEL);
-	mutex_lock(&ext_devt_mutex);
+	spin_lock(&ext_devt_lock);
-	idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_KERNEL);
+	idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT);
-	mutex_unlock(&ext_devt_mutex);
+	spin_unlock(&ext_devt_lock);


      reply	other threads:[~2014-08-26 12:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 20:52 [PATCH] block: Fix dev_t liftime allocations Keith Busch
2014-08-26 12:32 ` Matthew Wilcox [this message]

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=20140826123242.GC3285@linux.intel.com \
    --to=willy@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.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