Accepting request 394529 from home:jeff_mahoney:branches:filesystems

- Add udev rules for dm devices (bsc#912170 bsc#888215)
  - Added patch: 0169-btrfs-progs-udev-add-rules-for-dm-devices.patch
  - Added patch: btrfs-progs-no-PKG_CHECK_VAR

OBS-URL: https://build.opensuse.org/request/show/394529
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=238
This commit is contained in:
David Sterba 2016-05-10 15:34:21 +00:00 committed by Git OBS Bridge
parent 88658f7980
commit 59947819a4
4 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,82 @@
From 8bd39e44efa9fdbf221200b3d680b2d8205c89e9 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney <jeffm@suse.com>
Date: Fri, 6 May 2016 15:18:32 -0400
Subject: [PATCH v2] btrfs-progs: udev: add rules for dm devices
References: bsc#912170 bsc#888215
Patch-upstream: Submitted to linux-btrfs, 9 May 2016
Systemd's btrfs rule runs btrfs dev ready on each device
as it's discovered. The btrfs command is executed as a builtin
command via an IMPORT{builtin} rule, which means it gets
executed at rule evaluation time, not rule execution time. That
means that the device mapper links haven't been setup yet and the only
nodes that can be depended upon are /dev/dm-#. That we see
/dev/mapper/name names in /proc/mounts is only because we replace the
device name we have cached with the one passed in via mount. If
we have a multi-device file system and the primary device is removed,
the remaining devices will show /dev/dm-#. In addition, if the
udev rule is executed again by someone generating a change event (e.g.
partprobe), the names are also replaced by the /dev/dm-# names.
This patch adds a new rule that adds a run rule that calls btrfs dev
ready again using the device mapper links once they're created.
---
64-btrfs-dm.rules | 10 ++++++++++
Makefile.in | 8 ++++++++
configure.ac | 2 ++
3 files changed, 20 insertions(+)
create mode 100644 64-btrfs-dm.rules
--- /dev/null
+++ b/64-btrfs-dm.rules
@@ -0,0 +1,10 @@
+SUBSYSTEM!="block", GOTO="btrfs_end"
+KERNEL!="dm-[0-9]*", GOTO="btrfs_end"
+ACTION!="add|change", GOTO="btrfs_end"
+ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
+
+# Once the device mapper symlink is created, tell btrfs about it
+# so we get the friendly name in /proc/mounts (and tools that read it)
+ENV{DM_NAME}=="?*", RUN{builtin}+="btrfs ready /dev/mapper/$env{DM_NAME}"
+
+LABEL="btrfs_end"
--- a/Makefile.in
+++ b/Makefile.in
@@ -84,11 +84,15 @@ libbtrfs_headers = send-stream.h send-ut
extent_io.h ioctl.h ctree.h btrfsck.h version.h
TESTS = fsck-tests.sh convert-tests.sh
+udev_rules = 64-btrfs-dm.rules
+
prefix ?= @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir ?= @libdir@
incdir = @includedir@/btrfs
+udevdir = @UDEVDIR@
+udevruledir = ${udevdir}/rules.d
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
@@ -390,6 +394,10 @@ install: $(libs) $(progs_install) $(INST
cp -a $(lib_links) $(DESTDIR)$(libdir)
$(INSTALL) -m755 -d $(DESTDIR)$(incdir)
$(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir)
+ifneq ($(udevdir), "")
+ $(INSTALL) -m755 -d $(DESTDIR)$(udevruledir)
+ $(INSTALL) -m644 $(udev_rules) $(DESTDIR)$(udevruledir)
+endif
install-static: $(progs_static) $(INSTALLDIRS)
$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,8 @@ PKG_STATIC(UUID_LIBS_STATIC, [uuid])
PKG_CHECK_MODULES(ZLIB, [zlib])
PKG_STATIC(ZLIB_LIBS_STATIC, [zlib])
+PKG_CHECK_VAR([UDEVDIR], [udev], [udevdir])
+
dnl lzo library does not provide pkg-config, let use classic way
AC_CHECK_LIB([lzo2], [lzo_version], [
LZO2_LIBS="-llzo2"

View File

@ -0,0 +1,27 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs-progs: make PKG_CHECK_VAR optional
Patch-upstream: Never, SLE11-specific
SLE11 has an old enough pkg-config that PKG_CHECK_VAR doesn't exist.
We can skip checking it because SLE11 doesn't have systemd's btrfs udev
rules either and 'make install' does the right thing if UDEVDIR is empty.
---
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 4af7474..64b1c7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,7 +124,8 @@ PKG_STATIC(UUID_LIBS_STATIC, [uuid])
PKG_CHECK_MODULES(ZLIB, [zlib])
PKG_STATIC(ZLIB_LIBS_STATIC, [zlib])
-PKG_CHECK_VAR([UDEVDIR], [udev], [udevdir])
+m4_ifdef([PKG_CHECK_VAR],
+[PKG_CHECK_VAR([UDEVDIR], [udev], [udevdir])])
dnl lzo library does not provide pkg-config, let use classic way
AC_CHECK_LIB([lzo2], [lzo_version], [

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon May 9 15:47:01 UTC 2016 - jeffm@suse.com
- Add udev rules for dm devices (bsc#912170 bsc#888215)
- Added patch: 0169-btrfs-progs-udev-add-rules-for-dm-devices.patch
- Added patch: btrfs-progs-no-PKG_CHECK_VAR
------------------------------------------------------------------- -------------------------------------------------------------------
Tue May 3 00:00:00 CEST 2016 - dsterba@suse.cz Tue May 3 00:00:00 CEST 2016 - dsterba@suse.cz

View File

@ -40,8 +40,10 @@ Source4: setup-btrfs.sh
Patch163: 0163-btrfs-progs-fsck-fix-segfault.patch Patch163: 0163-btrfs-progs-fsck-fix-segfault.patch
Patch167: 0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch Patch167: 0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch
Patch168: 0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch Patch168: 0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch
Patch169: 0169-btrfs-progs-udev-add-rules-for-dm-devices.patch
Patch1000: local-version-override.patch Patch1000: local-version-override.patch
Patch1001: btrfs-progs-no-PKG_CHECK_VAR
BuildRequires: asciidoc BuildRequires: asciidoc
BuildRequires: autoconf BuildRequires: autoconf
@ -112,7 +114,9 @@ build applications to interface with btrfs.
%patch163 -p1 %patch163 -p1
%patch167 -p1 %patch167 -p1
%patch168 -p1 %patch168 -p1
%patch169 -p1
%patch1000 -p1 %patch1000 -p1
%patch1001 -p1
%build %build
./autogen.sh ./autogen.sh
@ -257,6 +261,10 @@ done
%dir %{_datadir}/bash-completion/completions %dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/btrfs %{_datadir}/bash-completion/completions/btrfs
%if 0%{?suse_version} >= 1200
%{_udevrulesdir}/64-btrfs-dm.rules
%endif
%if 0%{?for_debugging:1} %if 0%{?for_debugging:1}
/sbin/btrfs-find-root /sbin/btrfs-find-root
%{_sbindir}/btrfs-find-root %{_sbindir}/btrfs-find-root