Re: [PATCH] block: Fix possible sleep in invalid context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 01 Jul 2013 15:24:11 -0700 James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote:

> > --- a/block/blk-core.c~block-fix-possible-sleep-in-invalid-context-fix
> > +++ a/block/blk-core.c
> > @@ -3159,15 +3159,14 @@ EXPORT_SYMBOL(blk_pre_runtime_resume);
> >   */
> >  void blk_post_runtime_resume(struct request_queue *q, int err)
> >  {
> > +	spin_lock_irq(q->queue_lock);
> >  	if (!err) {
> > -		spin_lock_irq(q->queue_lock);
> >  		q->rpm_status = RPM_ACTIVE;
> >  		__blk_run_queue(q);
> >  		pm_runtime_mark_last_busy(q->dev);
> >  		spin_unlock_irq(q->queue_lock);
> >  		pm_request_autosuspend(q->dev);
> >  	} else {
> > -		spin_lock_irq(q->queue_lock);
> >  		q->rpm_status = RPM_SUSPENDED;
> >  		spin_unlock_irq(q->queue_lock);
> >  	}
> > _
> > 
> > 
> > I wonder if we actually need locking around that second write to
> > q->rpm_status.
> 
> Shouldn't: it's an int, which makes it a 32 bit quantity we believe to
> have atomic write properties on every platform.

Yes, but.  If there's some other code path which does:

	spin_lock(queue_lock);
	x = q->rpm_status;
	...
	y = q->rpm_status;
	...
	<assumes x == y>
	spin_unlock(queue_lock);

then it blows up if we make the suggested change.  Stranger things have
happened...

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux