diff --git a/support/export/client.c b/support/export/client.c index f85e11c..95156f0 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -277,7 +277,7 @@ client_lookup(char *hname, int canonical) if (htype == MCL_FQDN && !canonical) { ai = host_addrinfo(hname); if (!ai) { - xlog(L_ERROR, "Failed to resolve %s", hname); + xlog(L_WARNING, "Failed to resolve %s", hname); goto out; } hname = ai->ai_canonname; diff --git a/support/export/export.c b/support/export/export.c index 6b1d045..ce714d4 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -76,15 +76,22 @@ export_read(char *fname) struct exportent *eep; nfs_export *exp; + int volumes = 0; + setexportent(fname, "r"); while ((eep = getexportent(0,1)) != NULL) { exp = export_lookup(eep->e_hostname, eep->e_path, 0); - if (!exp) - export_create(eep, 0); + if (!exp) { + exp = export_create(eep, 0); + if (exp) + volumes++; + } else warn_duplicated_exports(exp, eep); } endexportent(); + if (volumes == 0) + xlog(L_ERROR, "No file systems exported!"); } /** diff --git a/support/export/hostname.c b/support/export/hostname.c index d9153e1..169baa5 100644 --- a/support/export/hostname.c +++ b/support/export/hostname.c @@ -177,11 +177,11 @@ host_addrinfo(const char *hostname) case 0: return ai; case EAI_SYSTEM: - xlog(D_GENERAL, "%s: failed to resolve %s: (%d) %m", + xlog(D_PARSE, "%s: failed to resolve %s: (%d) %m", __func__, hostname, errno); break; default: - xlog(D_GENERAL, "%s: failed to resolve %s: %s", + xlog(D_PARSE, "%s: failed to resolve %s: %s", __func__, hostname, gai_strerror(error)); break; } diff --git a/systemd/auth-rpcgss-module.service b/systemd/auth-rpcgss-module.service index 3fc2f4a..0355e13 100644 --- a/systemd/auth-rpcgss-module.service +++ b/systemd/auth-rpcgss-module.service @@ -6,7 +6,8 @@ # unit will fail. But that's OK.) [Unit] Description=Kernel Module supporting RPCSEC_GSS -Before=gssproxy.service rpc-svcgssd.service +Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service +Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service ConditionPathExists=/etc/krb5.keytab [Service] diff --git a/systemd/nfs-client.target b/systemd/nfs-client.target index 474f5e9..9b792a3 100644 --- a/systemd/nfs-client.target +++ b/systemd/nfs-client.target @@ -5,9 +5,12 @@ Wants=remote-fs-pre.target # Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to # start that on demand if needed. -Wants=rpc-gssd.service rpc-svcgssd.service auth-rpcgss-module.service Wants=nfs-blkmap.service rpc-statd-notify.service -Before=rpc-gssd.service rpc-svcgssd.service nfs-blkmap.service +After=nfs-blkmap.service + +# GSS services dependencies and ordering +Wants=auth-rpcgss-module.service +After=rpc-gssd.service rpc-svcgssd.service gssproxy.service [Install] WantedBy=multi-user.target diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service index 1048c5c..8010aad 100644 --- a/systemd/nfs-server.service +++ b/systemd/nfs-server.service @@ -2,15 +2,17 @@ Description=NFS server and services Requires= network.target proc-fs-nfsd.mount rpcbind.target Requires= nfs-mountd.service -Wants=rpc-statd.service nfs-idmapd.service auth-rpcgss-module.service -Wants=rpc-gssd.service gssproxy.service rpc-svcgssd.service +Wants=rpc-statd.service nfs-idmapd.service Wants=rpc-statd-notify.service After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service After= nfs-idmapd.service rpc-statd.service -After= rpc-gssd.service gssproxy.service rpc-svcgssd.service Before= rpc-statd-notify.service +# GSS services dependencies and ordering +Wants=auth-rpcgss-module.service +After=rpc-gssd.service gssproxy.service rpc-svcgssd.service + Wants=nfs-config.service After=nfs-config.service diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py index 1fb3e2f..9a6ec43 100644 --- a/tools/mountstats/mountstats.py +++ b/tools/mountstats/mountstats.py @@ -272,8 +272,11 @@ class DeviceData: print('%s:' % op) print('\t%d ops (%d%%)' % \ (count, ((count * 100) / sends)), end=' ') - print('\t%d retrans (%d%%)' % (retrans, ((retrans * 100) / count)), end=' ') - print('\t%d major timeouts' % stats[2]) + if retrans != 0: + print('\t%d retrans (%d%%)' % (retrans, ((retrans * 100) / count)), end=' ') + print('\t%d major timeouts' % stats[2]) + else: + print('') print('\tavg bytes sent per op: %d\tavg bytes received per op: %d' % \ (stats[3] / count, stats[4] / count)) print('\tbacklog wait: %f' % (float(stats[5]) / count), end=' ') diff --git a/utils/mount/mount_libmount.c b/utils/mount/mount_libmount.c index 6f85dc9..fa46d54 100644 --- a/utils/mount/mount_libmount.c +++ b/utils/mount/mount_libmount.c @@ -174,7 +174,7 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv) { int rc, c; char *spec = NULL, *opts = NULL; - int ret = EX_FAIL; + int ret = EX_FAIL, verbose = 0; static const struct option longopts[] = { { "force", 0, 0, 'f' }, @@ -201,6 +201,8 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv) return EX_USAGE; } + verbose = mnt_context_is_verbose(cxt); + if (optind < argc) spec = argv[optind++]; @@ -228,6 +230,10 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv) goto err; } + if (verbose) + printf(_("%s: %s mount point detected\n"), spec, + mnt_context_get_fstype(cxt)); + opts = retrieve_mount_options(mnt_context_get_fs(cxt)); if (!mnt_context_is_lazy(cxt)) { @@ -263,6 +269,12 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv) } ret = EX_SUCCESS; err: + if (verbose) { + if (ret == EX_SUCCESS) + printf(_("%s: umounted\n"), spec); + else + printf(_("%s: umount failed\n"), spec); + } free(opts); return ret; } diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c index e0d31e7..5d62078 100644 --- a/utils/nfsidmap/nfsidmap.c +++ b/utils/nfsidmap/nfsidmap.c @@ -25,7 +25,7 @@ char *usage="Usage: %s [-v] [-c || [-u|-g|-r key] || [-t timeout] key desc]"; #define PROCKEYS "/proc/keys" #ifndef DEFAULT_KEYRING -#define DEFAULT_KEYRING "id_resolver" +#define DEFAULT_KEYRING ".id_resolver" #endif #ifndef PATH_IDMAPDCONF @@ -209,10 +209,23 @@ static int key_invalidate(char *keystr, int keymask) *(strchr(buf, ' ')) = '\0'; sscanf(buf, "%x", &key); - if (keyctl_invalidate(key) < 0) { - xlog_err("keyctl_invalidate(0x%x) failed: %m", key); - fclose(fp); - return 1; +/* older libkeyutils compatibility */ +#ifndef KEYCTL_INVALIDATE +#define KEYCTL_INVALIDATE 21 /* invalidate a key */ +#endif + if (keyctl(KEYCTL_INVALIDATE, key) < 0) { + if (errno != EOPNOTSUPP) { + xlog_err("keyctl_invalidate(0x%x) failed: %m", key); + fclose(fp); + return 1; + } else { + /* older kernel compatibility attempt: */ + if (keyctl_revoke(key) < 0) { + xlog_err("keyctl_revoke(0x%x) failed: %m", key); + fclose(fp); + return 1; + } + } } keymask &= ~mask; @@ -316,6 +329,9 @@ int main(int argc, char **argv) key, type, value, timeout); } + /* Become a possesor of the to-be-instantiated key to set the key's timeout */ + request_key("keyring", DEFAULT_KEYRING, NULL, KEY_SPEC_THREAD_KEYRING); + if (strcmp(type, "uid") == 0) rc = id_lookup(value, key, USER); else if (strcmp(type, "gid") == 0) diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index 18e4d27..9f481db 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -558,7 +558,7 @@ print_server_stats(int opt_prt) ; } else { print_numbers(LABEL_srvrpc - "calls badcalls badclnt badauth xdrcall\n", + "calls badcalls badfmt badauth badclnt\n", srvrpcinfo, 5); printf("\n"); }