diff options
author | Scott Mayhew <smayhew@redhat.com> | 2017-02-15 10:21:40 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2017-02-15 10:41:59 -0500 |
commit | a15bd948606bf4816bf819c0b0c75761f3eb6359 (patch) | |
tree | b0d721f8b474f26ebe7415ecb3dae7e4a7cace15 /utils/exportfs/exportfs.c | |
parent | 1789737ec6dd43c9d1436aeb6c07fab52206f412 (diff) | |
download | nfs-utils-a15bd948606bf4816bf819c0b0c75761f3eb6359.tar.gz |
mountd/exportfs: implement the -s/--state-directory-path option
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/exportfs/exportfs.c')
-rw-r--r-- | utils/exportfs/exportfs.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 61dddfb..02d5b6d 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -52,6 +52,8 @@ static const char *lockfile = EXP_LOCKFILE; static int _lockfd = -1; char *conf_path = NFS_CONFFILE; +struct state_paths etab; + /* * If we aren't careful, changes made by exportfs can be lost * when multiple exports process run at once: @@ -95,6 +97,7 @@ main(int argc, char **argv) int f_ignore = 0; int i, c; int force_flush = 0; + char *s; if ((progname = strrchr(argv[0], '/')) != NULL) progname++; @@ -108,6 +111,11 @@ main(int argc, char **argv) conf_init(); xlog_from_conffile("exportfs"); + /* NOTE: following uses "mountd" section of nfs.conf !!!! */ + s = conf_get_str("mountd", "state-directory-path"); + if (s && !state_setup_basedir(argv[0], s)) + exit(1); + while ((c = getopt(argc, argv, "ad:fhio:ruvs")) != EOF) { switch(c) { case 'a': @@ -159,13 +167,17 @@ main(int argc, char **argv) xlog(L_ERROR, "-r and -u are incompatible"); return 1; } + if (!setup_state_path_names(progname, ETAB, ETABTMP, ETABLCK, &etab)) + return 1; if (optind == argc && ! f_all) { if (force_flush) { cache_flush(1); + free_state_path_names(&etab); return 0; } else { xtab_export_read(); dump(f_verbose, f_export_format); + free_state_path_names(&etab); return 0; } } @@ -206,6 +218,7 @@ main(int argc, char **argv) } xtab_export_write(); cache_flush(force_flush); + free_state_path_names(&etab); return export_errno; } |