* confusion about multipath_prepare_ioctl
@ 2018-03-06 3:35 Wang Sheng-Hui
2018-03-06 5:44 ` Mike Snitzer
0 siblings, 1 reply; 3+ messages in thread
From: Wang Sheng-Hui @ 2018-03-06 3:35 UTC (permalink / raw)
To: hch, snitzer; +Cc: dm-devel
Dear,
Sorry to trouble you.
I noticed some code in dm-*.c like:
"
static int multipath_prepare_ioctl(struct dm_target *ti,
struct block_device **bdev, fmode_t *mode)
{
...
/*
* Only pass ioctls through if the device sizes match exactly.
*/
if (!r && ti->len != i_size_read((*bdev)->bd_inode) >> SECTOR_SHIFT)
return 1;
...
}
"
Here, return value 1 means
"ioctl is being issued against a subset of the parent bdev; require extra privileges."
(comment in dm_blk_ioctl)
I'm confused by the comment and '!=' test for multipath.
In which cases, the size of low level single device is not equal to the parent
size of multipath device?
Regards,
shenghui
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: confusion about multipath_prepare_ioctl
2018-03-06 3:35 confusion about multipath_prepare_ioctl Wang Sheng-Hui
@ 2018-03-06 5:44 ` Mike Snitzer
2018-03-07 1:18 ` shhuiw
0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2018-03-06 5:44 UTC (permalink / raw)
To: Wang Sheng-Hui; +Cc: dm-devel, hch
On Mon, Mar 05 2018 at 10:35pm -0500,
Wang Sheng-Hui <shhuiw@foxmail.com> wrote:
> Dear,
>
> Sorry to trouble you.
>
> I noticed some code in dm-*.c like:
> "
> static int multipath_prepare_ioctl(struct dm_target *ti,
> struct block_device **bdev, fmode_t *mode)
> {
> ...
> /*
> * Only pass ioctls through if the device sizes match exactly.
> */
> if (!r && ti->len != i_size_read((*bdev)->bd_inode) >> SECTOR_SHIFT)
> return 1;
> ...
> }
> "
> Here, return value 1 means
> "ioctl is being issued against a subset of the parent bdev; require extra privileges."
> (comment in dm_blk_ioctl)
>
> I'm confused by the comment and '!=' test for multipath.
> In which cases, the size of low level single device is not equal to the parent
> size of multipath device?
Given that ti->len is sent down from userspace, the DM multipath
target's ti->len _could_ be smaller than the underlying path(s). But in
practice that doesn't occur with multipathd.. a partitioned multipath
device is generally done, via kpartx, in terms of linear mappings ontop
of the multipath device.
The same != test is done in the dm linear target and is much more
relevant to concerns about ioctls being sent to partition.
Mike
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: confusion about multipath_prepare_ioctl
2018-03-06 5:44 ` Mike Snitzer
@ 2018-03-07 1:18 ` shhuiw
0 siblings, 0 replies; 3+ messages in thread
From: shhuiw @ 2018-03-07 1:18 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel, hch
On 2018年03月06日 13:44, Mike Snitzer wrote:
> On Mon, Mar 05 2018 at 10:35pm -0500,
> Wang Sheng-Hui <shhuiw@foxmail.com> wrote:
>
>> Dear,
>>
>> Sorry to trouble you.
>>
>> I noticed some code in dm-*.c like:
>> "
>> static int multipath_prepare_ioctl(struct dm_target *ti,
>> struct block_device **bdev, fmode_t *mode)
>> {
>> ...
>> /*
>> * Only pass ioctls through if the device sizes match exactly.
>> */
>> if (!r && ti->len != i_size_read((*bdev)->bd_inode) >> SECTOR_SHIFT)
>> return 1;
>> ...
>> }
>> "
>> Here, return value 1 means
>> "ioctl is being issued against a subset of the parent bdev; require extra privileges."
>> (comment in dm_blk_ioctl)
>>
>> I'm confused by the comment and '!=' test for multipath.
>> In which cases, the size of low level single device is not equal to the parent
>> size of multipath device?
> Given that ti->len is sent down from userspace, the DM multipath
> target's ti->len _could_ be smaller than the underlying path(s). But in
> practice that doesn't occur with multipathd.. a partitioned multipath
> device is generally done, via kpartx, in terms of linear mappings ontop
> of the multipath device.
>
> The same != test is done in the dm linear target and is much more
> relevant to concerns about ioctls being sent to partition.
>
> Mike
>
>
Thanks for your explanation, Mike!
Regards,
shenghui
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-07 1:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 3:35 confusion about multipath_prepare_ioctl Wang Sheng-Hui
2018-03-06 5:44 ` Mike Snitzer
2018-03-07 1:18 ` shhuiw
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.