All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Michael Demmer <Michael.Demmer@riverbed.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	"linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>
Subject: Re: bug in bio_map_user_iov
Date: Thu, 18 Nov 2010 11:02:52 +1100	[thread overview]
Message-ID: <20101118110252.498cc1ea@notabene.brown> (raw)
In-Reply-To: <4A89C515-6A74-4C0B-9A81-8FAB6C36AFF0@riverbed.com>

On Wed, 17 Nov 2010 13:24:47 -0800
Michael Demmer <Michael.Demmer@riverbed.com> wrote:

> Hello all,
> 
> I've been doing some work with a Linux kernel module that enables zero-copy I/O to block devices using a custom user/kernel interface. In porting this from an older Linux kernel to a more modern release, I ran into an issue when interacting with MD devices that I traced back to what I believe to be a problem in bio_map_user_iov.
> 
> The problem and fix are described in the first attached patch. The second is a simple test module and user program which triggers the bug and validates the fix.
> 
> Thanks,
> -m
> 
> ps. This is my first attempt at pushing a patch upstream so please forgive any newbie mistakes.
> 

I think the real issue here is that bio_map_user is an interface that was
only intended to be used by bottom level devices like SCSI drivers etc.
It is a function that a device driver can use if it knows that it makes sense
to use it.

You are trying to use it as a generic interface that works for all block
devices, and it wasn't intended for that.

So while it is reasonably simple to 'fix' bio_map_user_iov, it is not
possible to 'fix' bio_map_kern_iov in the same way, because it doesn't have
access to the bdev at all.


So the question we should be asking is: are you really using the right
interface for the job?  Is bio_map_user something that you really should be
using?
And to answer that, we would need to know what you are trying to do.

And why isn't O_DIRECT a suitable zero-copy interface for I/O to block
devices?

NeilBrown


  reply	other threads:[~2010-11-18  0:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 21:24 bug in bio_map_user_iov Michael Demmer
2010-11-18  0:02 ` Neil Brown [this message]
2010-11-18 21:08   ` Michael Demmer
2010-11-19 20:08     ` John Stoffel

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=20101118110252.498cc1ea@notabene.brown \
    --to=neilb@suse.de \
    --cc=Michael.Demmer@riverbed.com \
    --cc=axboe@kernel.dk \
    --cc=linux-raid@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.