From 0d77a9fdd0cc550e3bb4734d060868ad13ff5182 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 5 Mar 2021 14:56:35 +0100 Subject: [PATCH] main: simplify logic for FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT Signed-off-by: Giuseppe Scrivano --- main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 1cad322..c036a89 100644 --- a/main.c +++ b/main.c @@ -158,8 +158,6 @@ struct _uintptr_to_must_hold_fuse_ino_t_dummy_struct }; #endif -static bool disable_ovl_whiteout; - static uid_t overflow_uid; static gid_t overflow_gid; @@ -290,6 +288,12 @@ check_can_mknod (struct ovl_data *lo) int ret; char path[PATH_MAX]; + if (getenv ("FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT")) + { + can_mknod = false; + return; + } + sprintf (path, "%lu", get_next_wd_counter ()); ret = mknodat (lo->workdir_fd, path, S_IFCHR|0700, makedev (0, 0)); @@ -723,7 +727,7 @@ create_whiteout (struct ovl_data *lo, struct ovl_node *parent, const char *name, return 0; } - if (!disable_ovl_whiteout && !skip_mknod && can_mknod) + if (!skip_mknod && can_mknod) { char whiteout_path[PATH_MAX]; @@ -5468,9 +5472,6 @@ main (int argc, char *argv[]) struct ovl_layer *tmp_layer = NULL; struct fuse_args args = FUSE_ARGS_INIT (argc, newargv); - if (getenv ("FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT")) - disable_ovl_whiteout = true; - memset (&opts, 0, sizeof (opts)); if (fuse_opt_parse (&args, &lo, ovl_opts, fuse_opt_proc) == -1) error (EXIT_FAILURE, 0, "error parsing options");