All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: device-mapper development <dm-devel@redhat.com>, a.nielsen@shikadi.net
Subject: Re: How do you force-close a dm device after a disk failure?
Date: Mon, 14 Sep 2015 08:43:23 +0200	[thread overview]
Message-ID: <55F66C8B.7070603@redhat.com> (raw)
In-Reply-To: <20150914102917.3991920c@korath.teln.shikadi.net>

Dne 14.9.2015 v 02:29 Adam Nielsen napsal(a):
> Hi all,
>
> I'm trying to work out how to force-remove a dm device after the
> underlying disks failed.  Because the kernel is still trying to write
> blocks to the failed devices, I can't unmount the filesystem, so I
> don't seem to be able to just drop the data, get some errors, then have
> everything unmounted and clean, ready to try again.
>
>    $ dmsetup remove backup
>    device-mapper: remove ioctl on backup failed: Device or resource busy
>    Command failed
>
> Using --force says it will replace the device with one that returns I/O
> errors which sounds perfect, but that just locks up:
>
>    $ dmsetup remove --force backup
>    ^C^C^\^\
>
> Running it through strace shows it getting stuck in the kernel:
>
>    $ strace dmsetup remove --force backup
>    [...]
>    access("/run/udev/control", F_OK)       = 0
>    open("/dev/urandom", O_RDONLY)          = 4
>    read(4, "\2\325", 2)                    = 2
>    semget(0xd4dd502, 1, IPC_CREAT|IPC_EXCL|0600) = 458754
>    semctl(458754, 0, SETVAL, 0x1)          = 0
>    semctl(458754, 0, GETVAL, 0x7f254875c47a) = 1
>    close(4)                                = 0
>    semop(458754, {{0, 1, 0}}, 1)           = 0
>    semctl(458754, 0, GETVAL, 0x7f254875c417) = 2
>    ioctl(3, DM_DEV_SUSPEND
>
> Is there any way to forcefully remove a dm device, or do you have to
> reboot to remove failed devices?
>
> I'm running kernel 4.1.4.


You need to show your 'broken' table first.
i.e. you can't replace some targets in some cases (I think suspended thin-pool
with broken metadata cannot be replaced with error target)

However for the 'standard' linear device - you could always replace  opened 
device with error target with '--force'.

What you can't expect is  'device deletion' - as long as device is opened,
it will be present (even if all read & writes will be errored).

As long as kernel structures are in use - device remains present.

Also note - dmsetup remove  supports --deferred removal (see man page).

Zdenek

  reply	other threads:[~2015-09-14  6:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14  0:29 How do you force-close a dm device after a disk failure? Adam Nielsen
2015-09-14  6:43 ` Zdenek Kabelac [this message]
2015-09-14  8:59   ` Adam Nielsen
2015-09-14  9:16     ` Zdenek Kabelac
2015-09-14  9:45       ` Adam Nielsen
2015-09-14 10:04         ` Zdenek Kabelac
2015-09-16  0:58           ` Adam Nielsen
2015-09-16  8:04             ` Zdenek Kabelac
2015-09-16 12:35               ` Adam Nielsen
2015-09-16 13:03                 ` Zdenek Kabelac
2015-09-19  9:47                   ` Adam Nielsen
2015-09-21 11:39                     ` Lars Ellenberg
2015-09-21 17:50                       ` Zdenek Kabelac
2015-09-17 11:41                 ` Zdenek Kabelac
2015-09-17 14:04         ` Lars Ellenberg

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=55F66C8B.7070603@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=a.nielsen@shikadi.net \
    --cc=dm-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.