All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] dmsetup: Set exit code to 1 if remove_all fails to remove all devices
Date: Tue, 02 Dec 2014 20:16:00 +0100	[thread overview]
Message-ID: <547E0FF0.70605@redhat.com> (raw)
In-Reply-To: <20141202175825.GA8489@wunner.de>

Dne 2.12.2014 v 18:58 Lukas Wunner napsal(a):
> There are scripts out there which expect "dmsetup remove_all" to
> not exit with 0 if some devices couldn't be removed, e.g. dracut:
> https://git.kernel.org/cgit/boot/dracut/dracut.git/tree/modules.d/90dm/dm-shutdown.sh
>
> Up until now the exit code of "dmsetup remove_all" is only non-zero
> if the call to ioctl() fails, causing _do_dm_ioctl() to return NULL
> instead of a struct dm_ioctl*.
>

 From man page:
--

Attempts  to  remove all device definitions i.e. reset the driver.  This also 
runs mknodes afterwards.  Use with care!  Open devices cannot be removed, but 
adding --force will replace the table with one that fails all I/O. --deferred 
will enable  deferred  removal of  open devices - the device will be removed 
when the last user closes it.  The deferred removal feature is supported since 
version 4.27.0 of the device-mapper driver available in upstream kernel 
version 3.13.

--

It really is meant to remove only not opened devices.

 > 
https://git.kernel.org/cgit/boot/dracut/dracut.git/tree/modules.d/90dm/dm-shutdown.sh

I'm afraid you need that script.

Moreover  'remove_all' is rather 'developer's' feature - it should never be be 
used 'randomly'  by a script.

So IMHO if some public script tries to use it - the script is IMHO broken.
You really are not supposed to randomly turn off device - only if you really 
know what you are doing (it's very similar to put in there  rm -rf....)

Zdenek



  reply	other threads:[~2014-12-02 19:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 17:58 [PATCH] dmsetup: Set exit code to 1 if remove_all fails to remove all devices Lukas Wunner
2014-12-02 19:16 ` Zdenek Kabelac [this message]
2014-12-02 21:00   ` Lukas Wunner
2014-12-02 21:12     ` Zdenek Kabelac
2014-12-06 21:25       ` Lukas Wunner

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=547E0FF0.70605@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=lvm-devel@redhat.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.