diff options
author | Xiao Ni <xni@redhat.com> | 2024-09-11 10:54:32 +0200 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-09-23 10:49:17 +0200 |
commit | e3c3cfb64b8ec8b616e2eefbc69fbc3de29b64b6 (patch) | |
tree | 6f65072932bbf2ddb8c4a0f94e7af4b6cfa822b4 | |
parent | mdadm/tests: remove 09imsm-assemble.broken (diff) | |
download | mdadm-e3c3cfb64b8ec8b616e2eefbc69fbc3de29b64b6.tar.xz mdadm-e3c3cfb64b8ec8b616e2eefbc69fbc3de29b64b6.zip |
mdadm/Manage: record errno
Sometimes it reports:
mdadm: failed to stop array /dev/md0: Success
It's the reason the errno is reset. So record errno during the loop.
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
-rw-r--r-- | Manage.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -238,13 +238,14 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry) "array_state", "inactive")) < 0 && errno == EBUSY) { + err = errno; sleep_for(0, MSEC_TO_NSEC(200), true); count--; } if (err) { if (verbose >= 0) pr_err("failed to stop array %s: %s\n", - devname, strerror(errno)); + devname, strerror(err)); rv = 1; goto out; } @@ -438,14 +439,15 @@ done: count = 25; err = 0; while (count && fd >= 0 && (err = ioctl(fd, STOP_ARRAY, NULL)) < 0 && errno == EBUSY) { + err = errno; sleep_for(0, MSEC_TO_NSEC(200), true); count --; } if (fd >= 0 && err) { if (verbose >= 0) { pr_err("failed to stop array %s: %s\n", - devname, strerror(errno)); - if (errno == EBUSY) + devname, strerror(err)); + if (err == EBUSY) cont_err("Perhaps a running process, mounted filesystem or active volume group?\n"); } rv = 1; |