summaryrefslogtreecommitdiffstats
path: root/libdm/ioctl
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2011-09-23 17:16:28 +0000
committerAlasdair Kergon <agk@redhat.com>2011-09-23 17:16:28 +0000
commit349b204bc2fb0d7f182ad141fb1df39c49d1adfb (patch)
tree320e42a35626ac37ba71f16642d49d9498351ada /libdm/ioctl
parent87d8e3c33b003002c499eaae54bf169000b4cbfa (diff)
downloadlvm2-349b204bc2fb0d7f182ad141fb1df39c49d1adfb.tar.gz
lvm2-349b204bc2fb0d7f182ad141fb1df39c49d1adfb.tar.xz
lvm2-349b204bc2fb0d7f182ad141fb1df39c49d1adfb.zip
explain why we may now retry
Diffstat (limited to 'libdm/ioctl')
-rw-r--r--libdm/ioctl/libdm-iface.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 2409f43e..aab6305c 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1654,6 +1654,11 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
_cmd_data_v4[dmt->type].name,
strerror(errno));
+ /*
+ * It's sometimes worth retrying after EBUSY in case
+ * it's a transient failure caused by an asynchronous
+ * process quickly scanning the device.
+ */
*retryable = errno == EBUSY;
_dm_zfree_dmi(dmi);
@@ -1739,6 +1744,12 @@ int dm_task_run(struct dm_task *dmt)
repeat_ioctl:
if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor,
ioctl_retry, &retryable))) {
+ /*
+ * Async udev rules that scan devices commonly cause transient
+ * failures. Normally you'd expect the user to have made sure
+ * nothing was using the device before issuing REMOVE, so it's
+ * worth retrying in case the failure is indeed transient.
+ */
if (retryable && dmt->type == DM_DEVICE_REMOVE &&
dmt->retry_remove && ++ioctl_retry <= DM_IOCTL_RETRIES) {
usleep(DM_RETRY_USLEEP_DELAY);