summaryrefslogtreecommitdiffstats
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index a5b8265303..807c666980 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -5737,6 +5737,13 @@ static int run(int argc, char *argv[]) {
goto finish;
}
+ /* Take a LOCK_SH lock on the device, so that udevd doesn't issue BLKRRPART in our back */
+ r = loop_device_flock(loop, LOCK_SH);
+ if (r < 0) {
+ log_error_errno(r, "Failed to take lock on loopback block device: %m");
+ goto finish;
+ }
+
r = dissect_image_and_warn(
loop->fd,
arg_image,