All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: jens.axboe@oracle.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] sg: disable interrupts inside sg_copy_buffer
Date: Fri, 12 Sep 2008 09:11:51 -0500	[thread overview]
Message-ID: <1221228712.3265.3.camel@localhost.localdomain> (raw)
In-Reply-To: <20080912231254I.fujita.tomonori@lab.ntt.co.jp>

On Fri, 2008-09-12 at 23:12 +0900, FUJITA Tomonori wrote:
> On Fri, 12 Sep 2008 08:48:39 -0500
> James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> 
> > On Fri, 2008-09-12 at 15:26 +0900, FUJITA Tomonori wrote:
> > > On Fri, 12 Sep 2008 08:05:46 +0200
> > > Jens Axboe <jens.axboe@oracle.com> wrote:
> > > 
> > > > On Fri, Sep 12 2008, FUJITA Tomonori wrote:
> > > > > On Thu, 11 Sep 2008 18:33:03 +0200
> > > > > Jens Axboe <jens.axboe@oracle.com> wrote:
> > > > > 
> > > > > > On Thu, Sep 11 2008, FUJITA Tomonori wrote:
> > > > > > > The callers of sg_copy_buffer must disable interrupts before calling
> > > > > > > it (since it uses kmap_atomic). Some callers use it on
> > > > > > > interrupt-disabled code but some need to take the trouble to disable
> > > > > > > interrupts just for this. No wonder they forget about it and we hit a
> > > > > > > bug like:
> > > > > > > 
> > > > > > > http://bugzilla.kernel.org/show_bug.cgi?id=11529
> > > > > > > 
> > > > > > > James said that it might be better to disable interrupts inside the
> > > > > > > function rather than risk the callers getting it wrong.
> > > > > > > 
> > > > > > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > > > > > > ---
> > > > > > >  lib/scatterlist.c |    5 +++++
> > > > > > >  1 files changed, 5 insertions(+), 0 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/lib/scatterlist.c b/lib/scatterlist.c
> > > > > > > index 876ba6d..dd52cd5 100644
> > > > > > > --- a/lib/scatterlist.c
> > > > > > > +++ b/lib/scatterlist.c
> > > > > > > @@ -422,6 +422,9 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents,
> > > > > > >  {
> > > > > > >  	unsigned int offset = 0;
> > > > > > >  	struct sg_mapping_iter miter;
> > > > > > > +	unsigned long flags;
> > > > > > > +
> > > > > > > +	local_irq_save(flags);
> > > > > > >  
> > > > > > >  	sg_miter_start(&miter, sgl, nents, SG_MITER_ATOMIC);
> > > > > > >  
> > > > > > > @@ -442,6 +445,8 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents,
> > > > > > >  
> > > > > > >  	sg_miter_stop(&miter);
> > > > > > >  
> > > > > > > +	local_irq_restore(flags);
> > > > > > > +
> > > > > > >  	return offset;
> > > > > > >  }
> > > > > > 
> > > > > > Agreed and applied.
> > > > > 
> > > > > Jens, this won't go to 2.6.27 (goes to 2.6.28)?
> > > > > 
> > > > > If so, I need to ask James to apply this workaround to 2.6.27:
> > > > > 
> > > > > http://marc.info/?l=linux-scsi&m=122106973807028&w=2
> > > > 
> > > > It will go into 2.6.27, it's already upstream since ~10 hours or so.
> > > 
> > > Thanks, I've just found it.
> > 
> > You forgot to add the cc: stable@kernel.org tag.  You'll have to send
> > this to stable manually quoting the upsream commit id.
> 
> You forgot that Tejun rewrote the sg copy code after 2.6.26. This
> patch can't be applied to 2.6.26.X.
> 
> I need to push a patch that is not in mainline to stable trees. Can I
> do that ?

Yes, if we're absolutely sure it's necessary.  You'll have to quote the
upstream commit ID, explain why the backport has to be different and add
the patch.

James



      reply	other threads:[~2008-09-12 14:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11 14:52 [PATCH] sg: disable interrupts inside sg_copy_buffer FUJITA Tomonori
2008-09-11 16:33 ` Jens Axboe
2008-09-12  2:04   ` FUJITA Tomonori
2008-09-12  6:05     ` Jens Axboe
2008-09-12  6:26       ` FUJITA Tomonori
2008-09-12 13:48         ` James Bottomley
2008-09-12 14:12           ` FUJITA Tomonori
2008-09-12 14:11             ` James Bottomley [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=1221228712.3265.3.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.