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
This commit is contained in:
Gang He 2018-07-18 08:52:01 +00:00 committed by Git OBS Bridge
parent 90900723ea
commit d837fba6c1
7 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From b8a7f6ba3de6aed38c2969693b6064a943ea8799 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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