From d837fba6c18d4038079afdde820d8ad74622d620fe744d6fc20d9c5e66bc9a34 Mon Sep 17 00:00:00 2001 From: Gang He Date: Wed, 18 Jul 2018 08:52:01 +0000 Subject: [PATCH] Accepting request 623585 from home:ganghe:branches:openSUSE:Factory - Fix issuing discard in test mode (bsc#1095960) + bug-1095960_dev_io-no-discard-in-testmode.patch - Fix issuing discard in test mode (bsc#1095960) + bug-1095960_dev_io-no-discard-in-testmode.patch - Fix issuing discard in test mode (bsc#1095960) + bug-1095960_dev_io-no-discard-in-testmode.patch OBS-URL: https://build.opensuse.org/request/show/623585 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=225 --- ...095960_dev_io-no-discard-in-testmode.patch | 34 +++++++++++++++++++ device-mapper.changes | 6 ++++ device-mapper.spec | 2 ++ lvm2-clvm.changes | 6 ++++ lvm2-clvm.spec | 2 ++ lvm2.changes | 6 ++++ lvm2.spec | 2 ++ 7 files changed, 58 insertions(+) create mode 100644 bug-1095960_dev_io-no-discard-in-testmode.patch diff --git a/bug-1095960_dev_io-no-discard-in-testmode.patch b/bug-1095960_dev_io-no-discard-in-testmode.patch new file mode 100644 index 0000000..cf39d35 --- /dev/null +++ b/bug-1095960_dev_io-no-discard-in-testmode.patch @@ -0,0 +1,34 @@ +From b8a7f6ba3de6aed38c2969693b6064a943ea8799 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Sun, 8 Jul 2018 21:11:01 +0200 +Subject: [PATCH] dev_io: no discard in testmode + +When lvm2 command is executed in test mode, discard ioctl is skipped. +This may cause even data-loose in case, issuing discard for released +areas was enabled and user 'tested' lvreduce. +--- + lib/device/dev-io.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c +index 145093f17..2a4967fc1 100644 +--- a/lib/device/dev-io.c ++++ b/lib/device/dev-io.c +@@ -411,9 +411,11 @@ static int _dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64 + discard_range[0] = offset_bytes; + discard_range[1] = size_bytes; + +- log_debug_devs("Discarding %" PRIu64 " bytes offset %" PRIu64 " bytes on %s.", +- size_bytes, offset_bytes, dev_name(dev)); +- if (ioctl(dev->fd, BLKDISCARD, &discard_range) < 0) { ++ log_debug_devs("Discarding %" PRIu64 " bytes offset %" PRIu64 " bytes on %s. %s", ++ size_bytes, offset_bytes, dev_name(dev), ++ test_mode() ? " (test mode - suppressed)" : ""); ++ ++ if (!test_mode() && ioctl(dev->fd, BLKDISCARD, &discard_range) < 0) { + log_error("%s: BLKDISCARD ioctl at offset %" PRIu64 " size %" PRIu64 " failed: %s.", + dev_name(dev), offset_bytes, size_bytes, strerror(errno)); + if (!dev_close(dev)) +-- +2.12.3 + diff --git a/device-mapper.changes b/device-mapper.changes index 8484708..d8d0537 100644 --- a/device-mapper.changes +++ b/device-mapper.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 18 11:33:30 UTC 2018 - ghe@suse.com + +- Fix issuing discard in test mode (bsc#1095960) + + bug-1095960_dev_io-no-discard-in-testmode.patch + ------------------------------------------------------------------- Tue May 29 10:45:30 UTC 2018 - ghe@suse.com diff --git a/device-mapper.spec b/device-mapper.spec index 37b4440..80cc4be 100644 --- a/device-mapper.spec +++ b/device-mapper.spec @@ -48,6 +48,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build ### COMMON-PATCH-BEGIN ### # Upstream patches Patch0001: fate-323203_lvmlockd-add-lockopt-values-for-skipping-selected-lo.patch +Patch0002: bug-1095960_dev_io-no-discard-in-testmode.patch # SUSE patches: 1000+ for LVM # Never upstream @@ -71,6 +72,7 @@ Programs and man pages for configuring and using the device mapper. ### COMMON-PREP-BEGIN ### %patch1001 -p1 %patch0001 -p1 +%patch0002 -p1 %patch1002 -p1 %patch1003 -p1 %patch1004 -p1 diff --git a/lvm2-clvm.changes b/lvm2-clvm.changes index 8484708..d8d0537 100644 --- a/lvm2-clvm.changes +++ b/lvm2-clvm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 18 11:33:30 UTC 2018 - ghe@suse.com + +- Fix issuing discard in test mode (bsc#1095960) + + bug-1095960_dev_io-no-discard-in-testmode.patch + ------------------------------------------------------------------- Tue May 29 10:45:30 UTC 2018 - ghe@suse.com diff --git a/lvm2-clvm.spec b/lvm2-clvm.spec index cacd25d..84bdb90 100644 --- a/lvm2-clvm.spec +++ b/lvm2-clvm.spec @@ -49,6 +49,7 @@ Provides: cmirrord = %{version} ### COMMON-PATCH-BEGIN ### # Upstream patches Patch0001: fate-323203_lvmlockd-add-lockopt-values-for-skipping-selected-lo.patch +Patch0002: bug-1095960_dev_io-no-discard-in-testmode.patch # SUSE patches: 1000+ for LVM # Never upstream @@ -76,6 +77,7 @@ A daemon for using LVM2 Logival Volumes in a clustered environment. ### COMMON-PREP-BEGIN ### %patch1001 -p1 %patch0001 -p1 +%patch0002 -p1 %patch1002 -p1 %patch1003 -p1 %patch1004 -p1 diff --git a/lvm2.changes b/lvm2.changes index 8484708..d8d0537 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 18 11:33:30 UTC 2018 - ghe@suse.com + +- Fix issuing discard in test mode (bsc#1095960) + + bug-1095960_dev_io-no-discard-in-testmode.patch + ------------------------------------------------------------------- Tue May 29 10:45:30 UTC 2018 - ghe@suse.com diff --git a/lvm2.spec b/lvm2.spec index cd9a752..0ce1317 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -59,6 +59,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build ### COMMON-PATCH-BEGIN ### # Upstream patches Patch0001: fate-323203_lvmlockd-add-lockopt-values-for-skipping-selected-lo.patch +Patch0002: bug-1095960_dev_io-no-discard-in-testmode.patch # SUSE patches: 1000+ for LVM # Never upstream @@ -91,6 +92,7 @@ Volume Manager. ### COMMON-PREP-BEGIN ### %patch1001 -p1 %patch0001 -p1 +%patch0002 -p1 %patch1002 -p1 %patch1003 -p1 %patch1004 -p1