Compare commits

...

3 Commits

Author SHA1 Message Date
Daan De Meyer df752c17e2
Merge 2cef09e567 into 5b2926d941 2024-11-24 06:31:24 +01:00
Yu Watanabe 5b2926d941 curl-util: do not configure new io event source when the event loop is already dead
Similar to c5ecf09494, but for io event source.

Fixes #35322.
2024-11-23 22:49:57 +01:00
Daan De Meyer 2cef09e567 repart: Take configured minimum and maximum size into account for Minimize=
- Let's check if the minimum size we got is larger than the configured
maximum partition size and fail early if it is.
- Let's make sure for writable filesystems that we make the minimal
filesystem at least as large as the minimum partition size, to allow
creating minimal filesystems with a minimum size.
2024-11-23 11:36:54 +01:00
2 changed files with 15 additions and 2 deletions

View File

@ -75,6 +75,10 @@ static int curl_glue_socket_callback(CURL *curl, curl_socket_t s, int action, vo
return 0; return 0;
} }
/* Don't configure io event source anymore when the event loop is dead already. */
if (g->event && sd_event_get_state(g->event) == SD_EVENT_FINISHED)
return 0;
r = hashmap_ensure_allocated(&g->ios, &trivial_hash_ops); r = hashmap_ensure_allocated(&g->ios, &trivial_hash_ops);
if (r < 0) { if (r < 0) {
log_oom(); log_oom();

View File

@ -7576,6 +7576,11 @@ static int context_minimize(Context *context) {
if (fstat(fd, &st) < 0) if (fstat(fd, &st) < 0)
return log_error_errno(errno, "Failed to stat temporary file: %m"); return log_error_errno(errno, "Failed to stat temporary file: %m");
if ((uint64_t) st.st_size > partition_max_size(context, p))
return log_error_errno(SYNTHETIC_ERRNO(E2BIG),
"Minimal partition size of %s filesystem of partition %s exceeds configured maximum size (%s > %s)",
p->format, strna(hint), FORMAT_BYTES(st.st_size), FORMAT_BYTES(partition_max_size(context, p)));
log_info("Minimal partition size of %s filesystem of partition %s is %s", log_info("Minimal partition size of %s filesystem of partition %s is %s",
p->format, strna(hint), FORMAT_BYTES(st.st_size)); p->format, strna(hint), FORMAT_BYTES(st.st_size));
@ -7612,8 +7617,12 @@ static int context_minimize(Context *context) {
* fool-proof. */ * fool-proof. */
uint64_t heuristic = streq(p->format, "xfs") ? fsz : fsz / 2; uint64_t heuristic = streq(p->format, "xfs") ? fsz : fsz / 2;
fsz = round_up_size(fsz + heuristic, context->grain_size); fsz = round_up_size(fsz + heuristic, context->grain_size);
if (minimal_size_by_fs_name(p->format) != UINT64_MAX) fsz = MAX(partition_min_size(context, p), fsz);
fsz = MAX(minimal_size_by_fs_name(p->format), fsz);
if (fsz > partition_max_size(context, p))
return log_error_errno(SYNTHETIC_ERRNO(E2BIG),
"Minimal partition size of %s filesystem of partition %s exceeds configured maximum size (%s > %s)",
p->format, strna(hint), FORMAT_BYTES(fsz), FORMAT_BYTES(partition_max_size(context, p)));
log_info("Minimal partition size of %s filesystem of partition %s is %s", log_info("Minimal partition size of %s filesystem of partition %s is %s",
p->format, strna(hint), FORMAT_BYTES(fsz)); p->format, strna(hint), FORMAT_BYTES(fsz));