summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-03-03 20:53:08 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2016-03-10 18:38:54 +0100
commit5aade9c402e2195bc1742509300983b0d77f33e8 (patch)
tree41e892d70b71cd306c7b45a6a998a61c0880ff96
parenta494d85ef6cf00a6a61707e5bc41aa59bb17b7e6 (diff)
downloadlvm2-5aade9c402e2195bc1742509300983b0d77f33e8.tar.gz
topology: handle reported sizes smaller then sector
Recent kernel (4.4) start to report values smaller then sector size (but in reporting size for SSD which support data zeroing on discard). For now log warning and assume it really means 1 sector. Addressing RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1313377
-rw-r--r--lib/device/dev-type.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index a6223dcea..689809a36 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -853,6 +853,12 @@ static unsigned long _dev_topology_attribute(struct dev_types *dt,
result = value >> SECTOR_SHIFT;
+ if (!result && value) {
+ log_warn("WARNING: Device %s: %s is %lu and is unexpectedly less then sector.",
+ dev_name(dev), attribute, value);
+ result = 1;
+ }
+
out_close:
if (fclose(fp))
log_sys_debug("fclose", path);