]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-disk: use blkid instead of sgdisk -i
authorLoic Dachary <ldachary@redhat.com>
Fri, 18 Dec 2015 16:03:21 +0000 (17:03 +0100)
committerLoic Dachary <ldachary@redhat.com>
Wed, 6 Jan 2016 15:54:05 +0000 (16:54 +0100)
commit676a4b42267133a9242a81503f7dd0eaeb0afd33
tree025db3808d7f8f4e125179ca906ed2e7f48f5e4c
parentbb8d53636d3a433bb7752e3a291a86a8af058215
ceph-disk: use blkid instead of sgdisk -i

sgdisk -i 1 /dev/vdb opens /dev/vdb in write mode which indirectly
triggers a BLKRRPART ioctl from udev (starting version 214 and up) when
the device is closed (see below for the udev release note). The
implementation of this ioctl by the kernel (even old kernels) removes
all partitions and adds them again (similar to what partprobe does
explicitly).

The side effects of partitions disappearing while ceph-disk is running
are devastating.

sgdisk is replaced by blkid which only opens the device in read mode and
will not trigger this unexpected behavior.

The problem does not show on Ubuntu 14.04 because it is running udev <
214 but shows on CentOS 7 which is running udev > 214.

git clone git://anonscm.debian.org/pkg-systemd/systemd.git
systemd/NEWS:
CHANGES WITH 214:

        * As an experimental feature, udev now tries to lock the
          disk device node (flock(LOCK_SH|LOCK_NB)) while it
          executes events for the disk or any of its partitions.
          Applications like partitioning programs can lock the
          disk device node (flock(LOCK_EX)) and claim temporary
          device ownership that way; udev will entirely skip all event
          handling for this disk and its partitions. If the disk
          was opened for writing, the close will trigger a partition
          table rescan in udev's "watch" facility, and if needed
          synthesize "change" events for the disk and all its partitions.
          This is now unconditionally enabled, and if it turns out to
          cause major problems, we might turn it on only for specific
          devices, or might need to disable it entirely. Device Mapper
          devices are excluded from this logic.

http://tracker.ceph.com/issues/14080 Fixes: #14080

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 9dce05a8cdfc564c5162885bbb67a04ad7b95c5a)
src/ceph-disk