retry:
                previous = 0;
+               disks = conf->raid_disks;
                prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE);
-               if (likely(conf->reshape_progress == MaxSector))
-                       disks = conf->raid_disks;
-               else {
+               if (unlikely(conf->reshape_progress != MaxSector)) {
                        /* spinlock is needed as reshape_progress may be
                         * 64bit on a 32bit platform, and so it might be
                         * possible to see a half-updated value
                         * to check again.
                         */
                        spin_lock_irq(&conf->device_lock);
-                       disks = conf->raid_disks;
                        if (mddev->delta_disks < 0
                            ? logical_sector < conf->reshape_progress
                            : logical_sector >= conf->reshape_progress) {
                sh = get_active_stripe(conf, new_sector, previous,
                                       (bi->bi_rw&RWA_MASK));
                if (sh) {
-                       if (unlikely(conf->reshape_progress != MaxSector)) {
+                       if (unlikely(previous)) {
                                /* expansion might have moved on while waiting for a
                                 * stripe, so we must do the range check again.
                                 * Expansion could still move past after this
                                 */
                                int must_retry = 0;
                                spin_lock_irq(&conf->device_lock);
-                               if ((mddev->delta_disks < 0
-                                    ? logical_sector >= conf->reshape_progress
-                                    : logical_sector < conf->reshape_progress)
-                                   && previous)
+                               if (mddev->delta_disks < 0
+                                   ? logical_sector >= conf->reshape_progress
+                                   : logical_sector < conf->reshape_progress)
                                        /* mismatch, need to try again */
                                        must_retry = 1;
                                spin_unlock_irq(&conf->device_lock);
                conf->previous_raid_disks = conf->raid_disks;
                conf->reshape_progress = MaxSector;
                spin_unlock_irq(&conf->device_lock);
+               wake_up(&conf->wait_for_overlap);
 
                /* read-ahead size must cover two whole stripes, which is
                 * 2 * (datadisks) * chunksize where 'n' is the number of raid devices