On Wed, 17 Nov 2010 13:24:47 -0800 Michael Demmer <Michael.Demmer@xxxxxxxxxxxx> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html