Re: [PATCH 01/15] dm: support ioctls on mapped devices
From: Andrew Morton
Date: Thu Jun 22 2006 - 12:54:43 EST
On Thu, 22 Jun 2006 16:17:21 +0100
Alasdair G Kergon <agk@xxxxxxxxxx> wrote:
> On Thu, Jun 22, 2006 at 01:29:57AM -0700, Andrew Morton wrote:
> > OK. I do think dm needs to remember /dev/sda's file* to get this right
> > though. That's where the ->ioctl methods are.
>
> > Oh dear. raw_open() doesn't have a file* for the device.
>
> Similar with device-mapper: in normal usage dm only sees major:minor.
>
> Yes, the filp dm passes along is incorrect:
>
> - return blkdev_driver_ioctl(bdev->bd_inode, filp, bdev->bd_disk, cmd, arg);
> + return blkdev_driver_ioctl(bdev->bd_inode, NULL, bdev->bd_disk, cmd, arg);
>
> But should unlocked_ioctl become ?
>
> - long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
> + long (*unlocked_ioctl) (struct inode *, struct file *, unsigned, unsigned long);
>
> so it can be used for block devices?
Perhaps it should (have). It's a bit nasty, but we do have at least two
internal callers who don't have a file*.
The alternative would be to cook up a fake file* like blkdev_get() does,
but we don't want to propagate that practice.
Oh well. I suppose a lock_kernel() won't kill us.
> See also block/scsi_ioctl.c:201 verify_command() [scsi_cmd_ioctl]
> * file can be NULL from ioctl_by_bdev()...
>
> Or should we be working towards eliminating interfaces that use device numbers?
If possible. I guess that would require DM to track the devices with
file*'s or inode*'s or bdev*'s. Which, I assume, would be non-trivial.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/