summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2015-01-16 19:21:27 +0100
committerColin Walters <walters@verbum.org>2015-01-20 09:51:02 -0500
commit4991e9ab6a2adefa78a08b4582b62b2b093a319c (patch)
treee2de0079f8af48bed4eaceeeb982be49e608ca6c
parent638431045c3f2271e59dec36bf436adafab0d71e (diff)
downloadostree-4991e9ab6a2adefa78a08b4582b62b2b093a319c.tar.gz
static-delta: limit the number of writes in process to 1
This will avoid too many open files at the same time that could cause an EMFILE error. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> (cherry picked from commit bc092b06f0e34e93f7d6102957bf55fd7ffd1b9e)
-rw-r--r--src/libostree/ostree-repo-static-delta-processing.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c
index 13abc6c0..a663b84c 100644
--- a/src/libostree/ostree-repo-static-delta-processing.c
+++ b/src/libostree/ostree-repo-static-delta-processing.c
@@ -265,6 +265,11 @@ _ostree_static_delta_part_execute_raw (OstreeRepo *repo,
guint8 opcode;
OstreeStaticDeltaOperation *op;
+ /* Limit the number of outstanding writes to 1 to prevent too many open files
+ at the same time. */
+ while (state->outstanding_content_writes > 1)
+ g_main_context_iteration (state->content_writing_context, TRUE);
+
if (state->object_start)
{
if (!open_output_target (state, cancellable, error))