All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Wang Sheng-Hui <shhuiw@foxmail.com>
Cc: dm-devel <dm-devel@redhat.com>, hch <hch@lst.de>
Subject: Re: confusion about multipath_prepare_ioctl
Date: Tue, 6 Mar 2018 00:44:22 -0500	[thread overview]
Message-ID: <20180306054422.GA19607@redhat.com> (raw)
In-Reply-To: <tencent_16F29DEA1877E6C6D13CB47D4E3B41358508@qq.com>

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

  reply	other threads:[~2018-03-06  5:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06  3:35 confusion about multipath_prepare_ioctl Wang Sheng-Hui
2018-03-06  5:44 ` Mike Snitzer [this message]
2018-03-07  1:18   ` shhuiw

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=20180306054422.GA19607@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=shhuiw@foxmail.com \
    /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.