Skip to content

Commit

Permalink
Merge pull request #17 from containers/volatile
Browse files Browse the repository at this point in the history
Add volatile keyword to mount
  • Loading branch information
rhatdan authored Nov 21, 2023
2 parents ea51711 + 736de68 commit 5c7c62d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions storage-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ static inline int convert_fs(conf* c) {
return 0;
}

#define OVERLAY_STR \
"redirect_dir=on,lowerdir=/initrofs,upperdir=/overlay/upper,workdir=/" \
"overlay/work"

static inline void mounts(const conf* c) {
if (!c->bootfs.val->c_str) {
print("bootfs empty\n");
Expand All @@ -528,12 +532,12 @@ static inline void mounts(const conf* c) {
dev_loop, c->fstype.val->c_str, errno, strerror(errno));

if (mount("overlay", "/initoverlayfs", "overlay", 0,
"redirect_dir=on,lowerdir=/initrofs,upperdir=/overlay/"
"upper,workdir=/overlay/work"))
"volatile," OVERLAY_STR) &&
errno == EINVAL &&
mount("overlay", "/initoverlayfs", "overlay", 0, OVERLAY_STR))
print(
"mount(\"overlay\", \"/initoverlayfs\", \"overlay\", 0, "
"\"redirect_dir=on,lowerdir=/initrofs,upperdir=/overlay/"
"upper,workdir=/overlay/work\") %d (%s)\n",
"mount(\"overlay\", \"/initoverlayfs\", \"overlay\", 0, \"" OVERLAY_STR
"\") %d (%s)\n",
errno, strerror(errno));

if (mount("/boot", "/initoverlayfs/boot", c->bootfstype.val->c_str, MS_MOVE,
Expand Down

0 comments on commit 5c7c62d

Please sign in to comment.