Compare commits

...

2 Commits

Author SHA1 Message Date
Yu Watanabe 85941cbbf0
Merge 0e88b0933c into d99198819c 2024-11-22 04:33:17 +01:00
Yu Watanabe 0e88b0933c shutdown: assume sync/fsync is in progress if the total of dirty bytes is changed
Follow-up for b4b66b2662.

Some dm devices seem to move data from one underlying disk to another on
fsync. In such case, dirty bytes we monitored may sometimes increase.
So, let's assume sync/fsync is in progress if the monitored value is
changed, not only when decreased.

This also makes one error handling consistent with others, that is,
propagate the error code.

Hopefully closes #35243.
2024-11-22 03:07:30 +09:00
1 changed files with 5 additions and 9 deletions

View File

@ -182,10 +182,8 @@ static int switch_root_initramfs(void) {
* Writeback
* Dirty
*
* Return true if the sum of these fields is greater than the previous
* value input. For all other issues, report the failure and indicate that
* the sync is not making progress.
*/
* Return true if the sum of these fields is changed from the previous value input. For all other issues,
* report the failure and indicate that the sync is not making progress. */
static int sync_making_progress(unsigned long long *prev_dirty) {
_cleanup_fclose_ FILE *f = NULL;
unsigned long long val = 0;
@ -211,15 +209,13 @@ static int sync_making_progress(unsigned long long *prev_dirty) {
continue;
errno = 0;
if (sscanf(line, "%*s %llu %*s", &ull) != 1) {
log_warning_errno(errno_or_else(EIO), "Failed to parse /proc/meminfo field, ignoring: %m");
return false;
}
if (sscanf(line, "%*s %llu %*s", &ull) != 1)
return log_warning_errno(errno_or_else(EIO), "Failed to parse /proc/meminfo field: %m");
val += ull;
}
r = *prev_dirty > val;
r = *prev_dirty != val;
*prev_dirty = val;
return r;
}