Skip to content

Commit

Permalink
Busy wait for overlay mount
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanformigoni committed Nov 15, 2024
1 parent b881755 commit 27007f9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bubblewrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <pwd.h>
#include <grp.h>
#include <ctype.h>
#include <time.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/wait.h>
Expand Down Expand Up @@ -1154,10 +1155,21 @@ privileged_op (int privileged_op_socket,
break;

case PRIV_SEP_OP_OVERLAY_MOUNT:
if (mount ("overlay", arg2, "overlay", MS_MGC_VAL, arg1) != 0)
while (mount ("overlay", arg2, "overlay", MS_MGC_VAL, arg1) != 0)
{
/* The standard message for ELOOP, "Too many levels of symbolic
* links", is not helpful here. */
if (errno == EBUSY)
{
struct timespec req, rem;
req.tv_sec = 0;
req.tv_nsec = 50 * 1000000L;
if (nanosleep(&req, &rem) == -1)
{
die("Failed nanosleep");
}
continue;
}
if (errno == ELOOP)
die ("Can't make overlay mount on %s with options %s: "
"Overlay directories may not overlap",
Expand Down

0 comments on commit 27007f9

Please sign in to comment.