New version
- Make sure the returned thpool MD size is valid (vpodzime)
This commit is contained in:
		
							parent
							
								
									cbbcca7af6
								
							
						
					
					
						commit
						c29e6ca081
					
				| @ -64,12 +64,14 @@ | |||||||
| 
 | 
 | ||||||
| Name:        libblockdev | Name:        libblockdev | ||||||
| Version:     2.6 | Version:     2.6 | ||||||
| Release:     1%{?dist} | Release:     2%{?dist} | ||||||
| Summary:     A library for low-level manipulation with block devices | Summary:     A library for low-level manipulation with block devices | ||||||
| License:     LGPLv2+ | License:     LGPLv2+ | ||||||
| URL:         https://github.com/rhinstaller/libblockdev | URL:         https://github.com/rhinstaller/libblockdev | ||||||
| Source0:     https://github.com/rhinstaller/libblockdev/archive/%{name}-%{version}.tar.gz | Source0:     https://github.com/rhinstaller/libblockdev/archive/%{name}-%{version}.tar.gz | ||||||
| 
 | 
 | ||||||
|  | Patch0: valid_thpool_md_size.patch | ||||||
|  | 
 | ||||||
| BuildRequires: glib2-devel | BuildRequires: glib2-devel | ||||||
| BuildRequires: gobject-introspection-devel | BuildRequires: gobject-introspection-devel | ||||||
| BuildRequires: python-devel | BuildRequires: python-devel | ||||||
| @ -517,6 +519,7 @@ A meta-package that pulls all the libblockdev plugins as dependencies. | |||||||
| 
 | 
 | ||||||
| %prep | %prep | ||||||
| %setup -q -n %{name}-%{version} | %setup -q -n %{name}-%{version} | ||||||
|  | %patch0 -p1 | ||||||
| 
 | 
 | ||||||
| %build | %build | ||||||
| %configure %{?configure_opts} | %configure %{?configure_opts} | ||||||
| @ -786,6 +789,9 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} | |||||||
| %files plugins-all | %files plugins-all | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Tue Apr 11 2017 Vratislav Podzimek <vpodzime@redhat.com> - 2.6-2 | ||||||
|  | - Make sure the returned thpool MD size is valid (vpodzime) | ||||||
|  | 
 | ||||||
| * Wed Mar 15 2017 Vratislav Podzimek <vpodzime@redhat.com> - 2.6-1 | * Wed Mar 15 2017 Vratislav Podzimek <vpodzime@redhat.com> - 2.6-1 | ||||||
| - Move the  part_err library before part and fs (vtrefny) | - Move the  part_err library before part and fs (vtrefny) | ||||||
| - Fix BuildRequires for crypto and dm packages (vtrefny) | - Fix BuildRequires for crypto and dm packages (vtrefny) | ||||||
|  | |||||||
							
								
								
									
										75
									
								
								valid_thpool_md_size.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								valid_thpool_md_size.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,75 @@ | |||||||
|  | From 2b510a862dfc120e9e5592ba15112385b6c8c371 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vratislav Podzimek <vpodzime@redhat.com> | ||||||
|  | Date: Mon, 3 Apr 2017 13:54:52 +0200 | ||||||
|  | Subject: [PATCH] Make sure the returned thpool MD size is valid | ||||||
|  | 
 | ||||||
|  | It may be too small as given by the thin_metadata_size tool which | ||||||
|  | obviously doesn't guard for too small values. | ||||||
|  | 
 | ||||||
|  | Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  src/plugins/lvm-dbus.c  | 2 +- | ||||||
|  |  src/plugins/lvm.c       | 2 +- | ||||||
|  |  tests/lvm_dbus_tests.py | 4 ++++ | ||||||
|  |  tests/lvm_test.py       | 4 ++++ | ||||||
|  |  4 files changed, 10 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
 | ||||||
|  | index 25cb82a..86a5383 100644
 | ||||||
|  | --- a/src/plugins/lvm-dbus.c
 | ||||||
|  | +++ b/src/plugins/lvm-dbus.c
 | ||||||
|  | @@ -1097,7 +1097,7 @@ guint64 bd_lvm_get_thpool_meta_size (guint64 size, guint64 chunk_size, guint64 n
 | ||||||
|  |          return 0; | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    return ret;
 | ||||||
|  | +    return MAX (ret, BD_LVM_MIN_THPOOL_MD_SIZE);
 | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  /** | ||||||
|  | diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c
 | ||||||
|  | index a8acc69..21a20ba 100644
 | ||||||
|  | --- a/src/plugins/lvm.c
 | ||||||
|  | +++ b/src/plugins/lvm.c
 | ||||||
|  | @@ -615,7 +615,7 @@ guint64 bd_lvm_get_thpool_meta_size (guint64 size, guint64 chunk_size, guint64 n
 | ||||||
|  |          return 0; | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    return ret;
 | ||||||
|  | +    return MAX (ret, BD_LVM_MIN_THPOOL_MD_SIZE);
 | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  /** | ||||||
|  | diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py
 | ||||||
|  | index 4ba93e9..998f97c 100644
 | ||||||
|  | --- a/tests/lvm_dbus_tests.py
 | ||||||
|  | +++ b/tests/lvm_dbus_tests.py
 | ||||||
|  | @@ -130,6 +130,10 @@ class LvmNoDevTestCase(unittest.TestCase):
 | ||||||
|  |          # twice the chunk_size -> roughly half the metadata needed | ||||||
|  |          self.assertAlmostEqual(float(out1) / float(out2), 2, places=2) | ||||||
|  |   | ||||||
|  | +        # unless thin_metadata_size gives a value that is not valid (too small)
 | ||||||
|  | +        self.assertEqual(BlockDev.lvm_get_thpool_meta_size (100 * 1024**2, 128 * 1024, 100),
 | ||||||
|  | +                         BlockDev.LVM_MIN_THPOOL_MD_SIZE)
 | ||||||
|  | +
 | ||||||
|  |      def test_is_valid_thpool_md_size(self): | ||||||
|  |          """Verify that is_valid_thpool_md_size works as expected""" | ||||||
|  |   | ||||||
|  | diff --git a/tests/lvm_test.py b/tests/lvm_test.py
 | ||||||
|  | index 4879808..c7fedbd 100644
 | ||||||
|  | --- a/tests/lvm_test.py
 | ||||||
|  | +++ b/tests/lvm_test.py
 | ||||||
|  | @@ -114,6 +114,10 @@ class LvmNoDevTestCase(unittest.TestCase):
 | ||||||
|  |          # twice the chunk_size -> roughly half the metadata needed | ||||||
|  |          self.assertAlmostEqual(float(out1) / float(out2), 2, places=2) | ||||||
|  |   | ||||||
|  | +        # unless thin_metadata_size gives a value that is not valid (too small)
 | ||||||
|  | +        self.assertEqual(BlockDev.lvm_get_thpool_meta_size (100 * 1024**2, 128 * 1024, 100),
 | ||||||
|  | +                         BlockDev.LVM_MIN_THPOOL_MD_SIZE)
 | ||||||
|  | +
 | ||||||
|  |      def test_is_valid_thpool_md_size(self): | ||||||
|  |          """Verify that is_valid_thpool_md_size works as expected""" | ||||||
|  |   | ||||||
|  | -- 
 | ||||||
|  | 2.9.3 | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user