Abort cooldown sleep and break caller loops immediately on interruption

This commit is contained in:
Andrea Mazzoleni 2026-09-06 23:20:21 +02:00
parent ea955eedc7
commit f9819266e7
5 changed files with 14 additions and 2 deletions

View file

@ -2313,7 +2313,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* progress */
if (state_progress(state, 0, i, countpos, countmax, countsize)) {
/* LCOV_EXCL_START */
break;
goto end;
/* LCOV_EXCL_STOP */
}
@ -2330,6 +2330,9 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* drop until now */
state_usage_waste(state);
if (os_signal_interrupt())
goto end;
}
}

View file

@ -352,6 +352,9 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
/* drop until now */
state_usage_waste(state);
if (os_signal_interrupt())
break;
}
}

View file

@ -931,6 +931,9 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
/* drop until now */
state_usage_waste(state);
if (os_signal_interrupt())
break;
}
/* autosave */

View file

@ -1692,6 +1692,9 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
/* drop until now */
state_usage_waste(state);
if (os_signal_interrupt())
break;
}
/* autosave */

View file

@ -354,7 +354,7 @@ void state_thermal_cooldown(struct snapraid_state* state)
log_flush();
/* every 30 seconds spin down any disk that was spunup */
while (sleep_time > 0) {
while (sleep_time > 0 && !os_signal_interrupt()) {
state_device(state, DEVICE_DOWNIFUP, 0);
sleep(30);