1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lv_manip: fall back to direct zeroing on any BLKZEROOUT ioctl failure

When BLKZEROOUT ioctl fails, it should not stop us from trying the direct
zeroing as a fallback action, since this is an optimization only.
We should be able to continue with new LV creation if we succeed
with that direct fallback then.

Related report: https://issues.redhat.com/browse/RHEL-58737
This commit is contained in:
Peter Rajnoha 2024-10-18 10:43:08 +02:00
parent 6ab2a22fcf
commit e96d6b7442
No known key found for this signature in database
GPG Key ID: E776664036DF84AB
2 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.28 - Version 2.03.28 -
================== ==================
Fall back to direct zeroing if BLKZEROOUT fails during new LV initialization.
Version 2.03.27 - 02nd October 2024 Version 2.03.27 - 02nd October 2024
=================================== ===================================

View File

@ -8829,16 +8829,17 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
range[1] = end - range[0]; range[1] = end - range[0];
if (ioctl(dev->bcache_fd, BLKZEROOUT, &range)) { if (ioctl(dev->bcache_fd, BLKZEROOUT, &range)) {
if (errno == EINVAL) /*
goto retry_with_dev_set; /* Kernel without support for BLKZEROOUT */ * If errno == EINVAL, then the kernel is without support for BLKZEROOUT.
log_sys_debug("ioctl", "BLKZEROOUT"); * Fall back to dev_set_bytes silently in that case. Otherwise, also log
sigint_restore(); * the errno message.
label_scan_invalidate(dev); */
log_error("%s logical volume %s at position " FMTu64 " and size " FMTu64 ".", if (errno != EINVAL) {
sigint_caught() ? "Interrupted initialization of" : "Failed to initialize", log_sys_debug("ioctl", "BLKZEROOUT");
display_lvname(lv), range[0], range[1]); log_debug("Falling back to direct zeroing.");
return 0; }
}
goto retry_with_dev_set; }
} }
} else } else
retry_with_dev_set: retry_with_dev_set: