]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-intel.c
IMSM: retry reading sync_completed during reshape
[thirdparty/mdadm.git] / super-intel.c
index ba3ee48b65596914ccc030a2d1f72bfd24d2e43d..7e2860c25f2a5083d32b9ecf36dd6c6fdf969fc6 100644 (file)
@@ -10378,6 +10378,7 @@ exit_imsm_reshape_super:
 int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 {
        int fd = sysfs_get_fd(sra, NULL, "sync_completed");
+       int retry = 3;
        unsigned long long completed;
        /* to_complete : new sync_max position */
        unsigned long long to_complete = sra->reshape_progress;
@@ -10388,11 +10389,17 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
                return 1;
        }
 
-       if (sysfs_fd_get_ll(fd, &completed) < 0) {
-               dprintf("cannot read reshape_position (no reshape in progres)\n");
-               close(fd);
-               return 1;
-       }
+       do {
+               if (sysfs_fd_get_ll(fd, &completed) < 0) {
+                       if (!retry) {
+                               dprintf("cannot read reshape_position (no reshape in progres)\n");
+                               close(fd);
+                               return 1;
+                       }
+                       usleep(30000);
+               } else
+                       break;
+       } while (retry--);
 
        if (completed > position_to_set) {
                dprintf("wrong next position to set %llu (%llu)\n",