All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: "bmarzins@redhat.com" <bmarzins@redhat.com>,
	"ritika.srivastava@oracle.com" <ritika.srivastava@oracle.com>
Cc: "dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [dm-devel] [PATCH] kpartx: Add -P option for partition scanning
Date: Thu, 3 Mar 2022 10:57:33 +0000	[thread overview]
Message-ID: <455157a88c1087de6cc5c1350e64e1a49eb371b1.camel@suse.com> (raw)
In-Reply-To: <20220302183854.GA24684@octiron.msp.redhat.com>

On Wed, 2022-03-02 at 12:38 -0600, Benjamin Marzinski wrote:
> On Wed, Mar 02, 2022 at 12:07:11AM +0000, Ritika Srivastava wrote:
> > On 2/28/22, 2:44 PM, "Benjamin Marzinski" wrote:
> > 
> >     > So unless I'm missing something, we'd only really want this
> > for removing
> >     > a kpartx device, in the case where somehow you have
> > /dev/loopXpY
> >     > partitions without the LO_FLAGS_PARTSCAN flag set on the
> > disk. That
> > 
> > That's correct. We only want this option so that once PARTSCAN flag
> > is set, 
> > Kpartx -d can delete /dev/loopXpY.
> > 
> >     > seems like it shouldn't happen in the first place. 
> > Obviously, you
> >     > showed that it can with parted.  But I would argue that this
> > is a bug in
> >     > parted.  If parted is creating partitions, it should set
> >     > LO_FLAGS_PARTSCAN so the partition nodes get cleaned up.
> >     > I suppose kpartx could check if there are partition devices
> > for the loop
> >     > device, and if so, it could set LO_FLAGS_PARTSCAN before
> > doing the
> > 
> > Would removing all partition nodes (/dev/loop0pY) on kpartx -d be a
> > better solution.?
> 
> Like I said, if we fix this in multipath, then checking for
> /dev/loopXpY
> devnodes, and setting LO_FLAGS_PARTSCAN before deleting the loop
> device
> if they are present seems like a better solution.
> 
> But again, you can make a pretty good case that when parted creates
> those partition devices, it should set LO_FLAGS_PARTSCAN so that
> their
> devnodes will get cleaned up.

I guess that would do no harm. But parted, too, is agnostic of how the
loop device was created, so I wouldn't call it a bug that parted
currently doesn't set this flag. Arguably, the flag should be set when
the device is created, using "losetup -P". I find it strange that
Ritika calls that a "workaround". IMO it's the one and only correct way
to set up the loop device.

> Leaving devnodes around doesn't cause lvm issues. But adding loop
> partitions can cause lvm issues.  This is why I don't like the idea
> of
> kpartx creating them.

I agree. kpartx is a tool for creating linear dm mappings that behave
roughly like partitions. And it should stay that way. We (made the
mistake to) add convenience functionality to setup loop devices when
kpartx is called with a regular file argument. That doesn't mean that
kpartx is a generic tool for handling loop devices or partition
devices. We should stick to the "do one thing, do it right" philosophy
here.

TBH, he usage "kpartx -av /some/file" just to create the loop device,
if the file has no partition table, looks like an abuse to me. I
wouldn't recommend to rely on that behavior. It might change in the
future.

Regards,
Martin


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2022-03-03 10:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 20:41 [dm-devel] [PATCH] kpartx: Add -P option for partition scanning Ritika Srivastava
2022-02-22 18:16 ` Ritika Srivastava
2022-02-22 18:27 ` Benjamin Marzinski
2022-02-22 18:59   ` Ritika Srivastava
2022-02-22 19:31     ` Benjamin Marzinski
2022-02-22 22:16       ` Ritika Srivastava
2022-02-28 22:44         ` Benjamin Marzinski
2022-03-02  0:07           ` Ritika Srivastava
2022-03-02 18:38             ` Benjamin Marzinski
2022-03-03 10:57               ` Martin Wilck [this message]
2022-03-03 17:38                 ` Ritika Srivastava
2022-02-11 22:34 Ritika Srivastava

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=455157a88c1087de6cc5c1350e64e1a49eb371b1.camel@suse.com \
    --to=martin.wilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ritika.srivastava@oracle.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.