Tomáš Chvátal 2019-08-30 08:34:07 +00:00 committed by Git OBS Bridge
parent 554da53f00
commit 4b65210801
23 changed files with 336 additions and 6537 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:24997e26dfc916151707c9da504d38d0473bec3481a8230b676bc079041bead6
size 2373004

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJbUMBzAAoJELkRJDHlCQOfksgQAKHvpM0f4Nt354cmY6N+ha7i
ikSv6aYsFHuHYOHFKJLPJBcNaMs3oZxBtVN69ZuV0cdJ7oiwrQzQzy94wvcaBOZy
tWRLVI+grVU7Fp4uyFwGe4kkxUSGK3/lQrhtI8j+drwGvKk7O0dg8k/ayb9N1do5
hx86WsucXDl8EFxCSYGu6D8DaL+5zNhumIBXrjp5IbQunckw1/hRqstfMfs/q7dm
7dLlrCWXuEL6AwHYvSI8BorO2vRX2iUBvovNneooGUnfz+c06VawhgmwMVA3j/Lk
jOyT9ytVAgnI/yvMHKB7RUSbjCHqppvxg0K0Fs3ex2rca+GiSrtXoxsK83xVaqiS
8J3amb46ItLsE+5XUFzsSfFCxAdzEGqdW+/YmgQNRQ0OXHlsg98hTD9zNbhNMIqj
RtlPqzFKdIZfhgRAY3fw2TEAaKkuBG1+AeeJHLrPZFcDOXHyvJqoPYcMb3QeANCx
RhrMNLvs4MKlhXUkeimBJZTKXSCCIwaqtH8rOtYYM9Ei50AQYZddUObVLBoQB01Y
MxC87m1eZgIKipWTNfEXm41M4tLPebkaxT9+IBp38yVcZ1jeXxOk41EXtzcs3PII
/SlUw66qokTgSyXFH+mptqxfB3Xkk8li5wv31yOiVY9MZQzt8fvz/veY5uEGxU/a
1et7yfJMpeJYrMuhtCL4
=kQvz
-----END PGP SIGNATURE-----

3
LVM2.2.03.05.tgz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca52815c999b20c6d25e3192f142f081b93d01f07b9d787e99664b169dba2700
size 2427412

17
LVM2.2.03.05.tgz.asc Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJdBJ/2AAoJELkRJDHlCQOfLpcP/3eY1mo/MlhPwxsz23a8v7sW
0NYZKqTC0N+xOc0lZ4kwDl1ru/b59T5gGwDinmXCqjP41fvT1PZlFklrsffyCI7i
jy1QO/a06r+w8xTmdwHL08tuhkO6gh8+BKsBChYsJhdGrgBibNRO9HvIlU8LpLFs
i96GXbjoZZ3irKxy+1OxCFer1Hd2ISbBBq/YHnGlA1h24awBsiL4YDNMxC+pIEiV
nqlypDFqeNe29y/IRWrq8D3WxOm5YK40lzTi59blvl5OAIZLnhtRKm+roGTuoML5
V/ZKbTYxr/LTclUS5cIkSxQEiJxNq0TIP8zVspgAroQFKx5JX8C40bzWEDTVnrsx
3wfJWN0jPyBwPox8/QjqScE1MJ+5G8iUOxbf/SuIpp103eBJ4RR+HzaQeig7BgP/
cpk80CZwKzlKTMYedmuAE4WK5igqncrdoW2AbtVvVQLUk7cp3tdLvxMyH2z+jv5D
DCpWHqc5eB+sMmD4+Vjp6Mrg2ViSEMdAmorTX0TPrd5meos39Ged3SUZ5v0M7N0q
Lhj2jT2oqPGXKp6/7HLGd4do7zBqX4oaJ1DcfhsEi2kEBIUYdE5o9qlqn22QacpJ
N/waVKjEjmi1AiMiAaZAP/WuutH3UJmpdRZn1Qvd+Xlx1Iw0YbY/8S9NAtKazzFq
iF8g3kZyRIcBfvq94k5q
=NABD
-----END PGP SIGNATURE-----

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>devicemapper</package>
<package>lockd</package>
</multibuild>

View File

@ -1,42 +0,0 @@
Index: LVM2.2.02.178/configure
===================================================================
--- LVM2.2.02.178.orig/configure
+++ LVM2.2.02.178/configure
@@ -10888,8 +10888,6 @@ if [ `expr x"$CLVMD" : '.*corosync.*'` !
fi
################################################################################
-if test "$CLVMD" != none; then
-
# Check whether --with-clvmd-pidfile was given.
if test "${with_clvmd_pidfile+set}" = set; then :
withval=$with_clvmd_pidfile; CLVMD_PIDFILE=$withval
@@ -10902,8 +10900,6 @@ cat >>confdefs.h <<_ACEOF
#define CLVMD_PIDFILE "$CLVMD_PIDFILE"
_ACEOF
-fi
-
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build cluster mirror log daemon" >&5
$as_echo_n "checking whether to build cluster mirror log daemon... " >&6; }
Index: LVM2.2.02.178/configure.ac
===================================================================
--- LVM2.2.02.178.orig/configure.ac
+++ LVM2.2.02.178/configure.ac
@@ -959,7 +959,6 @@ fi
################################################################################
dnl -- clvmd pidfile
-if test "$CLVMD" != none; then
AC_ARG_WITH(clvmd-pidfile,
AC_HELP_STRING([--with-clvmd-pidfile=PATH],
[clvmd pidfile [PID_DIR/clvmd.pid]]),
@@ -967,7 +966,6 @@ if test "$CLVMD" != none; then
CLVMD_PIDFILE="$DEFAULT_PID_DIR/clvmd.pid")
AC_DEFINE_UNQUOTED(CLVMD_PIDFILE, ["$CLVMD_PIDFILE"],
[Path to clvmd pidfile.])
-fi
################################################################################
dnl -- Build cluster mirror log daemon

View File

@ -1,336 +0,0 @@
From ab27d5dc2a5c3bf23ab8fed438f1542015dc723d Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 29 Oct 2018 11:06:00 -0500
Subject: [PATCH] metadata: prevent writing beyond metadata area
lvm uses a bcache block size of 128K. A bcache block
at the end of the metadata area will overlap the PEs
from which LVs are allocated. How much depends on
alignments. When lvm reads and writes one of these
bcache blocks to update VG metadata, it can also be
reading and writing PEs that belong to an LV.
If these overlapping PEs are being written to by the
LV user (e.g. filesystem) at the same time that lvm
is modifying VG metadata in the overlapping bcache
block, then the user's updates to the PEs can be lost.
This patch is a quick hack to prevent lvm from writing
past the end of the metadata area.
---
lib/device/bcache.c | 79 +++++++++++++++++++++++++++++++++++++++++--
lib/device/bcache.h | 3 ++
lib/format_text/format-text.c | 10 ++++++
lib/label/label.c | 35 ++++++++++++++++++-
lib/label/label.h | 2 ++
lib/metadata/mirror.c | 4 +++
6 files changed, 130 insertions(+), 3 deletions(-)
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index 531d83b10..62352563a 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -156,6 +156,10 @@ static void _async_destroy(struct io_engine *ioe)
dm_free(e);
}
+static int _last_byte_fd;
+static uint64_t _last_byte_offset;
+static int _last_byte_sector_size;
+
static bool _async_issue(struct io_engine *ioe, enum dir d, int fd,
sector_t sb, sector_t se, void *data, void *context)
{
@@ -163,12 +167,53 @@ static bool _async_issue(struct io_engine *ioe, enum dir d, int fd,
struct iocb *cb_array[1];
struct control_block *cb;
struct async_engine *e = _to_async(ioe);
+ sector_t offset;
+ sector_t nbytes;
+ sector_t limit_nbytes;
+ sector_t extra_nbytes = 0;
if (((uintptr_t) data) & e->page_mask) {
log_warn("misaligned data buffer");
return false;
}
+ offset = sb << SECTOR_SHIFT;
+ nbytes = (se - sb) << SECTOR_SHIFT;
+
+ /*
+ * If bcache block goes past where lvm wants to write, then clamp it.
+ */
+ if ((d == DIR_WRITE) && _last_byte_offset && (fd == _last_byte_fd)) {
+ if (offset > _last_byte_offset) {
+ log_error("Limit write at %llu len %llu beyond last byte %llu",
+ (unsigned long long)offset,
+ (unsigned long long)nbytes,
+ (unsigned long long)_last_byte_offset);
+ return false;
+ }
+
+ if (offset + nbytes > _last_byte_offset) {
+ limit_nbytes = _last_byte_offset - offset;
+ if (limit_nbytes % _last_byte_sector_size)
+ extra_nbytes = _last_byte_sector_size - (limit_nbytes % _last_byte_sector_size);
+
+ if (extra_nbytes) {
+ log_debug("Limit write at %llu len %llu to len %llu rounded to %llu",
+ (unsigned long long)offset,
+ (unsigned long long)nbytes,
+ (unsigned long long)limit_nbytes,
+ (unsigned long long)(limit_nbytes + extra_nbytes));
+ nbytes = limit_nbytes + extra_nbytes;
+ } else {
+ log_debug("Limit write at %llu len %llu to len %llu",
+ (unsigned long long)offset,
+ (unsigned long long)nbytes,
+ (unsigned long long)limit_nbytes);
+ nbytes = limit_nbytes;
+ }
+ }
+ }
+
cb = _cb_alloc(e->cbs, context);
if (!cb) {
log_warn("couldn't allocate control block");
@@ -179,10 +224,22 @@ static bool _async_issue(struct io_engine *ioe, enum dir d, int fd,
cb->cb.aio_fildes = (int) fd;
cb->cb.u.c.buf = data;
- cb->cb.u.c.offset = sb << SECTOR_SHIFT;
- cb->cb.u.c.nbytes = (se - sb) << SECTOR_SHIFT;
+ cb->cb.u.c.offset = offset;
+ cb->cb.u.c.nbytes = nbytes;
cb->cb.aio_lio_opcode = (d == DIR_READ) ? IO_CMD_PREAD : IO_CMD_PWRITE;
+#if 0
+ if (d == DIR_READ) {
+ log_debug("io R off %llu bytes %llu",
+ (unsigned long long)cb->cb.u.c.offset,
+ (unsigned long long)cb->cb.u.c.nbytes);
+ } else {
+ log_debug("io W off %llu bytes %llu",
+ (unsigned long long)cb->cb.u.c.offset,
+ (unsigned long long)cb->cb.u.c.nbytes);
+ }
+#endif
+
cb_array[0] = &cb->cb;
do {
r = io_submit(e->aio_context, 1, cb_array);
@@ -1153,3 +1210,21 @@ bool bcache_invalidate_fd(struct bcache *cache, int fd)
//----------------------------------------------------------------
+void bcache_set_last_byte(struct bcache *cache, int fd, uint64_t offset, int sector_size)
+{
+ _last_byte_fd = fd;
+ _last_byte_offset = offset;
+ _last_byte_sector_size = sector_size;
+ if (!sector_size)
+ _last_byte_sector_size = 512;
+}
+
+void bcache_unset_last_byte(struct bcache *cache, int fd)
+{
+ if (_last_byte_fd == fd) {
+ _last_byte_fd = 0;
+ _last_byte_offset = 0;
+ _last_byte_sector_size = 0;
+ }
+}
+
diff --git a/lib/device/bcache.h b/lib/device/bcache.h
index b0aebb49d..cb902ef36 100644
--- a/lib/device/bcache.h
+++ b/lib/device/bcache.h
@@ -158,6 +158,9 @@ bool bcache_write_bytes(struct bcache *cache, int fd, uint64_t start, size_t len
bool bcache_zero_bytes(struct bcache *cache, int fd, uint64_t start, size_t len);
bool bcache_set_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, uint8_t val);
+void bcache_set_last_byte(struct bcache *cache, int fd, uint64_t offset, int sector_size);
+void bcache_unset_last_byte(struct bcache *cache, int fd);
+
//----------------------------------------------------------------
#endif
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 5c7b72f8e..4160ba810 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -400,10 +400,14 @@ static int _raw_write_mda_header(const struct format_type *fmt,
MDA_HEADER_SIZE -
sizeof(mdah->checksum_xl)));
+ dev_set_last_byte(dev, start_byte + MDA_HEADER_SIZE);
+
if (!dev_write_bytes(dev, start_byte, MDA_HEADER_SIZE, mdah)) {
+ dev_unset_last_byte(dev);
log_error("Failed to write mda header to %s fd %d", dev_name(dev), dev->bcache_fd);
return 0;
}
+ dev_unset_last_byte(dev);
return 1;
}
@@ -677,10 +681,13 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
(unsigned long long)(mdac->rlocn.size - new_wrap),
(unsigned long long)new_wrap);
+ dev_set_last_byte(mdac->area.dev, mdac->area.start + mdah->size);
+
if (!dev_write_bytes(mdac->area.dev, mdac->area.start + mdac->rlocn.offset,
(size_t) (mdac->rlocn.size - new_wrap),
fidtc->raw_metadata_buf)) {
log_error("Failed to write metadata to %s fd %d", dev_name(mdac->area.dev), mdac->area.dev->bcache_fd);
+ dev_unset_last_byte(mdac->area.dev);
goto out;
}
@@ -694,10 +701,13 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
(size_t) new_wrap,
fidtc->raw_metadata_buf + mdac->rlocn.size - new_wrap)) {
log_error("Failed to write metadata wrap to %s fd %d", dev_name(mdac->area.dev), mdac->area.dev->bcache_fd);
+ dev_unset_last_byte(mdac->area.dev);
goto out;
}
}
+ dev_unset_last_byte(mdac->area.dev);
+
mdac->rlocn.checksum = calc_crc(INITIAL_CRC, (uint8_t *)fidtc->raw_metadata_buf,
(uint32_t) (mdac->rlocn.size -
new_wrap));
diff --git a/lib/label/label.c b/lib/label/label.c
index e5aa2c129..5377847b3 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -173,6 +173,7 @@ int label_write(struct device *dev, struct label *label)
{
char buf[LABEL_SIZE] __attribute__((aligned(8)));
struct label_header *lh = (struct label_header *) buf;
+ uint64_t offset;
int r = 1;
if (!label->labeller->ops->write) {
@@ -207,11 +208,17 @@ int label_write(struct device *dev, struct label *label)
return 0;
}
- if (!dev_write_bytes(dev, label->sector << SECTOR_SHIFT, LABEL_SIZE, buf)) {
+ offset = label->sector << SECTOR_SHIFT;
+
+ dev_set_last_byte(dev, offset + LABEL_SIZE);
+
+ if (!dev_write_bytes(dev, offset, LABEL_SIZE, buf)) {
log_debug_devs("Failed to write label to %s", dev_name(dev));
r = 0;
}
+ dev_unset_last_byte(dev);
+
return r;
}
@@ -1354,9 +1361,12 @@ bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
}
}
+ dev_set_last_byte(dev, start + len);
+
if (!bcache_zero_bytes(scan_bcache, dev->bcache_fd, start, len)) {
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
+ dev_unset_last_byte(dev);
label_scan_invalidate(dev);
return false;
}
@@ -1364,9 +1374,11 @@ bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
if (!bcache_flush(scan_bcache)) {
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
+ dev_unset_last_byte(dev);
label_scan_invalidate(dev);
return false;
}
+ dev_unset_last_byte(dev);
return true;
}
@@ -1400,9 +1412,12 @@ bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val)
}
}
+ dev_set_last_byte(dev, start + len);
+
if (!bcache_set_bytes(scan_bcache, dev->bcache_fd, start, len, val)) {
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
+ dev_unset_last_byte(dev);
label_scan_invalidate(dev);
return false;
}
@@ -1410,9 +1425,27 @@ bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val)
if (!bcache_flush(scan_bcache)) {
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
+ dev_unset_last_byte(dev);
label_scan_invalidate(dev);
return false;
}
+
+ dev_unset_last_byte(dev);
return true;
}
+void dev_set_last_byte(struct device *dev, uint64_t offset)
+{
+ unsigned int phys_block_size = 0;
+ unsigned int block_size = 0;
+
+ dev_get_block_size(dev, &phys_block_size, &block_size);
+
+ bcache_set_last_byte(scan_bcache, dev->bcache_fd, offset, phys_block_size);
+}
+
+void dev_unset_last_byte(struct device *dev)
+{
+ bcache_unset_last_byte(scan_bcache, dev->bcache_fd);
+}
+
diff --git a/lib/label/label.h b/lib/label/label.h
index 5b83bc734..ae6a4f5f4 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -126,5 +126,7 @@ bool dev_read_bytes(struct device *dev, uint64_t start, size_t len, void *data);
bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data);
bool dev_write_zeros(struct device *dev, uint64_t start, size_t len);
bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val);
+void dev_set_last_byte(struct device *dev, uint64_t offset);
+void dev_unset_last_byte(struct device *dev);
#endif
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index c7d8a9e94..b1dcaa0e2 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -302,10 +302,14 @@ static int _write_log_header(struct cmd_context *cmd, struct logical_volume *lv)
return 0;
}
+ dev_set_last_byte(dev, sizeof(log_header));
+
if (!dev_write_bytes(dev, UINT64_C(0), sizeof(log_header), &log_header)) {
+ dev_unset_last_byte(dev);
log_error("Failed to write log header to %s.", name);
return 0;
}
+ dev_unset_last_byte(dev);
label_scan_invalidate(dev);
--
2.12.3

View File

@ -1,31 +0,0 @@
From 559cf0cd1e226baf63a98c39572264fbf5c3f6b4 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 23 Apr 2019 09:39:42 -0500
Subject: [PATCH] devices: drop open error message
This open error is being printed in more common,
non-error circumstances than expected. After a
number of complaints make it only a debug message.
---
lib/device/dev-io.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 2a83a9657..6996a44dc 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -572,10 +572,7 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
}
}
#endif
- if (quiet)
- log_sys_debug("open", name);
- else
- log_sys_error("open", name);
+ log_sys_debug("open", name);
dev->flags |= DEV_OPEN_FAILURE;
return 0;
--
2.21.0

View File

@ -1,71 +0,0 @@
From adf9bf80a32500b45b37eb24b98fa7c2c933019e Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 5 Jun 2019 14:31:34 +0200
Subject: [PATCH] cache: support no_discard_passdown
Recent kernel version from kernel commit:
de7180ff908b2bc0342e832dbdaa9a5f1ecaa33a
started to report in cache status line new flag:
no_discard_passdown
Whenever lvm spots unknown status it reports:
Unknown feature in status:
So add reconginzing this feature flag and also report this with
'lvs -o+kernel_discards'
When no_discard_passdown is found in status 'nopassdown' gets reported
for this field (roughly matching what we report for thin-pools).
---
WHATS_NEW | 1 +
WHATS_NEW_DM | 1 +
lib/metadata/lv.c | 5 +++++
libdm/libdevmapper.h | 1 +
libdm/libdm-targets.c | 2 ++
5 files changed, 10 insertions(+)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 2abe42db7..538b292a2 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -245,6 +245,11 @@ char *lvseg_kernel_discards_dup_with_info_and_seg_status(struct dm_pool *mem, co
return 0;
}
s = get_pool_discards_name(d);
+ } else if (lvdm->seg_status.type == SEG_STATUS_CACHE) {
+ if (lvdm->seg_status.cache->feature_flags &
+ DM_CACHE_FEATURE_NO_DISCARD_PASSDOWN) {
+ s = "nopassdown";
+ }
}
if (!(ret = dm_pool_strdup(mem, s))) {
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 19032d775..e885f52ae 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1893,6 +1893,7 @@ int dm_tree_node_add_raid_target_with_params_v2(struct dm_tree_node *node,
#define DM_CACHE_FEATURE_WRITETHROUGH 0x00000002
#define DM_CACHE_FEATURE_PASSTHROUGH 0x00000004
#define DM_CACHE_FEATURE_METADATA2 0x00000008 /* cache v1.10 */
+#define DM_CACHE_FEATURE_NO_DISCARD_PASSDOWN 0x00000010
struct dm_config_node;
/*
diff --git a/libdm/libdm-targets.c b/libdm/libdm-targets.c
index 876678943..d0a8b4332 100644
--- a/libdm/libdm-targets.c
+++ b/libdm/libdm-targets.c
@@ -296,6 +296,8 @@ int dm_get_status_cache(struct dm_pool *mem, const char *params,
s->feature_flags |= DM_CACHE_FEATURE_PASSTHROUGH;
else if (!strncmp(p, "metadata2 ", 10))
s->feature_flags |= DM_CACHE_FEATURE_METADATA2;
+ else if (!strncmp(p, "no_discard_passdown ", 20))
+ s->feature_flags |= DM_CACHE_FEATURE_NO_DISCARD_PASSDOWN;
else
log_error("Unknown feature in status: %s", params);
--
2.12.3

View File

@ -1,35 +0,0 @@
From b13ebfa4c289a5bc6eb4f8ba26126db8e6d78296 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 26 Jun 2019 16:03:42 -0500
Subject: [PATCH] pvremove/vgextend: fix using device aliases with lvmetad
These commands were looking for the requested device alias
before dev_cache_scan had created the list of devs on the
system, so they would fail and report the dev wasn't found.
---
tools/toollib.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/toollib.c b/tools/toollib.c
index 3221e5f1ca..1b01cccfa2 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5543,6 +5543,15 @@ int pvcreate_each_device(struct cmd_context *cmd,
lvmcache_label_scan(cmd);
+ /*
+ * When using lvmetad, we want to do a dev cache scan here (if not done
+ * already) so that the dev_cache_get just below will be able to find
+ * device aliases. When not using lvmetad, the label_scan just above
+ * has done dev_cache_scan, and this will not be run.
+ */
+ if (!dev_cache_has_scanned())
+ dev_cache_scan();
+
/*
* Translate arg names into struct device's.
*/
--
2.21.0

View File

@ -1,220 +0,0 @@
From c527a0cbfc391645d30407d2dc4a30275c6472f1 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 27 Aug 2018 11:15:35 -0500
Subject: [PATCH] lvmetad: improve scan for pvscan all
For 'pvscan --cache' avoid using dev_iter in the loop
after the label_scan by passing the necessary devs back
from the label_scan for the continued pvscan.
The dev_iter functions reapply the filters which will
trigger more io when we don't need or want it. With
many devs, incidental opens from the filters (not controlled
by the label scan) can lead to too many open files.
---
lib/cache/lvmetad.c | 34 ++++++++++++-------------
lib/label/label.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/label/label.h | 1 +
3 files changed, 91 insertions(+), 17 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index a1ab41aab..acbb52e54 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -2322,8 +2322,8 @@ bad:
int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
{
- struct dev_iter *iter;
- struct device *dev;
+ struct device_list *devl, *devl2;
+ struct dm_list scan_devs;
daemon_reply reply;
char *future_token;
const char *reason;
@@ -2339,6 +2339,8 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
}
retry:
+ dm_list_init(&scan_devs);
+
/*
* If another update is in progress, delay to allow it to finish,
* rather than interrupting it with our own update.
@@ -2348,7 +2350,7 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
replacing_other_update = 1;
}
- label_scan(cmd);
+ label_scan_pvscan_all(cmd, &scan_devs);
lvmcache_pvscan_duplicate_check(cmd);
@@ -2357,19 +2359,14 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
return 0;
}
- log_verbose("Scanning all devices to update lvmetad.");
-
- if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) {
- log_error("dev_iter creation failed");
- return 0;
- }
+ log_verbose("Scanning metadata from %d devices to update lvmetad.",
+ dm_list_size(&scan_devs));
future_token = _lvmetad_token;
_lvmetad_token = (char *) LVMETAD_TOKEN_UPDATE_IN_PROGRESS;
if (!_token_update(&replaced_update)) {
log_error("Failed to update lvmetad which had an update in progress.");
- dev_iter_destroy(iter);
_lvmetad_token = future_token;
return 0;
}
@@ -2385,12 +2382,10 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
if (do_wait && !retries) {
retries = 1;
log_warn("WARNING: lvmetad update in progress, retrying update.");
- dev_iter_destroy(iter);
_lvmetad_token = future_token;
goto retry;
}
log_warn("WARNING: lvmetad update in progress, skipping update.");
- dev_iter_destroy(iter);
_lvmetad_token = future_token;
return 0;
}
@@ -2404,15 +2399,22 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
was_silent = silent_mode();
init_silent(1);
- while ((dev = dev_iter_get(iter))) {
+ dm_list_iterate_items_safe(devl, devl2, &scan_devs) {
if (sigint_caught()) {
ret = 0;
stack;
break;
}
- if (!lvmetad_pvscan_single(cmd, dev, NULL, NULL)) {
- ret = 0;
+ dm_list_del(&devl->list);
+
+ ret = lvmetad_pvscan_single(cmd, devl->dev, NULL, NULL);
+
+ label_scan_invalidate(devl->dev);
+
+ dm_free(devl);
+
+ if (!ret) {
stack;
break;
}
@@ -2420,8 +2422,6 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
init_silent(was_silent);
- dev_iter_destroy(iter);
-
_lvmetad_token = future_token;
/*
diff --git a/lib/label/label.c b/lib/label/label.c
index bafa54366..837033c4b 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -876,6 +876,79 @@ int label_scan(struct cmd_context *cmd)
return 1;
}
+int label_scan_pvscan_all(struct cmd_context *cmd, struct dm_list *scan_devs)
+{
+ struct dm_list all_devs;
+ struct dev_iter *iter;
+ struct device_list *devl, *devl2;
+ struct device *dev;
+
+ log_debug_devs("Finding devices to scan");
+
+ dm_list_init(&all_devs);
+
+ /*
+ * Iterate through all the devices in dev-cache (block devs that appear
+ * under /dev that could possibly hold a PV and are not excluded by
+ * filters). Read each to see if it's an lvm device, and if so
+ * populate lvmcache with some basic info about the device and the VG
+ * on it. This info will be used by the vg_read() phase of the
+ * command.
+ */
+ dev_cache_scan();
+
+ if (!(iter = dev_iter_create(cmd->lvmetad_filter, 0))) {
+ log_error("Scanning failed to get devices.");
+ return 0;
+ }
+
+ while ((dev = dev_iter_get(iter))) {
+ if (!(devl = dm_zalloc(sizeof(*devl))))
+ return 0;
+ devl->dev = dev;
+ dm_list_add(&all_devs, &devl->list);
+
+ /*
+ * label_scan should not generally be called a second time,
+ * so this will usually not be true.
+ */
+ if (_in_bcache(dev)) {
+ bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
+ _scan_dev_close(dev);
+ }
+ };
+ dev_iter_destroy(iter);
+
+ log_debug_devs("Found %d devices to scan", dm_list_size(&all_devs));
+
+ if (!scan_bcache) {
+ if (!_setup_bcache(dm_list_size(&all_devs)))
+ return 0;
+ }
+
+ _scan_list(cmd, cmd->lvmetad_filter, &all_devs, NULL);
+
+ dm_list_iterate_items_safe(devl, devl2, &all_devs) {
+ dm_list_del(&devl->list);
+
+ /*
+ * If this device is lvm's then, return it to pvscan
+ * to do the further pvscan. (We could have _scan_list
+ * just set a result in devl indicating the result, but
+ * instead we're just checking indirectly if _scan_list
+ * saved lvmcache info for the dev which also means it's
+ * an lvm device.)
+ */
+
+ if (lvmcache_has_dev_info(devl->dev))
+ dm_list_add(scan_devs, &devl->list);
+ else
+ dm_free(devl);
+ }
+
+ return 1;
+}
+
/*
* Scan and cache lvm data from the listed devices. If a device is already
* scanned and cached, this replaces the previously cached lvm data for the
diff --git a/lib/label/label.h b/lib/label/label.h
index 5ed8bc86b..5b83bc734 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -116,6 +116,7 @@ void label_scan_confirm(struct device *dev);
int label_scan_setup_bcache(void);
int label_scan_open(struct device *dev);
int label_scan_open_excl(struct device *dev);
+int label_scan_pvscan_all(struct cmd_context *cmd, struct dm_list *scan_devs);
/*
* Wrappers around bcache equivalents.
--
2.12.3

View File

@ -1,65 +0,0 @@
From a01e1fec0fe7c2fa61577c0e636e907cde7279ea Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 29 Nov 2018 14:06:20 -0600
Subject: [PATCH] pvscan lvmetad: use full md filter when md 1.0 devices are
present
Apply the same logic to pvscan/lvmetad that was added to
the non-lvmetad label_scan in commit 3fd75d1b:
scan: use full md filter when md 1.0 devices are present
Before scanning, check if any of the devs on the system are
md 0.90/1.0, and if so make the scan read both the start and
the end of the device so that the components of those md
versions can be ignored.
---
tools/pvscan.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 2915db599..3755684d2 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -18,6 +18,8 @@
#include "lvmetad.h"
#include "lvmcache.h"
+extern int use_full_md_check;
+
struct pvscan_params {
int new_pvs_found;
int pvs_found;
@@ -302,6 +304,7 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
struct dm_list found_vgnames;
struct device *dev;
struct device_list *devl;
+ struct dev_iter *iter;
const char *pv_name;
const char *reason = NULL;
int32_t major = -1;
@@ -443,6 +446,22 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
/* Creates a list of dev names from /dev, sysfs, etc; does not read any. */
dev_cache_scan();
+ /* See the same check in label_scan() to handle md 0.9/1.0 components. */
+ if (!(iter = dev_iter_create(cmd->full_filter, 0))) {
+ log_error("Scanning failed to get devices.");
+ return 0;
+ }
+ while ((dev = dev_iter_get(iter))) {
+ if (dev_is_md_with_end_superblock(cmd->dev_types, dev)) {
+ cmd->use_full_md_check = 1;
+ use_full_md_check = 1;
+ log_debug("Found md with end superblock %s", dev_name(dev));
+ }
+ }
+ dev_iter_destroy(iter);
+ if (!use_full_md_check)
+ log_debug("No md devs with end superblock");
+
dm_list_init(&single_devs);
while (argc--) {
--
2.12.3

View File

@ -1,215 +0,0 @@
From a188b1e513ed5ca0f5f3702c823490f5610d4495 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Fri, 30 Nov 2018 16:32:32 -0600
Subject: [PATCH] pvscan lvmetad: use udev info to improve md component
detection
When no md devs are started, pvscan will only scan the start of
an md component, and if it has a superblock at the end may not
exclude it. udev may already have info identifying it as an
md component, so use that.
---
lib/device/dev-md.c | 14 ++++++++++--
lib/device/dev-type.c | 62 +++++++++++++++++++++++++++++++++++++++++----------
lib/device/dev-type.h | 1 +
lib/label/label.c | 6 +++++
tools/pvscan.c | 3 ++-
5 files changed, 71 insertions(+), 15 deletions(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 185499baf..972850726 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -190,14 +190,24 @@ out:
int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
{
+ int ret;
/*
* If non-native device status source is selected, use it
* only if offset_found is not requested as this
* information is not in udev db.
*/
- if ((dev->ext.src == DEV_EXT_NONE) || offset_found)
- return _native_dev_is_md(dev, offset_found, full);
+ if ((dev->ext.src == DEV_EXT_NONE) || offset_found) {
+ ret = _native_dev_is_md(dev, offset_found, full);
+
+ if (!full) {
+ if (!ret || (ret == -EAGAIN)) {
+ if (udev_dev_is_md_component(dev))
+ return 1;
+ }
+ }
+ return ret;
+ }
if (dev->ext.src == DEV_EXT_UDEV)
return _udev_dev_is_md(dev);
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index af4b40760..33ebb73b2 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -1004,25 +1004,23 @@ int dev_is_rotational(struct dev_types *dt, struct device *dev)
* failed already due to timeout in udev - in both cases the
* udev_device_get_is_initialized returns 0.
*/
-#define UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT 100
-#define UDEV_DEV_IS_MPATH_COMPONENT_USLEEP 100000
+#define UDEV_DEV_IS_COMPONENT_ITERATION_COUNT 100
+#define UDEV_DEV_IS_COMPONENT_USLEEP 100000
-int udev_dev_is_mpath_component(struct device *dev)
+static struct udev_device *_udev_get_dev(struct device *dev)
{
struct udev *udev_context = udev_get_library_context();
struct udev_device *udev_device = NULL;
- const char *value;
int initialized = 0;
unsigned i = 0;
- int ret = 0;
if (!udev_context) {
log_warn("WARNING: No udev context available to check if device %s is multipath component.", dev_name(dev));
- return 0;
+ return NULL;
}
while (1) {
- if (i >= UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT)
+ if (i >= UDEV_DEV_IS_COMPONENT_ITERATION_COUNT)
break;
if (udev_device)
@@ -1030,7 +1028,7 @@ int udev_dev_is_mpath_component(struct device *dev)
if (!(udev_device = udev_device_new_from_devnum(udev_context, 'b', dev->dev))) {
log_warn("WARNING: Failed to get udev device handler for device %s.", dev_name(dev));
- return 0;
+ return NULL;
}
#ifdef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
@@ -1042,19 +1040,32 @@ int udev_dev_is_mpath_component(struct device *dev)
#endif
log_debug("Device %s not initialized in udev database (%u/%u, %u microseconds).", dev_name(dev),
- i + 1, UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT,
- i * UDEV_DEV_IS_MPATH_COMPONENT_USLEEP);
+ i + 1, UDEV_DEV_IS_COMPONENT_ITERATION_COUNT,
+ i * UDEV_DEV_IS_COMPONENT_USLEEP);
- usleep(UDEV_DEV_IS_MPATH_COMPONENT_USLEEP);
+ usleep(UDEV_DEV_IS_COMPONENT_USLEEP);
i++;
}
if (!initialized) {
log_warn("WARNING: Device %s not initialized in udev database even after waiting %u microseconds.",
- dev_name(dev), i * UDEV_DEV_IS_MPATH_COMPONENT_USLEEP);
+ dev_name(dev), i * UDEV_DEV_IS_COMPONENT_USLEEP);
goto out;
}
+out:
+ return udev_device;
+}
+
+int udev_dev_is_mpath_component(struct device *dev)
+{
+ struct udev_device *udev_device;
+ const char *value;
+ int ret = 0;
+
+ if (!(udev_device = _udev_get_dev(dev)))
+ return 0;
+
value = udev_device_get_property_value(udev_device, DEV_EXT_UDEV_BLKID_TYPE);
if (value && !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_MPATH)) {
log_debug("Device %s is multipath component based on blkid variable in udev db (%s=\"%s\").",
@@ -1074,6 +1085,28 @@ out:
udev_device_unref(udev_device);
return ret;
}
+
+int udev_dev_is_md_component(struct device *dev)
+{
+ struct udev_device *udev_device;
+ const char *value;
+ int ret = 0;
+
+ if (!(udev_device = _udev_get_dev(dev)))
+ return 0;
+
+ value = udev_device_get_property_value(udev_device, DEV_EXT_UDEV_BLKID_TYPE);
+ if (value && !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID)) {
+ log_debug("Device %s is md raid component based on blkid variable in udev db (%s=\"%s\").",
+ dev_name(dev), DEV_EXT_UDEV_BLKID_TYPE, value);
+ ret = 1;
+ goto out;
+ }
+out:
+ udev_device_unref(udev_device);
+ return ret;
+}
+
#else
int udev_dev_is_mpath_component(struct device *dev)
@@ -1081,4 +1114,9 @@ int udev_dev_is_mpath_component(struct device *dev)
return 0;
}
+int udev_dev_is_md_component(struct device *dev)
+{
+ return 0;
+}
+
#endif
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index f629a0278..264438339 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -62,6 +62,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature, int full);
int dev_is_luks(struct device *dev, uint64_t *signature, int full);
int dasd_is_cdl_formatted(struct device *dev);
int udev_dev_is_mpath_component(struct device *dev);
+int udev_dev_is_md_component(struct device *dev);
int dev_is_lvm1(struct device *dev, char *buf, int buflen);
int dev_is_pool(struct device *dev, char *buf, int buflen);
diff --git a/lib/label/label.c b/lib/label/label.c
index b26ff3370..e01608d2c 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -957,6 +957,12 @@ int label_scan_pvscan_all(struct cmd_context *cmd, struct dm_list *scan_devs)
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
_scan_dev_close(dev);
}
+
+ if (dev_is_md_with_end_superblock(cmd->dev_types, dev)) {
+ cmd->use_full_md_check = 1;
+ use_full_md_check = 1;
+ log_debug("Found md component in sysfs with end superblock %s", dev_name(dev));
+ }
};
dev_iter_destroy(iter);
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 3755684d2..877b6b2db 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -455,7 +455,8 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
if (dev_is_md_with_end_superblock(cmd->dev_types, dev)) {
cmd->use_full_md_check = 1;
use_full_md_check = 1;
- log_debug("Found md with end superblock %s", dev_name(dev));
+ log_debug("Found md component in sysfs with end superblock %s", dev_name(dev));
+ break;
}
}
dev_iter_destroy(iter);
--
2.12.3

View File

@ -1,136 +0,0 @@
From e7bb50880901a4462e350ce0d272a63aa8440781 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 18 Oct 2018 11:32:32 -0500
Subject: [PATCH] scan: enable full md filter when md 1.0 devices are present
The previous commit de2863739f2ea17d89d0e442379109f967b5919d
scan: use full md filter when md 1.0 devices are present
needs the use_full_md_check flag in the md filter, but
the cmd struct is not available when the filter is run,
so that commit wasn't working. Fix this by setting the
flag in a global variable.
(This was fixed in the master branch with commit 8eab37593
in which the cmd struct was passed to the filters, but it
was an intrusive change, so this commit is using the less
intrusive global variable.)
---
lib/filters/filter-md.c | 33 +++++++--------------------------
lib/label/label.c | 13 ++++++++++++-
2 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index ad5b8e4e8..e03ff5059 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -16,6 +16,9 @@
#include "lib.h"
#include "filter.h"
+/* See label.c comment about this hack. */
+extern int use_full_md_check;
+
#ifdef __linux__
#define MSG_SKIPPING "%s: Skipping md component device"
@@ -80,7 +83,7 @@
* that will not pass.
*/
-static int _passes_md_filter(struct device *dev, int full)
+static int _passes_md_filter(struct dev_filter *f, struct device *dev)
{
int ret;
@@ -91,7 +94,7 @@ static int _passes_md_filter(struct device *dev, int full)
if (!md_filtering())
return 1;
- ret = dev_is_md(dev, NULL, full);
+ ret = dev_is_md(dev, NULL, use_full_md_check);
if (ret == -EAGAIN) {
/* let pass, call again after scan */
@@ -104,6 +107,7 @@ static int _passes_md_filter(struct device *dev, int full)
return 1;
if (ret == 1) {
+ log_debug_devs("md filter full %d excluding md component %s", use_full_md_check, dev_name(dev));
if (dev->ext.src == DEV_EXT_NONE)
log_debug_devs(MSG_SKIPPING, dev_name(dev));
else
@@ -121,18 +125,6 @@ static int _passes_md_filter(struct device *dev, int full)
return 1;
}
-static int _passes_md_filter_lite(struct dev_filter *f __attribute__((unused)),
- struct device *dev)
-{
- return _passes_md_filter(dev, 0);
-}
-
-static int _passes_md_filter_full(struct dev_filter *f __attribute__((unused)),
- struct device *dev)
-{
- return _passes_md_filter(dev, 1);
-}
-
static void _destroy(struct dev_filter *f)
{
if (f->use_count)
@@ -150,18 +142,7 @@ struct dev_filter *md_filter_create(struct cmd_context *cmd, struct dev_types *d
return NULL;
}
- /*
- * FIXME: for commands that want a full md check (pvcreate, vgcreate,
- * vgextend), we do an extra read at the end of every device that the
- * filter looks at. This isn't necessary; we only need to do the full
- * md check on the PVs that these commands are trying to use.
- */
-
- if (cmd->use_full_md_check)
- f->passes_filter = _passes_md_filter_full;
- else
- f->passes_filter = _passes_md_filter_lite;
-
+ f->passes_filter = _passes_md_filter;
f->destroy = _destroy;
f->use_count = 0;
f->private = dt;
diff --git a/lib/label/label.c b/lib/label/label.c
index e76ddd4b2..e5aa2c129 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <sys/time.h>
+int use_full_md_check;
/* FIXME Allow for larger labels? Restricted to single sector currently */
@@ -868,8 +869,18 @@ int label_scan(struct cmd_context *cmd)
* devs in 'pvs', which is a pretty harmless effect from a
* pretty uncommon situation.
*/
- if (dev_is_md_with_end_superblock(cmd->dev_types, dev))
+ if (dev_is_md_with_end_superblock(cmd->dev_types, dev)) {
cmd->use_full_md_check = 1;
+
+ /* This is a hack because 'cmd' is not passed
+ into the filters so we can't check the flag
+ in the cmd struct. The master branch has
+ changed the filters in commit 8eab37593eccb
+ to accept cmd, but it's a complex change
+ that I'm trying to avoid in the stable branch. */
+
+ use_full_md_check = 1;
+ }
};
dev_iter_destroy(iter);
--
2.12.3

View File

@ -1,59 +0,0 @@
From 0e42ebd6d4012d210084a9ccf8d76f853726de3c Mon Sep 17 00:00:00 2001
From: Peter Rajnoha <prajnoha@redhat.com>
Date: Thu, 29 Nov 2018 11:51:05 -0600
Subject: [PATCH] scan: md metadata version 0.90 is at the end of disk
commit de28637
scan: use full md filter when md 1.0 devices are present
missed the fact that md superblock version 0.90 also puts
metadata at the end of the device, so the full md filter
needs to be used when either 0.90 or 1.0 is present.
---
lib/device/dev-md.c | 2 +-
lib/filters/filter-md.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 7196dc007..185499baf 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -422,7 +422,7 @@ int dev_is_md_with_end_superblock(struct dev_types *dt, struct device *dev)
log_very_verbose("Device %s %s is %s.",
dev_name(dev), attribute, version_string);
- if (!strcmp(version_string, "1.0"))
+ if (!strcmp(version_string, "1.0") || !strcmp(version_string, "0.90"))
return 1;
return 0;
}
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index e03ff5059..2011e1d5a 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -47,7 +47,7 @@ extern int use_full_md_check;
* 3. use udev to detect components
*
* mode 1 will not detect and exclude components of md devices
- * that use superblock version 1.0 which is at the end of the device.
+ * that use superblock version 0.9 or 1.0 which is at the end of the device.
*
* mode 2 will detect these, but mode 2 doubles the i/o done by label
* scan, since there's a read at both the start and end of every device.
@@ -60,11 +60,11 @@ extern int use_full_md_check;
*
* - the command is pvcreate/vgcreate/vgextend, which format new
* devices, and if the user ran these commands on a component
- * device of an md device 1.0, then it would cause problems.
+ * device of an md device 0.9 or 1.0, then it would cause problems.
* FIXME: this would only really need to scan the end of the
* devices being formatted, not all devices.
*
- * - it sees an md device on the system using version 1.0.
+ * - it sees an md device on the system using version 0.9 or 1.0.
* The point of this is just to avoid displaying md components
* from the 'pvs' command.
* FIXME: the cost (double i/o) may not be worth the benefit
--
2.12.3

View File

@ -1,228 +0,0 @@
From de2863739f2ea17d89d0e442379109f967b5919d Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Fri, 15 Jun 2018 11:42:10 -0500
Subject: [PATCH] scan: use full md filter when md 1.0 devices are present
The md filter can operate in two native modes:
- normal: reads only the start of each device
- full: reads both the start and end of each device
md 1.0 devices place the superblock at the end of the device,
so components of this version will only be identified and
excluded when lvm uses the full md filter.
Previously, the full md filter was only used in commands
that could write to the device. Now, the full md filter
is also applied when there is an md 1.0 device present
on the system. This means the 'pvs' command can avoid
displaying md 1.0 components (at the cost of doubling
the i/o to every device on the system.)
(The md filter can operate in a third mode, using udev,
but this is disabled by default because there have been
problems with reliability of the info returned from udev.)
---
lib/cache/lvmcache.c | 2 +-
lib/device/dev-md.c | 27 ++++++++++----
lib/device/dev-type.h | 1 +
lib/filters/filter-md.c | 74 +++++++++++++++++++-------------------
lib/label/label.c | 14 ++++++++
test/shell/pvcreate-md-fake-hdr.sh | 3 +-
6 files changed, 75 insertions(+), 46 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 3e681a2ba..a2ee0cd43 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -998,7 +998,7 @@ int lvmcache_dev_is_unchosen_duplicate(struct device *dev)
* unused_duplicate_devs list, and restrict what we allow done with it.
*
* In the case of md components, we usually filter these out in filter-md,
- * but in the special case of md superblocks <= 1.0 where the superblock
+ * but in the special case of md superblock version 1.0 where the superblock
* is at the end of the device, filter-md doesn't always eliminate them
* first, so we eliminate them here.
*
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index f5a736fc2..7196dc007 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -142,13 +142,6 @@ static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int ful
* command if it should do a full check (cmd->use_full_md_check),
* and set it for commands that could possibly write to an md dev
* (pvcreate/vgcreate/vgextend).
- *
- * For old md versions with magic numbers at the end of devices,
- * the md dev components won't be filtered out here when full is 0,
- * so they will be scanned, and appear as duplicate PVs in lvmcache.
- * The md device itself will be chosen as the primary duplicate,
- * and the components are dropped from the list of duplicates in,
- * i.e. a kind of post-scan filtering.
*/
if (!full) {
sb_offset = 0;
@@ -414,6 +407,26 @@ unsigned long dev_md_stripe_width(struct dev_types *dt, struct device *dev)
return stripe_width_sectors;
}
+int dev_is_md_with_end_superblock(struct dev_types *dt, struct device *dev)
+{
+ char version_string[MD_MAX_SYSFS_SIZE];
+ const char *attribute = "metadata_version";
+
+ if (MAJOR(dev->dev) != dt->md_major)
+ return 0;
+
+ if (_md_sysfs_attribute_scanf(dt, dev, attribute,
+ "%s", &version_string) != 1)
+ return -1;
+
+ log_very_verbose("Device %s %s is %s.",
+ dev_name(dev), attribute, version_string);
+
+ if (!strcmp(version_string, "1.0"))
+ return 1;
+ return 0;
+}
+
#else
int dev_is_md(struct device *dev __attribute__((unused)),
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index 843e2545b..f629a0278 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -76,6 +76,7 @@ int wipe_known_signatures(struct cmd_context *cmd, struct device *dev, const cha
/* Type-specific device properties */
unsigned long dev_md_stripe_width(struct dev_types *dt, struct device *dev);
+int dev_is_md_with_end_superblock(struct dev_types *dt, struct device *dev);
/* Partitioning */
int major_max_partitions(struct dev_types *dt, int major);
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index ab97b5946..ad5b8e4e8 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -29,43 +29,43 @@
*
* (This is assuming lvm.conf md_component_detection=1.)
*
- * If lvm does *not* ignore the components, then lvm will read lvm
- * labels from the md dev and from the component devs, and will see
- * them all as duplicates of each other. LVM duplicate resolution
- * will then kick in and keep the md dev around to use and ignore
- * the components.
- *
- * It is better to exclude the components as early as possible during
- * lvm processing, ideally before lvm even looks for labels on the
- * components, so that duplicate resolution can be avoided. There are
- * a number of ways that md components can be excluded earlier than
- * the duplicate resolution phase:
- *
- * - When external_device_info_source="udev", lvm discovers a device is
- * an md component by asking udev during the initial filtering phase.
- * However, lvm's default is to not use udev for this. The
- * alternative is "native" detection in which lvm tries to detect
- * md components itself.
- *
- * - When using native detection, lvm's md filter looks for the md
- * superblock at the start of devices. It will see the md superblock
- * on the components, exclude them in the md filter, and avoid
- * handling them later in duplicate resolution.
- *
- * - When using native detection, lvm's md filter will not detect
- * components when the md device has an older superblock version that
- * places the superblock at the end of the device. This case will
- * fall back to duplicate resolution to exclude components.
- *
- * A variation of the description above occurs for lvm commands that
- * intend to create new PVs on devices (pvcreate, vgcreate, vgextend).
- * For these commands, the native md filter also reads the end of all
- * devices to check for the odd md superblocks.
- *
- * (The reason that external_device_info_source is not set to udev by
- * default is that there have be issues with udev not being promptly
- * or reliably updated about md state changes, causing the udev info
- * that lvm uses to be occasionally wrong.)
+ * If lvm does *not* ignore the components, then lvm may read lvm
+ * labels from the component devs and potentially the md dev,
+ * which can trigger duplicate detection, and/or cause lvm to display
+ * md components as PVs rather than ignoring them.
+ *
+ * If scanning md componenents causes duplicates to be seen, then
+ * the lvm duplicate resolution will exclude the components.
+ *
+ * The lvm md filter has three modes:
+ *
+ * 1. look for md superblock at the start of the device
+ * 2. look for md superblock at the start and end of the device
+ * 3. use udev to detect components
+ *
+ * mode 1 will not detect and exclude components of md devices
+ * that use superblock version 1.0 which is at the end of the device.
+ *
+ * mode 2 will detect these, but mode 2 doubles the i/o done by label
+ * scan, since there's a read at both the start and end of every device.
+ *
+ * mode 3 is used when external_device_info_source="udev". It does
+ * not require any io from lvm, but this mode is not used by default
+ * because there have been problems getting reliable info from udev.
+ *
+ * lvm uses mode 2 when:
+ *
+ * - the command is pvcreate/vgcreate/vgextend, which format new
+ * devices, and if the user ran these commands on a component
+ * device of an md device 1.0, then it would cause problems.
+ * FIXME: this would only really need to scan the end of the
+ * devices being formatted, not all devices.
+ *
+ * - it sees an md device on the system using version 1.0.
+ * The point of this is just to avoid displaying md components
+ * from the 'pvs' command.
+ * FIXME: the cost (double i/o) may not be worth the benefit
+ * (not showing md components).
*/
/*
diff --git a/lib/label/label.c b/lib/label/label.c
index 837033c4b..e76ddd4b2 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -856,6 +856,20 @@ int label_scan(struct cmd_context *cmd)
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
_scan_dev_close(dev);
}
+
+ /*
+ * When md devices exist that use the old superblock at the
+ * end of the device, then in order to detect and filter out
+ * the component devices of those md devs, we need to enable
+ * the full md filter which scans both the start and the end
+ * of every device. This doubles the amount of scanning i/o,
+ * which we want to avoid. FIXME: it may not be worth the
+ * cost of double i/o just to avoid displaying md component
+ * devs in 'pvs', which is a pretty harmless effect from a
+ * pretty uncommon situation.
+ */
+ if (dev_is_md_with_end_superblock(cmd->dev_types, dev))
+ cmd->use_full_md_check = 1;
};
dev_iter_destroy(iter);
diff --git a/test/shell/pvcreate-md-fake-hdr.sh b/test/shell/pvcreate-md-fake-hdr.sh
index b89fe4377..4c9ac7cbc 100644
--- a/test/shell/pvcreate-md-fake-hdr.sh
+++ b/test/shell/pvcreate-md-fake-hdr.sh
@@ -89,6 +89,7 @@ sleep 1
# (when mdadm supports repair)
if mdadm --action=repair "$mddev" ; then
sleep 1
+ pvscan -vvvv
# should be showing correctly PV3 & PV4
- pvs
+ pvs -vvvv "$dev3" "$dev4"
fi
--
2.12.3

View File

@ -1,27 +0,0 @@
From 0da043466ace27eb483114c87ce81feaf00ed682 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Thu, 6 Apr 2017 11:22:30 +0800
Subject: [PATCH] systemd service: make pvscan service after multipathd
bsc#998893
Signed-off-by: Eric Ren <zren@suse.com>
---
scripts/lvm2_pvscan_systemd_red_hat@.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
index 03651d5..1d6342f 100644
--- a/scripts/lvm2_pvscan_systemd_red_hat@.service.in
+++ b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
@@ -4,7 +4,7 @@ Documentation=man:pvscan(8)
StartLimitInterval=0
BindsTo=dev-block-%i.device
Requires=lvm2-lvmetad.socket
-After=lvm2-lvmetad.socket lvm2-lvmetad.service
+After=lvm2-lvmetad.socket lvm2-lvmetad.service multipathd.service
Before=shutdown.target
Conflicts=shutdown.target
--
2.10.2

File diff suppressed because it is too large Load Diff

View File

@ -1,255 +0,0 @@
#
# spec file for package device-mapper
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define libname libdevmapper1_03
%define libname_event libdevmapper-event1_03
### COMMON-DEF-BEGIN ###
%define lvm2_version 2.02.180
%define device_mapper_version 1.02.149
%define thin_provisioning_version 0.7.0
### COMMON-DEF-END ###
Name: device-mapper
Version: %{device_mapper_version}
Release: 0
Summary: Device Mapper Tools
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Base
Url: http://www.sourceware.org/lvm2/
Source: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz
Source1: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz.asc
Source99: baselibs.conf
# To detect modprobe during build
BuildRequires: gcc-c++
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: pkgconfig
BuildRequires: suse-module-tools
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(libsepol)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(systemd)
Requires: thin-provisioning-tools >= %{thin_provisioning_version}
Requires(post): coreutils
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
### COMMON-PATCH-BEGIN ###
# Upstream patches
Patch0001: bug-1145231_lvmetad-improve-scan-for-pvscan-all.patch
Patch0002: bug-1145231_scan-use-full-md-filter-when-md-1.0-devices-are-pres.patch
Patch0003: bug-1145231_scan-enable-full-md-filter-when-md-1.0-devices-are-p.patch
Patch0004: bug-1114113_metadata-prevent-writing-beyond-metadata-area.patch
Patch0005: bug-1145231_scan-md-metadata-version-0.90-is-at-the-end-of-disk.patch
Patch0006: bug-1145231_pvscan-lvmetad-use-full-md-filter-when-md-1.0-device.patch
Patch0007: bug-1145231_pvscan-lvmetad-use-udev-info-to-improve-md-component.patch
Patch0008: bug-1122666_devices-drop-open-error-message.patch
Patch0009: bug-1137296_pvremove-vgextend-fix-using-device-aliases-with-lvmetad.patch
Patch0010: bug-1135984_cache-support-no_discard_passdown.patch
# SUSE patches: 1000+ for LVM
# Never upstream
Patch1001: cmirrord_remove_date_time_from_compilation.patch
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1005: bsc1080299-detect-clvm-properly.patch
Patch1006: bug-998893_make_pvscan_service_after_multipathd.patch
#SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
### COMMON-PATCH-END ###
%description
Programs and man pages for configuring and using the device mapper.
%prep
%setup -q -n LVM2.%{lvm2_version}
### COMMON-PREP-BEGIN ###
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2001 -p1
### COMMON-PREP-END ###
%build
extra_opts=""
### COMMON-CONFIG-BEGIN ###
export PATH=$PATH:/sbin:%{_prefix}/sbin
# Why this messy fix here? someone released a wrong version...
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
%configure \
--enable-dmeventd \
--enable-cmdlib \
--enable-udev_rules \
--enable-udev_sync \
--with-udev-prefix="%{_prefix}/" \
--enable-selinux \
--enable-pkgconfig \
--with-usrlibdir=%{_libdir} \
--with-usrsbindir=%{_sbindir} \
--with-default-dm-run-dir=/run \
--with-tmpfilesdir=%{_tmpfilesdir} \
--with-thin=internal \
--with-device-gid=6 \
--with-device-mode=0640 \
--with-device-uid=0 \
--with-dmeventd-path=%{_sbindir}/dmeventd \
--with-thin-check=%{_sbindir}/thin_check \
--with-thin-dump=%{_sbindir}/thin_dump \
--with-thin-repair=%{_sbindir}/thin_repair \
$extra_opts
### COMMON-CONFIG-END ###
%make_build device-mapper
%install
make DESTDIR=%{buildroot} \
install_device-mapper \
install_systemd_units install_systemd_generators
ln -s service %{buildroot}/%{_sbindir}/rcdm-event
# provide 1.02 compat links for the shared libraries
# this is needed for various binary packages
ln -s libdevmapper.so.1.03 %{buildroot}/%{_libdir}/libdevmapper.so.1.02
ln -s libdevmapper-event.so.1.03 %{buildroot}/%{_libdir}/libdevmapper-event.so.1.02
# remove blkd, will be in lvm2 proper
# without force on purpose to detect changes and fail if it happens
rm %{buildroot}%{_sbindir}/blkdeactivate
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/blkdeactivate.8
rm %{buildroot}%{_mandir}/man8/lvm2-activation-generator.8
# compat symlinks in /sbin remove with Leap 43
mkdir -p %{buildroot}/sbin
ln -s %{_sbindir}/dmsetup %{buildroot}/sbin/dmsetup
%pre
%service_add_pre dm-event.service dm-event.socket
%post
%service_add_post dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%posttrans
%{?regenerate_initrd_posttrans}
%preun
%service_del_preun dm-event.service dm-event.socket
%postun
%service_del_postun dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%files
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc README
%doc udev/12-dm-permissions.rules
/sbin/dmsetup
%{_sbindir}/dmsetup
%{_sbindir}/dmeventd
%{_sbindir}/dmstats
%{_mandir}/man8/dmstats.8%{ext_man}
%{_mandir}/man8/dmsetup.8%{ext_man}
%{_mandir}/man8/dmeventd.8%{ext_man}
%{_udevrulesdir}/10-dm.rules
%{_udevrulesdir}/13-dm-disk.rules
%{_udevrulesdir}/95-dm-notify.rules
%{_unitdir}/dm-event.socket
%{_sbindir}/rcdm-event
%{_unitdir}/dm-event.service
%package -n %{libname}
Summary: Library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname}
Device mapper main shared library
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libdevmapper.so.1.03
%{_libdir}/libdevmapper.so.1.02
%post -n %{libname}
if [ -f /%{_lib}/libdevmapper.so.1.03 ]; then
# Special migration - the library is now in %{_libdir}, but up to the point where
# zypp removes the 'old' device-mapper package, the old library 'wins' the ldloader race
# resulting in binaries asking for the newer version still getting the old one.
# This in turn results in funny bugs like boo#1045396
# Remove /%{_lib}/libdevmapper.so.1.02 - and the run ldconfig
rm /%{_lib}/libdevmapper.so.1.03
fi
/sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%package -n %{libname_event}
Summary: Event library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname_event}
Device mapper event daemon shared library
%files -n %{libname_event}
%defattr(-,root,root)
%{_libdir}/libdevmapper-event.so.1.03
%{_libdir}/libdevmapper-event.so.1.02
%post -n %{libname_event} -p /sbin/ldconfig
%postun -n %{libname_event} -p /sbin/ldconfig
%package devel
Summary: Development package for the device mapper
Group: Development/Libraries/C and C++
Requires: %{libname_event} = %{device_mapper_version}
Requires: %{libname} = %{device_mapper_version}
Requires: device-mapper = %{device_mapper_version}
%description devel
Files needed for software development using the device mapper
%files devel
%defattr(-,root,root)
%{_libdir}/libdevmapper.so
%{_libdir}/libdevmapper-event.so
%{_includedir}/libdevmapper.h
%{_includedir}/libdevmapper-event.h
%{_libdir}/pkgconfig/devmapper.pc
%{_libdir}/pkgconfig/devmapper-event.pc
%changelog

File diff suppressed because it is too large Load Diff

View File

@ -1,260 +0,0 @@
#
# spec file for package lvm2-clvm
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _supportsanlock 0
%define dlm_version 3.99.1
%if 0%{_supportsanlock} == 1
%define sanlock_version 3.3.0
%endif
### COMMON-DEF-BEGIN ###
%define lvm2_version 2.02.180
%define device_mapper_version 1.02.149
%define thin_provisioning_version 0.7.0
### COMMON-DEF-END ###
Name: lvm2-clvm
Version: %{lvm2_version}
Release: 0
Summary: Clustered LVM2
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: Productivity/Clustering/HA
Url: http://sources.redhat.com/cluster/clvm/
Source: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz
Source1: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz.asc
# To detect modprobe during build
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: libcorosync-devel
BuildRequires: libdlm-devel >= %{dlm_version}
BuildRequires: pkgconfig
%if 0%{_supportsanlock} == 1
BuildRequires: sanlock-devel >= %{sanlock_version}
%endif
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(blkid)
BuildRequires: pkgconfig(devmapper)
BuildRequires: pkgconfig(libudev)
Requires: corosync
Requires: device-mapper >= %{device_mapper_version}
Requires: lvm2 = %{version}
Requires: lvm2-cmirrord
Obsoletes: cmirrord < %{version}
Provides: cmirrord = %{version}
### COMMON-PATCH-BEGIN ###
# Upstream patches
Patch0001: bug-1145231_lvmetad-improve-scan-for-pvscan-all.patch
Patch0002: bug-1145231_scan-use-full-md-filter-when-md-1.0-devices-are-pres.patch
Patch0003: bug-1145231_scan-enable-full-md-filter-when-md-1.0-devices-are-p.patch
Patch0004: bug-1114113_metadata-prevent-writing-beyond-metadata-area.patch
Patch0005: bug-1145231_scan-md-metadata-version-0.90-is-at-the-end-of-disk.patch
Patch0006: bug-1145231_pvscan-lvmetad-use-full-md-filter-when-md-1.0-device.patch
Patch0007: bug-1145231_pvscan-lvmetad-use-udev-info-to-improve-md-component.patch
Patch0008: bug-1122666_devices-drop-open-error-message.patch
Patch0009: bug-1137296_pvremove-vgextend-fix-using-device-aliases-with-lvmetad.patch
Patch0010: bug-1135984_cache-support-no_discard_passdown.patch
# SUSE patches: 1000+ for LVM
# Never upstream
Patch1001: cmirrord_remove_date_time_from_compilation.patch
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1005: bsc1080299-detect-clvm-properly.patch
Patch1006: bug-998893_make_pvscan_service_after_multipathd.patch
#SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
### COMMON-PATCH-END ###
# Patches for clvmd and cmirrord
Patch3001: bug-978055_clvmd-try-to-refresh-device-cache-on-the-first-failu.patch
%description
A daemon for using LVM2 Logival Volumes in a clustered environment.
%prep
%setup -q -n LVM2.%{lvm2_version}
### COMMON-PREP-BEGIN ###
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2001 -p1
### COMMON-PREP-END ###
%patch3001 -p1
%build
extra_opts="
--enable-applib
--enable-blkid_wiping
--enable-cmdlib
--enable-lvmetad
--enable-lvmpolld
--enable-realtime
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--with-clvmd=corosync
--with-cluster=internal
--enable-cmirrord
--enable-lvmlockd-dlm
%if 0%{_supportsanlock} == 1
--enable-lvmlockd-sanlock
%endif
"
### COMMON-CONFIG-BEGIN ###
export PATH=$PATH:/sbin:%{_prefix}/sbin
# Why this messy fix here? someone released a wrong version...
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
%configure \
--enable-dmeventd \
--enable-cmdlib \
--enable-udev_rules \
--enable-udev_sync \
--with-udev-prefix="%{_prefix}/" \
--enable-selinux \
--enable-pkgconfig \
--with-usrlibdir=%{_libdir} \
--with-usrsbindir=%{_sbindir} \
--with-default-dm-run-dir=/run \
--with-tmpfilesdir=%{_tmpfilesdir} \
--with-thin=internal \
--with-device-gid=6 \
--with-device-mode=0640 \
--with-device-uid=0 \
--with-dmeventd-path=%{_sbindir}/dmeventd \
--with-thin-check=%{_sbindir}/thin_check \
--with-thin-dump=%{_sbindir}/thin_dump \
--with-thin-repair=%{_sbindir}/thin_repair \
$extra_opts
### COMMON-CONFIG-END ###
%make_build
%install
make DESTDIR=%{buildroot} \
install_cluster \
install_systemd_units install_systemd_generators
make DESTDIR=%{buildroot} install -C daemons/lvmlockd
make DESTDIR=%{buildroot} install -C daemons/cmirrord
# lvmlockd does not have separate target install the mans by hand for now
install -m0644 -D man/lvmlockd.8 %{buildroot}%{_mandir}/man8/lvmlockd.8
install -m0644 -D man/lvmlockctl.8 %{buildroot}%{_mandir}/man8/lvmlockctl.8
# rc services symlinks
ln -s service %{buildroot}%{_sbindir}/rclvm2-cluster-activation
ln -s service %{buildroot}%{_sbindir}/rclvm2-clvmd
ln -s service %{buildroot}%{_sbindir}/rclvm2-cmirrord
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlockd
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlocking
# remove files from lvm2 split due to systemd_generators picking them up
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/dm-event.service
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/lvm2-activation-generator.8
rm %{buildroot}%{_libexecdir}/systemd/system-generators/lvm2-activation-generator
rm %{buildroot}%{_unitdir}/lvm2-lvmetad.service
rm %{buildroot}%{_unitdir}/lvm2-lvmetad.socket
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.socket
rm %{buildroot}%{_unitdir}/lvm2-pvscan@.service
%files
%defattr(-,root,root)
%{_sbindir}/clvmd
%{_sbindir}/rclvm2-cluster-activation
%{_sbindir}/rclvm2-clvmd
%{_unitdir}/lvm2-clvmd.service
%{_unitdir}/lvm2-cluster-activation.service
%{_libexecdir}/systemd/lvm2-cluster-activation
%{_mandir}/man8/clvmd.8%{ext_man}
%package -n lvm2-cmirrord
Summary: Clustered RAID 1 support using device-mapper and corosync
Group: Productivity/Clustering/HA
Requires: corosync
Requires: device-mapper >= %{device_mapper_version}
Requires: lvm2 = %{version}
Requires: lvm2-clvm
%description -n lvm2-cmirrord
A daemon for using LVM2 Logival Volumes in a clustered environment.
%files -n lvm2-cmirrord
%defattr(-,root,root)
%{_sbindir}/cmirrord
%{_libexecdir}/systemd/system/lvm2-cmirrord.service
%{_sbindir}/rclvm2-cmirrord
%{_mandir}/man8/cmirrord.8%{ext_man}
%package -n lvm2-lockd
Summary: LVM locking daemon
Group: Productivity/Clustering/HA
Recommends: libdlm >= %{dlm_version}
Requires: lvm2 = %{version}
%if 0%{_supportsanlock} == 1
Requires: sanlock >= %{sanlock_version}
%endif
%{?systemd_requires}
%description -n lvm2-lockd
LVM commands use lvmlockd to coordinate access to shared storage.
%pre -n lvm2-lockd
%service_add_pre lvm2-lvmlockd.service lvm2-lvmlocking.service
%post -n lvm2-lockd
%service_add_post lvm2-lvmlockd.service lvm2-lvmlocking.service
%preun -n lvm2-lockd
%service_del_preun lvm2-lvmlockd.service lvm2-lvmlocking.service
%postun -n lvm2-lockd
%service_del_postun lvm2-lvmlockd.service lvm2-lvmlocking.service
%files -n lvm2-lockd
%defattr(-,root,root,)
%{_sbindir}/lvmlockd
%{_sbindir}/lvmlockctl
%{_mandir}/man8/lvmlockd.8%{ext_man}
%{_mandir}/man8/lvmlockctl.8%{ext_man}
%{_unitdir}/lvm2-lvmlockd.service
%{_unitdir}/lvm2-lvmlocking.service
%{_sbindir}/rclvm2-lvmlockd
%{_sbindir}/rclvm2-lvmlocking
%changelog

397
lvm2.spec
View File

@ -17,17 +17,33 @@
%define _unpackaged_files_terminate_build 0
%define libname libdevmapper1_03
%define libname_event libdevmapper-event1_03
%define _udevdir %(pkg-config --variable=udevdir udev)
%define applib liblvm2app2_2
%define cmdlib liblvm2cmd2_02
### COMMON-DEF-BEGIN ###
%define lvm2_version 2.02.180
%define device_mapper_version 1.02.149
%define cmdlib liblvm2cmd2_03
%define lvm2_version 2.03.05
%define device_mapper_version 1.02.163
%define thin_provisioning_version 0.7.0
### COMMON-DEF-END ###
Name: lvm2
%define _supportsanlock 0
%define dlm_version 4.0
%if 0%{_supportsanlock} == 1
%define sanlock_version 3.3.0
%endif
%global flavor @BUILD_FLAVOR@%{nil}
%define psuffix %{nil}
%if "%{flavor}" == "devicemapper"
%define psuffix -devicemapper
%bcond_without devicemapper
%else
%bcond_with devicemapper
%endif
%if "%{flavor}" == "lockd"
%define psuffix -clustering
%bcond_without lockd
%else
%bcond_with lockd
%endif
Name: lvm2%{psuffix}
Version: %{lvm2_version}
Release: 0
Summary: Logical Volume Manager Tools
@ -37,6 +53,33 @@ Url: http://www.sourceware.org/lvm2/
Source: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
Source1: lvm.conf
Source42: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz.asc
BuildRequires: libdlm-devel
%if %{with devicemapper}
BuildRequires: gcc-c++
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: pkgconfig
BuildRequires: suse-module-tools
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(libsepol)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(systemd)
%else
%if %{with lockd}
# To detect modprobe during build
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: libcorosync-devel
BuildRequires: libdlm-devel
BuildRequires: pkgconfig
%if 0%{_supportsanlock} == 1
BuildRequires: sanlock-devel >= %{sanlock_version}
%endif
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(blkid)
BuildRequires: pkgconfig(libudev)
%else
BuildRequires: gcc-c++
BuildRequires: libaio-devel
BuildRequires: libcorosync-devel
@ -50,26 +93,20 @@ BuildRequires: pkgconfig(blkid)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
%endif
%endif
Requires: device-mapper >= %{device_mapper_version}
Requires: modutils
Requires(post): coreutils
Requires(postun): coreutils
Provides: lvm = %{version}
Obsoletes: lvm2-cmirrord
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
### COMMON-PATCH-BEGIN ###
# Upstream patches
Patch0001: bug-1145231_lvmetad-improve-scan-for-pvscan-all.patch
Patch0002: bug-1145231_scan-use-full-md-filter-when-md-1.0-devices-are-pres.patch
Patch0003: bug-1145231_scan-enable-full-md-filter-when-md-1.0-devices-are-p.patch
Patch0004: bug-1114113_metadata-prevent-writing-beyond-metadata-area.patch
Patch0005: bug-1145231_scan-md-metadata-version-0.90-is-at-the-end-of-disk.patch
Patch0006: bug-1145231_pvscan-lvmetad-use-full-md-filter-when-md-1.0-device.patch
Patch0007: bug-1145231_pvscan-lvmetad-use-udev-info-to-improve-md-component.patch
Patch0008: bug-1122666_devices-drop-open-error-message.patch
Patch0009: bug-1137296_pvremove-vgextend-fix-using-device-aliases-with-lvmetad.patch
Patch0010: bug-1135984_cache-support-no_discard_passdown.patch
#Patch0001: bug-1122666_devices-drop-open-error-message.patch
# SUSE patches: 1000+ for LVM
# Never upstream
@ -77,18 +114,13 @@ Patch1001: cmirrord_remove_date_time_from_compilation.patch
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1005: bsc1080299-detect-clvm-properly.patch
Patch1006: bug-998893_make_pvscan_service_after_multipathd.patch
#SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
### COMMON-PATCH-END ###
# 3000+ for test code
Patch3001: bug-950089_test-fix-lvm2-testsuite-build-error.patch
Patch3002: bug-1043040_test-fix-read-ahead-issues-in-test-scripts.patch
Patch3003: bug-1072624_test-lvmetad_dump-always-timed-out-when-using-nc.patch
Patch3004: tests-specify-python3-as-the-script-interpreter.patch
Patch3001: bug-1043040_test-fix-read-ahead-issues-in-test-scripts.patch
# patches specif for lvm2.spec
Patch4001: bug-1037309_Makefile-skip-compliling-daemons-lvmlockd-directory.patch
@ -99,38 +131,23 @@ Volume Manager.
%prep
%setup -q -n LVM2.%{version}
### COMMON-PREP-BEGIN ###
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
#%patch0001 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2001 -p1
### COMMON-PREP-END ###
%patch3001 -p1
%patch3002 -p1
%patch3003 -p1
%patch3004 -p1
%if !%{with lockd}
%patch4001 -p1
%endif
%build
%if !%{with devicemapper} && !%{with lockd}
extra_opts="
--enable-applib
--enable-blkid_wiping
--enable-cmdlib
--enable-lvmetad
--enable-lvmpolld
--enable-realtime
--with-cache=internal
@ -138,7 +155,30 @@ extra_opts="
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--enable-cmirrord
--enable-fsadm
--disable-silent-rules
--enable-write_install
--with-vdo=internal
--with-vdo-format=/usr/bin/vdoformat
"
%endif
%if %{with lockd}
extra_opts="
--enable-blkid_wiping
--enable-cmdlib
--enable-lvmpolld
--enable-realtime
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--with-cluster=internal
--enable-lvmlockd-dlm
%if 0%{_supportsanlock} == 1
--enable-lvmlockd-sanlock
%endif
--disable-silent-rules
"
%endif
### COMMON-CONFIG-BEGIN ###
export PATH=$PATH:/sbin:%{_prefix}/sbin
@ -167,9 +207,60 @@ sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
$extra_opts
### COMMON-CONFIG-END ###
%if %{with devicemapper}
%make_build device-mapper
%else
%make_build
%endif
%install
%if %{with devicemapper}
make DESTDIR=%{buildroot} \
install_device-mapper \
install_systemd_units
ln -s service %{buildroot}/%{_sbindir}/rcdm-event
# provide 1.02 compat links for the shared libraries
# this is needed for various binary packages
ln -s libdevmapper.so.1.03 %{buildroot}/%{_libdir}/libdevmapper.so.1.02
ln -s libdevmapper-event.so.1.03 %{buildroot}/%{_libdir}/libdevmapper-event.so.1.02
# remove blkd, will be in lvm2 proper
# without force on purpose to detect changes and fail if it happens
rm %{buildroot}%{_sbindir}/blkdeactivate
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/blkdeactivate.8
# compat symlinks in /sbin remove with Leap 43
mkdir -p %{buildroot}/sbin
ln -s %{_sbindir}/dmsetup %{buildroot}/sbin/dmsetup
%else
%if %{with lockd}
make DESTDIR=%{buildroot} \
install_systemd_units install_systemd_generators
make DESTDIR=%{buildroot} install -C daemons/lvmlockd
# lvmlockd does not have separate target install the mans by hand for now
install -m0644 -D man/lvmlockd.8 %{buildroot}%{_mandir}/man8/lvmlockd.8
install -m0644 -D man/lvmlockctl.8 %{buildroot}%{_mandir}/man8/lvmlockctl.8
# rc services symlinks
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlockd
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlocking
# remove files from lvm2 split due to systemd_generators picking them up
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/dm-event.service
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/lvm2-activation-generator.8
rm %{buildroot}%{_libexecdir}/systemd/system-generators/lvm2-activation-generator
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.socket
rm %{buildroot}%{_unitdir}/lvm2-pvscan@.service
%else
%make_install
make install_system_dirs DESTDIR=%{buildroot}
make install_systemd_units DESTDIR=%{buildroot}
@ -181,17 +272,15 @@ install -m 644 %{SOURCE1} "%{buildroot}/%{_sysconfdir}/lvm/"
make -C test install DESTDIR=%{buildroot}
pushd "%{buildroot}/%{_libdir}"
ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so
ln -sf liblvm2app.so.2.2 liblvm2app.so
ln -sf liblvm2cmd.so.2.03 liblvm2cmd.so
for i in libdevmapper-event-lvm2{mirror,raid,snapshot,thin}; do
ln -sf "device-mapper/$i.so" "$i.so"
ln -sf "device-mapper/$i.so" "$i.so.2.02"
ln -sf "device-mapper/$i.so" "$i.so.2.03"
done
popd
#rc compat symlinks
ln -s service %{buildroot}%{_sbindir}/rcblk-availability
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmetad
ln -s service %{buildroot}%{_sbindir}/rclvm2-monitor
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmpolld
@ -205,8 +294,8 @@ rm %{buildroot}%{_udevrulesdir}/95-dm-notify.rules
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/dm-event.service
# See bsc#1037309 for more info
rm %{buildroot}%{_unitdir}/lvm2-lvmlockd.service
rm %{buildroot}%{_unitdir}/lvm2-lvmlocking.service
rm %{buildroot}%{_unitdir}/lvmlockd.service
rm %{buildroot}%{_unitdir}/lvmlocks.service
rm %{buildroot}%{_includedir}/libdevmapper*.h
rm %{buildroot}%{_libdir}/libdevmapper.so.*
rm %{buildroot}%{_libdir}/libdevmapper-event.so.*
@ -226,14 +315,175 @@ for i in {vg,pv,lv}*; do
ln -s %{_sbindir}/$i %{buildroot}/sbin/$i
done
popd
%endif
%endif
%if %{with devicemapper}
%package -n device-mapper
Summary: Device Mapper Tools
Group: System/Base
Version: %{device_mapper_version}
Release: 0
Requires: thin-provisioning-tools >= %{thin_provisioning_version}
Requires(post): coreutils
%description -n device-mapper
Programs and man pages for configuring and using the device mapper.
%pre -n device-mapper
%service_add_pre dm-event.service dm-event.socket
%post -n device-mapper
%service_add_post dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%posttrans -n device-mapper
%{?regenerate_initrd_posttrans}
%preun -n device-mapper
%service_del_preun dm-event.service dm-event.socket
%postun -n device-mapper
%service_del_postun dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%files -n device-mapper
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc README
%doc udev/12-dm-permissions.rules
/sbin/dmsetup
%{_sbindir}/dmsetup
%{_sbindir}/dmeventd
%{_sbindir}/dmstats
%{_mandir}/man8/dmstats.8%{ext_man}
%{_mandir}/man8/dmsetup.8%{ext_man}
%{_mandir}/man8/dmeventd.8%{ext_man}
%{_udevrulesdir}/10-dm.rules
%{_udevrulesdir}/13-dm-disk.rules
%{_udevrulesdir}/95-dm-notify.rules
%{_unitdir}/dm-event.socket
%{_sbindir}/rcdm-event
%{_unitdir}/dm-event.service
%package -n %{libname}
Summary: Library for device-mapper
Group: System/Libraries
Version: %{device_mapper_version}
Release: 0
Conflicts: %{name} < %{version}
%description -n %{libname}
Device mapper main shared library
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libdevmapper.so.1.03
%{_libdir}/libdevmapper.so.1.02
%post -n %{libname}
if [ -f /%{_lib}/libdevmapper.so.1.03 ]; then
# Special migration - the library is now in %{_libdir}, but up to the point where
# zypp removes the 'old' device-mapper package, the old library 'wins' the ldloader race
# resulting in binaries asking for the newer version still getting the old one.
# This in turn results in funny bugs like boo#1045396
# Remove /%{_lib}/libdevmapper.so.1.02 - and the run ldconfig
rm /%{_lib}/libdevmapper.so.1.03
fi
/sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%package -n %{libname_event}
Summary: Event library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
Version: %{device_mapper_version}
Release: 0
%description -n %{libname_event}
Device mapper event daemon shared library
%files -n %{libname_event}
%defattr(-,root,root)
%{_libdir}/libdevmapper-event.so.1.03
%{_libdir}/libdevmapper-event.so.1.02
%post -n %{libname_event} -p /sbin/ldconfig
%postun -n %{libname_event} -p /sbin/ldconfig
%package -n device-mapper-devel
Summary: Development package for the device mapper
Group: Development/Libraries/C and C++
Requires: %{libname_event} = %{device_mapper_version}
Requires: %{libname} = %{device_mapper_version}
Requires: device-mapper = %{device_mapper_version}
Version: %{device_mapper_version}
Release: 0
%description -n device-mapper-devel
Files needed for software development using the device mapper
%files -n device-mapper-devel
%defattr(-,root,root)
%{_libdir}/libdevmapper.so
%{_libdir}/libdevmapper-event.so
%{_includedir}/libdevmapper.h
%{_includedir}/libdevmapper-event.h
%{_libdir}/pkgconfig/devmapper.pc
%{_libdir}/pkgconfig/devmapper-event.pc
%else
%if %{with lockd}
%package -n lvm2-lockd
Summary: LVM locking daemon
Group: System/Base
Recommends: libdlm >= %{dlm_version}
Obsoletes: lvm2-clvm
Requires: corosync
Requires: device-mapper >= %{device_mapper_version}
Requires: lvm2 = %{version}
%if 0%{_supportsanlock} == 1
Requires: sanlock >= %{sanlock_version}
%endif
%{?systemd_requires}
%description -n lvm2-lockd
LVM commands use lvmlockd to coordinate access to shared storage.
%pre -n lvm2-lockd
%service_add_pre lvmlockd.service lvmlocks.service
%post -n lvm2-lockd
%service_add_post lvmlockd.service lvmlocks.service
%preun -n lvm2-lockd
%service_del_preun lvmlockd.service lvmlocks.service
%postun -n lvm2-lockd
%service_del_postun lvmlockd.service lvmlocks.service
%files -n lvm2-lockd
%defattr(-,root,root,)
%{_sbindir}/lvmlockd
%{_sbindir}/lvmlockctl
%{_mandir}/man8/lvmlockd.8%{ext_man}
%{_mandir}/man8/lvmlockctl.8%{ext_man}
%{_unitdir}/lvmlockd.service
%{_unitdir}/lvmlocks.service
%{_sbindir}/rclvm2-lvmlockd
%{_sbindir}/rclvm2-lvmlocking
%else
%pre
%service_add_pre blk-availability.service lvm2-monitor.service lvm2-lvmetad.socket lvm2-lvmetad.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%service_add_pre blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%post
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_add_post blk-availability.service lvm2-monitor.service lvm2-lvmetad.socket lvm2-lvmetad.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%service_add_post blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
# Use %%tmpfiles_create when 13.2 is oldest in support scope
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/lvm2.conf || :
@ -241,25 +491,24 @@ popd
%{?regenerate_initrd_posttrans}
%preun
%service_del_preun blk-availability.service lvm2-monitor.service lvm2-lvmetad.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%service_del_preun blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%postun
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_del_postun blk-availability.service lvm2-monitor.service lvm2-lvmetad.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%service_del_postun blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%files
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc README VERSION WHATS_NEW
%doc doc/lvm_fault_handling.txt
# Main binaries
%{_sbindir}/blkdeactivate
%{_sbindir}/fsadm
%{_sbindir}/lvm
%{_sbindir}/lvmconf
%{_sbindir}/lvmconfig
%{_sbindir}/lvmdump
%{_sbindir}/lvmetad
%{_sbindir}/lvmpolld
# Other files
%{_sbindir}/lvchange
@ -305,15 +554,12 @@ popd
%{_sbindir}/vgscan
%{_sbindir}/vgsplit
%{_sbindir}/rcblk-availability
%{_sbindir}/rclvm2-lvmetad
%{_sbindir}/rclvm2-lvmpolld
%{_sbindir}/rclvm2-monitor
# compat symlinks in /sbin
/sbin/lvm
/sbin/lvmconf
/sbin/lvmconfig
/sbin/lvmdump
/sbin/lvmetad
/sbin/lvmpolld
/sbin/lvchange
/sbin/lvconvert
@ -363,6 +609,7 @@ popd
%{_mandir}/man7/lvmreport.7%{ext_man}
%{_mandir}/man7/lvmthin.7%{ext_man}
%{_mandir}/man7/lvmsystemid.7%{ext_man}
%{_mandir}/man7/lvmvdo.7%{ext_man}
%{_mandir}/man8/fsadm.8%{ext_man}
%{_mandir}/man8/lvchange.8%{ext_man}
%{_mandir}/man8/lvconvert.8%{ext_man}
@ -374,7 +621,6 @@ popd
%{_mandir}/man8/lvm-config.8%{ext_man}
%{_mandir}/man8/lvmconfig.8%{ext_man}
%{_mandir}/man8/lvm-dumpconfig.8%{ext_man}
%{_mandir}/man8/lvmconf.8%{ext_man}
%{_mandir}/man8/lvmdiskscan.8%{ext_man}
%{_mandir}/man8/lvmdump.8%{ext_man}
%{_mandir}/man8/lvm-fullreport.8%{ext_man}
@ -414,7 +660,6 @@ popd
%{_mandir}/man8/vgs.8%{ext_man}
%{_mandir}/man8/vgscan.8%{ext_man}
%{_mandir}/man8/vgsplit.8%{ext_man}
%{_mandir}/man8/lvmetad.8%{ext_man}
%{_mandir}/man8/blkdeactivate.8%{ext_man}
%{_mandir}/man8/lvmpolld.8%{ext_man}
%{_mandir}/man8/lvm-lvpoll.8%{ext_man}
@ -431,6 +676,7 @@ popd
%{_sysconfdir}/lvm/profile/cache-mq.profile
%{_sysconfdir}/lvm/profile/cache-smq.profile
%{_sysconfdir}/lvm/profile/lvmdbusd.profile
%{_sysconfdir}/lvm/profile/vdo-small.profile
%dir %{_sysconfdir}/lvm/cache
%ghost %{_sysconfdir}/lvm/cache/.cache
%dir %{_sysconfdir}/lvm/archive
@ -438,8 +684,6 @@ popd
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/blk-availability.service
%{_unitdir}/lvm2-monitor.service
%{_unitdir}/lvm2-lvmetad.socket
%{_unitdir}/lvm2-lvmetad.service
%{_unitdir}/lvm2-pvscan@.service
%{_unitdir}/lvm2-lvmpolld.socket
%{_unitdir}/lvm2-lvmpolld.service
@ -447,22 +691,7 @@ popd
%dir %{_libdir}/device-mapper
%{_libdir}/device-mapper/libdevmapper-event-lvm2*.so
%{_libdir}/libdevmapper-event-lvm2*.so
%{_libdir}/libdevmapper-event-lvm2*.so.2.02
%package -n %{applib}
Summary: LVM2 application api library
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{applib}
LVM library for applications api
%post -n %{applib} -p /sbin/ldconfig
%postun -n %{applib} -p /sbin/ldconfig
%files -n %{applib}
%defattr(-,root,root)
%{_libdir}/liblvm2app.so.*
%{_libdir}/libdevmapper-event-lvm2*.so.2.03
%package -n %{cmdlib}
Summary: LVM2 command line library
@ -483,7 +712,6 @@ lvm devices without invoking a separate program.
%package devel
Summary: Development files for LVM2
Group: Development/Libraries/C and C++
Requires: %{applib} = %{version}
Requires: %{cmdlib} = %{version}
Requires: device-mapper-devel
Requires: lvm2 = %{version}
@ -494,15 +722,11 @@ This package provides development files for the LVM2 Logical Volume Manager.
%files devel
%defattr(-,root,root)
%{_includedir}/lvm2cmd.h
%{_includedir}/lvm2app.h
%{_libdir}/pkgconfig/lvm2app.pc
%{_libdir}/liblvm2app.so
%{_libdir}/liblvm2cmd.so
%package testsuite
Summary: LVM2 Testsuite
Group: Development/Libraries/C and C++
Requires: %{applib} = %{version}
Requires: %{cmdlib} = %{version}
Requires: lvm2 = %{version}
@ -515,4 +739,7 @@ An extensive functional testsuite for the LVM2 Logical Volume Manager.
%{_libexecdir}/lvm2-testsuite/
%{_bindir}/lvm2-testsuite
%endif
%endif
%changelog

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
master="lvm2.spec"
sections="COMMON-DEF COMMON-PATCH COMMON-PREP COMMON-CONFIG"
for slave in device-mapper.spec lvm2-clvm.spec; do
{
prev=1
for section in $sections; do
begin="/$section-BEGIN/"
end="/$section-END/"
sed -n -e "${prev},${begin}p" $slave
sed -n -e "${begin},${end}p" $master | head -n -1 | tail -n +2
prev=$end
done
sed -n -e "${prev},\$p" $slave
} > $slave.tmp && mv $slave.tmp $slave
done
# changelogs
cp lvm2.changes lvm2-clvm.changes
cp lvm2.changes device-mapper.changes