From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com
Subject: Re: [PATCH] sg: disable interrupts inside sg_copy_buffer
Date: Thu, 11 Sep 2008 18:33:03 +0200 [thread overview]
Message-ID: <20080911163302.GV20055@kernel.dk> (raw)
In-Reply-To: <20080911235215U.fujita.tomonori@lab.ntt.co.jp>
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 Axboe
next prev parent reply other threads:[~2008-09-11 16:33 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 [this message]
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
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=20080911163302.GV20055@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox