main: simplify logic for FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-03-05 14:56:35 +01:00
parent d085fa9ade
commit 0d77a9fdd0
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

13
main.c
View File

@ -158,8 +158,6 @@ struct _uintptr_to_must_hold_fuse_ino_t_dummy_struct
}; };
#endif #endif
static bool disable_ovl_whiteout;
static uid_t overflow_uid; static uid_t overflow_uid;
static gid_t overflow_gid; static gid_t overflow_gid;
@ -290,6 +288,12 @@ check_can_mknod (struct ovl_data *lo)
int ret; int ret;
char path[PATH_MAX]; char path[PATH_MAX];
if (getenv ("FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT"))
{
can_mknod = false;
return;
}
sprintf (path, "%lu", get_next_wd_counter ()); sprintf (path, "%lu", get_next_wd_counter ());
ret = mknodat (lo->workdir_fd, path, S_IFCHR|0700, makedev (0, 0)); 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; return 0;
} }
if (!disable_ovl_whiteout && !skip_mknod && can_mknod) if (!skip_mknod && can_mknod)
{ {
char whiteout_path[PATH_MAX]; char whiteout_path[PATH_MAX];
@ -5468,9 +5472,6 @@ main (int argc, char *argv[])
struct ovl_layer *tmp_layer = NULL; struct ovl_layer *tmp_layer = NULL;
struct fuse_args args = FUSE_ARGS_INIT (argc, newargv); 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)); memset (&opts, 0, sizeof (opts));
if (fuse_opt_parse (&args, &lo, ovl_opts, fuse_opt_proc) == -1) if (fuse_opt_parse (&args, &lo, ovl_opts, fuse_opt_proc) == -1)
error (EXIT_FAILURE, 0, "error parsing options"); error (EXIT_FAILURE, 0, "error parsing options");