commit
546d749398
@ -0,0 +1 @@
|
|||||||
|
SOURCES/nfs-utils-2.5.4.tar.xz
|
@ -0,0 +1 @@
|
|||||||
|
1b097d511c85f95671619f51b37abd75d56ea777 SOURCES/nfs-utils-2.5.4.tar.xz
|
@ -0,0 +1,9 @@
|
|||||||
|
[ NFSMount_Global_Options ]
|
||||||
|
# This statically named section defines global mount
|
||||||
|
# options that can be applied on all NFS mount.
|
||||||
|
#
|
||||||
|
# Setting this option makes it mandatory the server supports the
|
||||||
|
# given version. The mount will fail if the given version is
|
||||||
|
# not support by the server.
|
||||||
|
Nfsvers=4
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
[service/nfs-server]
|
||||||
|
mechs = krb5
|
||||||
|
socket = /run/gssproxy.sock
|
||||||
|
cred_store = keytab:/etc/krb5.keytab
|
||||||
|
trusted = yes
|
||||||
|
kernel_nfsd = yes
|
||||||
|
euid = 0
|
@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# nfsidmap(5) - The NFS idmapper upcall program
|
||||||
|
# Summary: Used by NFSv4 to map user/group ids into
|
||||||
|
# user/group names and names into in ids
|
||||||
|
# Options:
|
||||||
|
# -v Increases the verbosity of the output to syslog
|
||||||
|
# -t timeout Set the expiration timer, in seconds, on the key
|
||||||
|
#
|
||||||
|
create id_resolver * * /usr/sbin/nfsidmap %k %d
|
@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# Set the NFS lock manager grace period. n is measured in seconds.
|
||||||
|
#options lockd nlm_grace_period=90
|
||||||
|
#
|
||||||
|
# Set the TCP port that the NFS lock manager should use.
|
||||||
|
# port must be a valid TCP port value (1-65535).
|
||||||
|
#options lockd nlm_tcpport
|
||||||
|
#
|
||||||
|
# Set the UDP port that the NFS lock manager should use.
|
||||||
|
# port must be a valid UDP port value (1-65535).
|
||||||
|
#options lockd nlm_udpport
|
||||||
|
#
|
||||||
|
# Set the maximum number of outstanding connections
|
||||||
|
#options lockd nlm_max_connections=1024
|
||||||
|
#
|
||||||
|
# Set the default time value for the NFS lock manager
|
||||||
|
# in seconds. Default is 10 secs (min 3 max 20)
|
||||||
|
#options lockd nlm_timeout=10
|
||||||
|
#
|
||||||
|
# Choose whether to record the caller_name or IP address
|
||||||
|
# this peer in the local rpc.statd's database.
|
||||||
|
#options lockd nsm_use_hostnames=0
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
diff -up nfs-utils-2.1.1/support/nfs/exports.c.orig nfs-utils-2.1.1/support/nfs/exports.c
|
||||||
|
--- nfs-utils-2.1.1/support/nfs/exports.c.orig 2017-01-12 10:21:39.000000000 -0500
|
||||||
|
+++ nfs-utils-2.1.1/support/nfs/exports.c 2017-04-26 12:46:24.186480312 -0400
|
||||||
|
@@ -507,7 +507,7 @@ void fix_pseudoflavor_flags(struct expor
|
||||||
|
static int
|
||||||
|
parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
|
||||||
|
{
|
||||||
|
- int had_subtree_opt = 0;
|
||||||
|
+ int had_subtree_opt = 1;
|
||||||
|
char *flname = efname?efname:"command line";
|
||||||
|
int flline = efp?efp->x_line:0;
|
||||||
|
unsigned int active = 0;
|
@ -0,0 +1,58 @@
|
|||||||
|
diff -up nfs-utils-2.5.4/utils/statd/sm-notify.man.orig nfs-utils-2.5.4/utils/statd/sm-notify.man
|
||||||
|
--- nfs-utils-2.5.4/utils/statd/sm-notify.man.orig 2021-06-10 14:07:47.000000000 -0400
|
||||||
|
+++ nfs-utils-2.5.4/utils/statd/sm-notify.man 2021-06-24 14:46:32.413626193 -0400
|
||||||
|
@@ -184,7 +184,7 @@ where NSM state information resides.
|
||||||
|
If this option is not specified,
|
||||||
|
.B sm-notify
|
||||||
|
uses
|
||||||
|
-.I /var/lib/nfs
|
||||||
|
+.I /var/lib/nfs/statd
|
||||||
|
by default.
|
||||||
|
.IP
|
||||||
|
After starting,
|
||||||
|
@@ -338,13 +338,13 @@ Currently, the
|
||||||
|
command supports sending notification only via datagram transport protocols.
|
||||||
|
.SH FILES
|
||||||
|
.TP 2.5i
|
||||||
|
-.I /var/lib/nfs/sm
|
||||||
|
+.I /var/lib/nfs/statd/sm
|
||||||
|
directory containing monitor list
|
||||||
|
.TP 2.5i
|
||||||
|
-.I /var/lib/nfs/sm.bak
|
||||||
|
+.I /var/lib/nfs/statd/sm.bak
|
||||||
|
directory containing notify list
|
||||||
|
.TP 2.5i
|
||||||
|
-.I /var/lib/nfs/state
|
||||||
|
+.I /var/lib/nfs/statd/state
|
||||||
|
NSM state number for this host
|
||||||
|
.TP 2.5i
|
||||||
|
.I /proc/sys/fs/nfs/nsm_local_state
|
||||||
|
diff -up nfs-utils-2.5.4/utils/statd/statd.man.orig nfs-utils-2.5.4/utils/statd/statd.man
|
||||||
|
--- nfs-utils-2.5.4/utils/statd/statd.man.orig 2021-06-10 14:07:47.000000000 -0400
|
||||||
|
+++ nfs-utils-2.5.4/utils/statd/statd.man 2021-06-24 14:46:32.414626197 -0400
|
||||||
|
@@ -251,7 +251,7 @@ where NSM state information resides.
|
||||||
|
If this option is not specified,
|
||||||
|
.B rpc.statd
|
||||||
|
uses
|
||||||
|
-.I /var/lib/nfs
|
||||||
|
+.I /var/lib/nfs/statd
|
||||||
|
by default.
|
||||||
|
.IP
|
||||||
|
After starting,
|
||||||
|
@@ -431,13 +431,13 @@ If set to a positive integer, has the sa
|
||||||
|
.IR \-\-no\-notify .
|
||||||
|
.SH FILES
|
||||||
|
.TP 2.5i
|
||||||
|
-.I /var/lib/nfs/sm
|
||||||
|
+.I /var/lib/nfs/statd/sm
|
||||||
|
directory containing monitor list
|
||||||
|
.TP 2.5i
|
||||||
|
-.I /var/lib/nfs/sm.bak
|
||||||
|
+.I /var/lib/nfs/statd/sm.bak
|
||||||
|
directory containing notify list
|
||||||
|
.TP 2.5i
|
||||||
|
-.I /var/lib/nfs/state
|
||||||
|
+.I /var/lib/nfs/statd/state
|
||||||
|
NSM state number for this host
|
||||||
|
.TP 2.5i
|
||||||
|
.I /run/run.statd.pid
|
@ -0,0 +1,12 @@
|
|||||||
|
diff -up nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c.orig nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c
|
||||||
|
--- nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c.orig 2019-11-11 14:15:50.000000000 -0500
|
||||||
|
+++ nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c 2019-11-11 14:29:47.355661037 -0500
|
||||||
|
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
|
xlog_stderr(verbose);
|
||||||
|
if ((argc - optind) != 2) {
|
||||||
|
- xlog_warn("Bad arg count. Check /etc/request-key.conf");
|
||||||
|
+ xlog_warn("Bad arg count. Check /etc/request-key.d/request-key.conf");
|
||||||
|
xlog_warn(USAGE, progname);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
diff -up nfs-utils-2.5.2/systemd/nfs-server.service.orig nfs-utils-2.5.2/systemd/nfs-server.service
|
||||||
|
--- nfs-utils-2.5.2/systemd/nfs-server.service.orig 2020-12-16 12:31:27.677558163 -0500
|
||||||
|
+++ nfs-utils-2.5.2/systemd/nfs-server.service 2020-12-16 12:33:56.751806659 -0500
|
||||||
|
@@ -23,6 +23,7 @@ Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStartPre=-/usr/sbin/exportfs -r
|
||||||
|
ExecStart=/usr/sbin/rpc.nfsd
|
||||||
|
+ExecStart=-/bin/sh -c 'if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi'
|
||||||
|
ExecStop=/usr/sbin/rpc.nfsd 0
|
||||||
|
ExecStopPost=/usr/sbin/exportfs -au
|
||||||
|
ExecStopPost=/usr/sbin/exportfs -f
|
@ -0,0 +1,89 @@
|
|||||||
|
diff -up nfs-utils-2.5.4/utils/mountd/mountd.man.orig nfs-utils-2.5.4/utils/mountd/mountd.man
|
||||||
|
--- nfs-utils-2.5.4/utils/mountd/mountd.man.orig 2022-01-22 16:56:29.715967394 -0500
|
||||||
|
+++ nfs-utils-2.5.4/utils/mountd/mountd.man 2022-01-22 16:57:07.494103095 -0500
|
||||||
|
@@ -291,36 +291,7 @@ section include
|
||||||
|
which each have the same meaning as given by
|
||||||
|
.BR rpc.nfsd (8).
|
||||||
|
|
||||||
|
-.SH TCP_WRAPPERS SUPPORT
|
||||||
|
-You can protect your
|
||||||
|
-.B rpc.mountd
|
||||||
|
-listeners using the
|
||||||
|
-.B tcp_wrapper
|
||||||
|
-library or
|
||||||
|
-.BR iptables (8).
|
||||||
|
-.PP
|
||||||
|
-Note that the
|
||||||
|
-.B tcp_wrapper
|
||||||
|
-library supports only IPv4 networking.
|
||||||
|
-.PP
|
||||||
|
-Add the hostnames of NFS peers that are allowed to access
|
||||||
|
-.B rpc.mountd
|
||||||
|
-to
|
||||||
|
-.IR /etc/hosts.allow .
|
||||||
|
-Use the daemon name
|
||||||
|
-.B mountd
|
||||||
|
-even if the
|
||||||
|
-.B rpc.mountd
|
||||||
|
-binary has a different name.
|
||||||
|
-.PP
|
||||||
|
-Hostnames used in either access file will be ignored when
|
||||||
|
-they can not be resolved into IP addresses.
|
||||||
|
-For further information see the
|
||||||
|
-.BR tcpd (8)
|
||||||
|
-and
|
||||||
|
-.BR hosts_access (5)
|
||||||
|
-man pages.
|
||||||
|
-.SS IPv6 and TI-RPC support
|
||||||
|
+.SH IPv6 and TI-RPC support
|
||||||
|
TI-RPC is a pre-requisite for supporting NFS on IPv6.
|
||||||
|
If TI-RPC support is built into
|
||||||
|
.BR rpc.mountd ,
|
||||||
|
@@ -347,7 +318,6 @@ table of clients accessing server's expo
|
||||||
|
.BR nfs (5),
|
||||||
|
.BR nfs.conf (5),
|
||||||
|
.BR tcpd (8),
|
||||||
|
-.BR hosts_access (5),
|
||||||
|
.BR iptables (8),
|
||||||
|
.BR netconfig (5)
|
||||||
|
.sp
|
||||||
|
diff -up nfs-utils-2.5.4/utils/statd/statd.man.orig nfs-utils-2.5.4/utils/statd/statd.man
|
||||||
|
--- nfs-utils-2.5.4/utils/statd/statd.man.orig 2022-01-22 16:56:29.718967405 -0500
|
||||||
|
+++ nfs-utils-2.5.4/utils/statd/statd.man 2022-01-22 16:57:07.495103099 -0500
|
||||||
|
@@ -325,28 +325,6 @@ chooses, simply use
|
||||||
|
.BR chown (1)
|
||||||
|
to set the owner of
|
||||||
|
the state directory.
|
||||||
|
-.PP
|
||||||
|
-You can also protect your
|
||||||
|
-.B rpc.statd
|
||||||
|
-listeners using the
|
||||||
|
-.B tcp_wrapper
|
||||||
|
-library or
|
||||||
|
-.BR iptables (8).
|
||||||
|
-To use the
|
||||||
|
-.B tcp_wrapper
|
||||||
|
-library, add the hostnames of peers that should be allowed access to
|
||||||
|
-.IR /etc/hosts.allow .
|
||||||
|
-Use the daemon name
|
||||||
|
-.B statd
|
||||||
|
-even if the
|
||||||
|
-.B rpc.statd
|
||||||
|
-binary has a different filename.
|
||||||
|
-.P
|
||||||
|
-For further information see the
|
||||||
|
-.BR tcpd (8)
|
||||||
|
-and
|
||||||
|
-.BR hosts_access (5)
|
||||||
|
-man pages.
|
||||||
|
.SH ADDITIONAL NOTES
|
||||||
|
Lock recovery after a reboot is critical to maintaining data integrity
|
||||||
|
and preventing unnecessary application hangs.
|
||||||
|
@@ -451,7 +429,6 @@ network transport capability database
|
||||||
|
.BR rpc.nfsd (8),
|
||||||
|
.BR rpcbind (8),
|
||||||
|
.BR tcpd (8),
|
||||||
|
-.BR hosts_access (5),
|
||||||
|
.BR iptables (8),
|
||||||
|
.BR netconfig (5)
|
||||||
|
.sp
|
@ -0,0 +1,21 @@
|
|||||||
|
diff -up nfs-utils-2.3.4/nfs.conf.orig nfs-utils-2.3.4/nfs.conf
|
||||||
|
--- nfs-utils-2.3.4/nfs.conf.orig 2019-05-10 14:49:49.000000000 -0400
|
||||||
|
+++ nfs-utils-2.3.4/nfs.conf 2019-05-10 14:58:20.198714920 -0400
|
||||||
|
@@ -13,7 +13,7 @@
|
||||||
|
# rpc-verbosity=0
|
||||||
|
# use-memcache=0
|
||||||
|
# use-machine-creds=1
|
||||||
|
-# use-gss-proxy=0
|
||||||
|
+use-gss-proxy=1
|
||||||
|
# avoid-dns=1
|
||||||
|
# limit-to-legacy-enctypes=0
|
||||||
|
# context-timeout=0
|
||||||
|
@@ -77,6 +77,5 @@
|
||||||
|
# outgoing-port=
|
||||||
|
# outgoing-addr=
|
||||||
|
# lift-grace=y
|
||||||
|
-#
|
||||||
|
-[svcgssd]
|
||||||
|
-# principal=
|
||||||
|
+
|
||||||
|
+#tag1234 - Used for install purposes only
|
@ -0,0 +1,14 @@
|
|||||||
|
diff -up nfs-utils-2.4.2/systemd/auth-rpcgss-module.service.orig nfs-utils-2.4.2/systemd/auth-rpcgss-module.service
|
||||||
|
--- nfs-utils-2.4.2/systemd/auth-rpcgss-module.service.orig 2019-11-13 12:09:41.000000000 -0500
|
||||||
|
+++ nfs-utils-2.4.2/systemd/auth-rpcgss-module.service 2019-12-18 11:32:04.656735515 -0500
|
||||||
|
@@ -7,8 +7,8 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Kernel Module supporting RPCSEC_GSS
|
||||||
|
DefaultDependencies=no
|
||||||
|
-Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
|
||||||
|
-Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
|
||||||
|
+Before=gssproxy.service rpc-gssd.service
|
||||||
|
+Wants=gssproxy.service rpc-gssd.service
|
||||||
|
ConditionPathExists=/etc/krb5.keytab
|
||||||
|
|
||||||
|
[Service]
|
@ -0,0 +1,25 @@
|
|||||||
|
diff -up nfs-utils-2.5.4/support/export/client.c.orig nfs-utils-2.5.4/support/export/client.c
|
||||||
|
--- nfs-utils-2.5.4/support/export/client.c.orig 2021-06-10 14:07:47.000000000 -0400
|
||||||
|
+++ nfs-utils-2.5.4/support/export/client.c 2023-01-26 11:26:00.279342412 -0500
|
||||||
|
@@ -699,6 +699,9 @@ check_netgroup(const nfs_client *clp, co
|
||||||
|
|
||||||
|
/* check whether the IP itself is in the netgroup */
|
||||||
|
ip = calloc(INET6_ADDRSTRLEN, 1);
|
||||||
|
+ if (ip == NULL)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
if (inet_ntop(ai->ai_family, &(((struct sockaddr_in *)ai->ai_addr)->sin_addr), ip, INET6_ADDRSTRLEN) == ip) {
|
||||||
|
if (innetgr(netgroup, ip, NULL, NULL)) {
|
||||||
|
free(hname);
|
||||||
|
diff -up nfs-utils-2.5.4/tools/nfsrahead/main.c.orig nfs-utils-2.5.4/tools/nfsrahead/main.c
|
||||||
|
--- nfs-utils-2.5.4/tools/nfsrahead/main.c.orig 2023-01-26 11:23:48.941618287 -0500
|
||||||
|
+++ nfs-utils-2.5.4/tools/nfsrahead/main.c 2023-01-26 11:26:00.279342412 -0500
|
||||||
|
@@ -167,7 +167,7 @@ int main(int argc, char **argv)
|
||||||
|
if ((ret = get_device_info(argv[optind], &device)) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
- if (ret != 0) {
|
||||||
|
+ if (ret != 0 || device.fstype == NULL) {
|
||||||
|
xlog(D_GENERAL, "unable to find device %s\n", argv[optind]);
|
||||||
|
goto out;
|
||||||
|
}
|
@ -0,0 +1,131 @@
|
|||||||
|
diff --git a/support/nfsidmap/nss.c b/support/nfsidmap/nss.c
|
||||||
|
index 669760b7..0f43076e 100644
|
||||||
|
--- a/support/nfsidmap/nss.c
|
||||||
|
+++ b/support/nfsidmap/nss.c
|
||||||
|
@@ -365,10 +365,8 @@ static int _nss_name_to_gid(char *name, gid_t *gid, int dostrip)
|
||||||
|
out_buf:
|
||||||
|
free(buf);
|
||||||
|
out_name:
|
||||||
|
- if (dostrip)
|
||||||
|
- free(localname);
|
||||||
|
- if (get_reformat_group())
|
||||||
|
- free(ref_name);
|
||||||
|
+ free(localname);
|
||||||
|
+ free(ref_name);
|
||||||
|
out:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
diff --git a/support/nfsidmap/regex.c b/support/nfsidmap/regex.c
|
||||||
|
index fdbb2e2f..958b4ac8 100644
|
||||||
|
--- a/support/nfsidmap/regex.c
|
||||||
|
+++ b/support/nfsidmap/regex.c
|
||||||
|
@@ -157,6 +157,7 @@ again:
|
||||||
|
IDMAP_LOG(4, ("regexp_getpwnam: name '%s' mapped to '%s'",
|
||||||
|
name, localname));
|
||||||
|
|
||||||
|
+ free(localname);
|
||||||
|
*err_p = 0;
|
||||||
|
return pw;
|
||||||
|
|
||||||
|
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
|
||||||
|
index 4113cbab..833d8e01 100644
|
||||||
|
--- a/utils/gssd/gssd.c
|
||||||
|
+++ b/utils/gssd/gssd.c
|
||||||
|
@@ -1016,7 +1016,7 @@ read_gss_conf(void)
|
||||||
|
keytabfile = s;
|
||||||
|
s = conf_get_str("gssd", "cred-cache-directory");
|
||||||
|
if (s)
|
||||||
|
- ccachedir = s;
|
||||||
|
+ ccachedir = strdup(s);
|
||||||
|
s = conf_get_str("gssd", "preferred-realm");
|
||||||
|
if (s)
|
||||||
|
preferred_realm = s;
|
||||||
|
@@ -1070,7 +1070,8 @@ main(int argc, char *argv[])
|
||||||
|
keytabfile = optarg;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
- ccachedir = optarg;
|
||||||
|
+ free(ccachedir);
|
||||||
|
+ ccachedir = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
context_timeout = atoi(optarg);
|
||||||
|
@@ -1133,7 +1134,6 @@ main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ccachedir) {
|
||||||
|
- char *ccachedir_copy;
|
||||||
|
char *ptr;
|
||||||
|
|
||||||
|
for (ptr = ccachedir, i = 2; *ptr; ptr++)
|
||||||
|
@@ -1141,8 +1141,7 @@ main(int argc, char *argv[])
|
||||||
|
i++;
|
||||||
|
|
||||||
|
ccachesearch = malloc(i * sizeof(char *));
|
||||||
|
- ccachedir_copy = strdup(ccachedir);
|
||||||
|
- if (!ccachedir_copy || !ccachesearch) {
|
||||||
|
+ if (!ccachesearch) {
|
||||||
|
printerr(0, "malloc failure\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
@@ -1274,6 +1273,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
|
free(preferred_realm);
|
||||||
|
free(ccachesearch);
|
||||||
|
+ free(ccachedir);
|
||||||
|
|
||||||
|
return rc < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
|
||||||
|
index c5f1152e..6d059f33 100644
|
||||||
|
--- a/utils/gssd/krb5_util.c
|
||||||
|
+++ b/utils/gssd/krb5_util.c
|
||||||
|
@@ -1129,6 +1129,12 @@ query_krb5_ccache(const char* cred_cache, char **ret_princname,
|
||||||
|
*str = '\0';
|
||||||
|
*ret_princname = strdup(princstring);
|
||||||
|
*ret_realm = strdup(str+1);
|
||||||
|
+ if (!*ret_princname || !*ret_realm) {
|
||||||
|
+ free(*ret_princname);
|
||||||
|
+ free(*ret_realm);
|
||||||
|
+ *ret_princname = NULL;
|
||||||
|
+ *ret_realm = NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
k5_free_unparsed_name(context, princstring);
|
||||||
|
}
|
||||||
|
@@ -1350,15 +1356,19 @@ gssd_get_krb5_machine_cred_list(char ***list)
|
||||||
|
if (retval)
|
||||||
|
continue;
|
||||||
|
if (i + 1 > listsize) {
|
||||||
|
+ char **tmplist;
|
||||||
|
listsize += listinc;
|
||||||
|
- l = (char **)
|
||||||
|
+ tmplist = (char **)
|
||||||
|
realloc(l, listsize * sizeof(char *));
|
||||||
|
- if (l == NULL) {
|
||||||
|
+ if (tmplist == NULL) {
|
||||||
|
+ gssd_free_krb5_machine_cred_list(l);
|
||||||
|
retval = ENOMEM;
|
||||||
|
goto out_lock;
|
||||||
|
}
|
||||||
|
+ l = tmplist;
|
||||||
|
}
|
||||||
|
if ((l[i++] = strdup(ple->ccname)) == NULL) {
|
||||||
|
+ gssd_free_krb5_machine_cred_list(l);
|
||||||
|
retval = ENOMEM;
|
||||||
|
goto out_lock;
|
||||||
|
}
|
||||||
|
diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c
|
||||||
|
index 2da97615..752fdb66 100644
|
||||||
|
--- a/utils/mountd/rmtab.c
|
||||||
|
+++ b/utils/mountd/rmtab.c
|
||||||
|
@@ -233,6 +233,9 @@ mountlist_list(void)
|
||||||
|
m->ml_directory = strdup(rep->r_path);
|
||||||
|
|
||||||
|
if (m->ml_hostname == NULL || m->ml_directory == NULL) {
|
||||||
|
+ free(m->ml_hostname);
|
||||||
|
+ free(m->ml_directory);
|
||||||
|
+ free(m);
|
||||||
|
mountlist_freeall(mlist);
|
||||||
|
mlist = NULL;
|
||||||
|
xlog(L_ERROR, "%s: memory allocation failed",
|
@ -0,0 +1,33 @@
|
|||||||
|
commit cfe41d6f06af0e7744c1ca30503f93d28aca4d8b
|
||||||
|
Author: NeilBrown <neilb@suse.de>
|
||||||
|
Date: Tue Sep 21 12:47:10 2021 -0400
|
||||||
|
|
||||||
|
gssd: fix crash in debug message.
|
||||||
|
|
||||||
|
A recent cleanup of debug messages added func and tid format specifiers
|
||||||
|
to a debug message (when full hostname was different), but the func name
|
||||||
|
and tid were NOT added as arguments.
|
||||||
|
|
||||||
|
Consequently there weren't enough args, random bytes of the stack were
|
||||||
|
interpreted as a pointer, and rpc.gssd crashed (when -v was specified).
|
||||||
|
|
||||||
|
Fixes: b538862a5135 ("gssd: Cleaned up debug messages")
|
||||||
|
Reviewed-by: Petr Vorel <pvorel@suse.cz>
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
|
||||||
|
index 6d059f33..e3f270e9 100644
|
||||||
|
--- a/utils/gssd/krb5_util.c
|
||||||
|
+++ b/utils/gssd/krb5_util.c
|
||||||
|
@@ -673,8 +673,8 @@ get_full_hostname(const char *inhost, char *outhost, int outhostlen)
|
||||||
|
*c = tolower(*c);
|
||||||
|
|
||||||
|
if (get_verbosity() && strcmp(inhost, outhost))
|
||||||
|
- printerr(1, "%s(0x%0lx): inhost '%s' different than outhost'%s'\n",
|
||||||
|
- inhost, outhost);
|
||||||
|
+ printerr(1, "%s(0x%0lx): inhost '%s' different than outhost '%s'\n",
|
||||||
|
+ __func__, tid, inhost, outhost);
|
||||||
|
|
||||||
|
retval = 0;
|
||||||
|
out:
|
@ -0,0 +1,32 @@
|
|||||||
|
commit c547ad481dca5bc0b0a2e365ebcff3439848f664
|
||||||
|
Author: Rohan Sable <rsable@redhat.com>
|
||||||
|
Date: Mon Feb 14 11:15:22 2022 -0500
|
||||||
|
|
||||||
|
mount.nfs Fix error reporting for already mounted shares
|
||||||
|
|
||||||
|
When mount is triggered for an already mounted
|
||||||
|
share (using auto negotiation), it displays
|
||||||
|
"mount.nfs: Protocol not supported" or
|
||||||
|
"mount.nfs: access denied by server while mounting"
|
||||||
|
instead of EBUSY. This easily causes confusion if
|
||||||
|
the mount was not tried verbose :
|
||||||
|
|
||||||
|
Signed-off-by: Rohan Sable <rsable@redhat.com>
|
||||||
|
Signed-off-by: Yongcheng Yang <yoyang@redhat.com>
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
|
||||||
|
index 3c4e218a..573df6ee 100644
|
||||||
|
--- a/utils/mount/stropts.c
|
||||||
|
+++ b/utils/mount/stropts.c
|
||||||
|
@@ -973,7 +973,9 @@ fall_back:
|
||||||
|
if ((result = nfs_try_mount_v3v2(mi, FALSE)))
|
||||||
|
return result;
|
||||||
|
|
||||||
|
- errno = olderrno;
|
||||||
|
+ if (errno != EBUSY && errno != EACCES)
|
||||||
|
+ errno = olderrno;
|
||||||
|
+
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,253 @@
|
|||||||
|
diff --git a/nfs.conf b/nfs.conf
|
||||||
|
index 8c714ff7..21d3e7b2 100644
|
||||||
|
--- a/nfs.conf
|
||||||
|
+++ b/nfs.conf
|
||||||
|
@@ -68,7 +68,6 @@
|
||||||
|
# lease-time=90
|
||||||
|
# udp=n
|
||||||
|
# tcp=y
|
||||||
|
-# vers2=n
|
||||||
|
# vers3=y
|
||||||
|
# vers4=y
|
||||||
|
# vers4.0=y
|
||||||
|
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
|
||||||
|
index 4436a38a..be487a11 100644
|
||||||
|
--- a/systemd/nfs.conf.man
|
||||||
|
+++ b/systemd/nfs.conf.man
|
||||||
|
@@ -171,7 +171,6 @@ Recognized values:
|
||||||
|
.BR lease-time ,
|
||||||
|
.BR udp ,
|
||||||
|
.BR tcp ,
|
||||||
|
-.BR vers2 ,
|
||||||
|
.BR vers3 ,
|
||||||
|
.BR vers4 ,
|
||||||
|
.BR vers4.0 ,
|
||||||
|
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
|
||||||
|
index 3d3684ef..1d88cbfc 100644
|
||||||
|
--- a/utils/mount/configfile.c
|
||||||
|
+++ b/utils/mount/configfile.c
|
||||||
|
@@ -71,7 +71,7 @@ struct mnt_alias {
|
||||||
|
int mnt_alias_sz = (sizeof(mnt_alias_tab)/sizeof(mnt_alias_tab[0]));
|
||||||
|
|
||||||
|
static const char *version_keys[] = {
|
||||||
|
- "v2", "v3", "v4", "vers", "nfsvers", "minorversion", NULL
|
||||||
|
+ "v3", "v4", "vers", "nfsvers", "minorversion", NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static int strict;
|
||||||
|
diff --git a/utils/mount/mount.nfs.man b/utils/mount/mount.nfs.man
|
||||||
|
index 0409c96f..a78a3b0d 100644
|
||||||
|
--- a/utils/mount/mount.nfs.man
|
||||||
|
+++ b/utils/mount/mount.nfs.man
|
||||||
|
@@ -27,7 +27,7 @@ can mount all NFS file system versions. Under earlier Linux kernel versions,
|
||||||
|
.BR mount.nfs4
|
||||||
|
must be used for mounting NFSv4 file systems while
|
||||||
|
.BR mount.nfs
|
||||||
|
-must be used for NFSv3 and v2.
|
||||||
|
+must be used for NFSv3.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
diff --git a/utils/mount/network.c b/utils/mount/network.c
|
||||||
|
index e803dbbe..0d80d08c 100644
|
||||||
|
--- a/utils/mount/network.c
|
||||||
|
+++ b/utils/mount/network.c
|
||||||
|
@@ -97,7 +97,7 @@ static const char *nfs_transport_opttbl[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *nfs_version_opttbl[] = {
|
||||||
|
- "v2",
|
||||||
|
+ "v2", /* no longer supported */
|
||||||
|
"v3",
|
||||||
|
"v4",
|
||||||
|
"vers",
|
||||||
|
@@ -1290,7 +1290,7 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v
|
||||||
|
else if (found < 0)
|
||||||
|
return 1;
|
||||||
|
else if (found <= 2 ) {
|
||||||
|
- /* v2, v3, v4 */
|
||||||
|
+ /* v3, v4 */
|
||||||
|
version_val = version_key + 1;
|
||||||
|
version->v_mode = V_SPECIFIC;
|
||||||
|
} else if (found > 2 ) {
|
||||||
|
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
|
||||||
|
index f1b76936..83365a37 100644
|
||||||
|
--- a/utils/mount/nfs.man
|
||||||
|
+++ b/utils/mount/nfs.man
|
||||||
|
@@ -12,7 +12,7 @@ created by Sun Microsystems in 1984. NFS was developed
|
||||||
|
to allow file sharing between systems residing
|
||||||
|
on a local area network.
|
||||||
|
Depending on kernel configuration, the Linux NFS client may
|
||||||
|
-support NFS versions 2, 3, 4.0, 4.1, or 4.2.
|
||||||
|
+support NFS versions 3, 4.0, 4.1, or 4.2.
|
||||||
|
.P
|
||||||
|
The
|
||||||
|
.BR mount (8)
|
||||||
|
@@ -941,11 +941,6 @@ file. See
|
||||||
|
.BR nfsmount.conf(5)
|
||||||
|
for details.
|
||||||
|
.SH EXAMPLES
|
||||||
|
-To mount an export using NFS version 2,
|
||||||
|
-use the
|
||||||
|
-.B nfs
|
||||||
|
-file system type and specify the
|
||||||
|
-.B nfsvers=2
|
||||||
|
mount option.
|
||||||
|
To mount using NFS version 3,
|
||||||
|
use the
|
||||||
|
@@ -972,13 +967,6 @@ reasonable defaults for NFS behavior.
|
||||||
|
server:/export /mnt nfs defaults 0 0
|
||||||
|
.fi
|
||||||
|
.P
|
||||||
|
-Here is an example from an /etc/fstab file for an NFS version 2 mount over UDP.
|
||||||
|
-.P
|
||||||
|
-.nf
|
||||||
|
-.ta 8n +16n +6n +6n +30n
|
||||||
|
- server:/export /mnt nfs nfsvers=2,proto=udp 0 0
|
||||||
|
-.fi
|
||||||
|
-.P
|
||||||
|
This example shows how to mount using NFS version 4 over TCP
|
||||||
|
with Kerberos 5 mutual authentication.
|
||||||
|
.P
|
||||||
|
@@ -1071,7 +1059,7 @@ and
|
||||||
|
can safely be allowed to default to the largest values supported by
|
||||||
|
both client and server, independent of the network's MTU size.
|
||||||
|
.SS "Using the mountproto mount option"
|
||||||
|
-This section applies only to NFS version 2 and version 3 mounts
|
||||||
|
+This section applies only to NFS version 3 mounts
|
||||||
|
since NFS version 4 does not use a separate protocol for mount
|
||||||
|
requests.
|
||||||
|
.P
|
||||||
|
@@ -1474,7 +1462,7 @@ the use of the
|
||||||
|
mount option.
|
||||||
|
.SS "Using file locks with NFS"
|
||||||
|
The Network Lock Manager protocol is a separate sideband protocol
|
||||||
|
-used to manage file locks in NFS version 2 and version 3.
|
||||||
|
+used to manage file locks in NFS version 3.
|
||||||
|
To support lock recovery after a client or server reboot,
|
||||||
|
a second sideband protocol --
|
||||||
|
known as the Network Status Manager protocol --
|
||||||
|
@@ -1894,8 +1882,6 @@ RFC 768 for the UDP specification.
|
||||||
|
.br
|
||||||
|
RFC 793 for the TCP specification.
|
||||||
|
.br
|
||||||
|
-RFC 1094 for the NFS version 2 specification.
|
||||||
|
-.br
|
||||||
|
RFC 1813 for the NFS version 3 specification.
|
||||||
|
.br
|
||||||
|
RFC 1832 for the XDR specification.
|
||||||
|
diff --git a/utils/mount/nfsmount.conf b/utils/mount/nfsmount.conf
|
||||||
|
index 6bdc225a..342063f7 100644
|
||||||
|
--- a/utils/mount/nfsmount.conf
|
||||||
|
+++ b/utils/mount/nfsmount.conf
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
# This statically named section defines global mount
|
||||||
|
# options that can be applied on all NFS mount.
|
||||||
|
#
|
||||||
|
-# Protocol Version [2,3,4]
|
||||||
|
+# Protocol Version [3,4]
|
||||||
|
# This defines the default protocol version which will
|
||||||
|
# be used to start the negotiation with the server.
|
||||||
|
# Defaultvers=4
|
||||||
|
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
|
||||||
|
index fa67a66f..3c4e218a 100644
|
||||||
|
--- a/utils/mount/stropts.c
|
||||||
|
+++ b/utils/mount/stropts.c
|
||||||
|
@@ -357,6 +357,7 @@ static int nfs_insert_sloppy_option(struct mount_options *options)
|
||||||
|
|
||||||
|
static int nfs_set_version(struct nfsmount_info *mi)
|
||||||
|
{
|
||||||
|
+
|
||||||
|
if (!nfs_nfs_version(mi->type, mi->options, &mi->version))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
@@ -1016,7 +1017,6 @@ static int nfs_try_mount(struct nfsmount_info *mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (mi->version.major) {
|
||||||
|
- case 2:
|
||||||
|
case 3:
|
||||||
|
result = nfs_try_mount_v3v2(mi, FALSE);
|
||||||
|
break;
|
||||||
|
@@ -1247,6 +1247,14 @@ static int nfsmount_start(struct nfsmount_info *mi)
|
||||||
|
if (!nfs_validate_options(mi))
|
||||||
|
return EX_FAIL;
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * NFS v2 has been deprecated
|
||||||
|
+ */
|
||||||
|
+ if (mi->version.major == 2) {
|
||||||
|
+ mount_error(mi->spec, mi->node, EOPNOTSUPP);
|
||||||
|
+ return EX_FAIL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Avoid retry and negotiation logic when remounting
|
||||||
|
*/
|
||||||
|
diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man
|
||||||
|
index 77e6299a..a206a3e2 100644
|
||||||
|
--- a/utils/mountd/mountd.man
|
||||||
|
+++ b/utils/mountd/mountd.man
|
||||||
|
@@ -286,10 +286,9 @@ The values recognized in the
|
||||||
|
section include
|
||||||
|
.BR TCP ,
|
||||||
|
.BR UDP ,
|
||||||
|
-.BR vers2 ,
|
||||||
|
.BR vers3 ", and"
|
||||||
|
.B vers4
|
||||||
|
-which each have same same meaning as given by
|
||||||
|
+which each have the same meaning as given by
|
||||||
|
.BR rpc.nfsd (8).
|
||||||
|
|
||||||
|
.SH TCP_WRAPPERS SUPPORT
|
||||||
|
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
|
||||||
|
index b0741718..4016a761 100644
|
||||||
|
--- a/utils/nfsd/nfsd.c
|
||||||
|
+++ b/utils/nfsd/nfsd.c
|
||||||
|
@@ -226,7 +226,6 @@ main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 3:
|
||||||
|
- case 2:
|
||||||
|
NFSCTL_VERUNSET(versbits, c);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
@@ -251,7 +250,6 @@ main(int argc, char **argv)
|
||||||
|
minorvers = minorversset = minormask;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 3:
|
||||||
|
- case 2:
|
||||||
|
NFSCTL_VERSET(versbits, c);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
|
||||||
|
index 2701ba78..634b8a63 100644
|
||||||
|
--- a/utils/nfsd/nfsd.man
|
||||||
|
+++ b/utils/nfsd/nfsd.man
|
||||||
|
@@ -57,7 +57,7 @@ This option can be used to request that
|
||||||
|
.B rpc.nfsd
|
||||||
|
does not offer certain versions of NFS. The current version of
|
||||||
|
.B rpc.nfsd
|
||||||
|
-can support major NFS versions 2,3,4 and the minor versions 4.0, 4.1 and 4.2.
|
||||||
|
+can support major NFS versions 3,4 and the minor versions 4.0, 4.1 and 4.2.
|
||||||
|
.TP
|
||||||
|
.B \-s " or " \-\-syslog
|
||||||
|
By default,
|
||||||
|
@@ -84,7 +84,7 @@ This option can be used to request that
|
||||||
|
.B rpc.nfsd
|
||||||
|
offer certain versions of NFS. The current version of
|
||||||
|
.B rpc.nfsd
|
||||||
|
-can support major NFS versions 2,3,4 and the minor versions 4.0, 4.1 and 4.2.
|
||||||
|
+can support major NFS versions 3,4 and the minor versions 4.0, 4.1 and 4.2.
|
||||||
|
.TP
|
||||||
|
.B \-L " or " \-\-lease-time seconds
|
||||||
|
Set the lease-time used for NFSv4. This corresponds to how often
|
||||||
|
@@ -156,8 +156,6 @@ Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
|
||||||
|
.B TCP
|
||||||
|
Enable or disable TCP support.
|
||||||
|
.TP
|
||||||
|
-.B vers2
|
||||||
|
-.TP
|
||||||
|
.B vers3
|
||||||
|
.TP
|
||||||
|
.B vers4
|
@ -0,0 +1,27 @@
|
|||||||
|
commit ea536a2e641664c8ea439e5e571e757785f587c9
|
||||||
|
Author: Zhi Li <yieli@redhat.com>
|
||||||
|
Date: Mon Oct 24 13:31:41 2022 -0400
|
||||||
|
|
||||||
|
mount.nfs: fix NULL pointer derefernce in nfs_parse_square_bracket
|
||||||
|
|
||||||
|
In function nfs_parse_square_bracket, hostname could be NULL,
|
||||||
|
dereferencing it in free(*hostname) may cause an unexpected segfault.
|
||||||
|
|
||||||
|
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2136807
|
||||||
|
Signed-off-by: Zhi Li <yieli@redhat.com>
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c
|
||||||
|
index 0d3bcb95..2ade5d5d 100644
|
||||||
|
--- a/utils/mount/parse_dev.c
|
||||||
|
+++ b/utils/mount/parse_dev.c
|
||||||
|
@@ -170,7 +170,8 @@ static int nfs_parse_square_bracket(const char *dev,
|
||||||
|
if (pathname) {
|
||||||
|
*pathname = strndup(cbrace, path_len);
|
||||||
|
if (*pathname == NULL) {
|
||||||
|
- free(*hostname);
|
||||||
|
+ if (hostname)
|
||||||
|
+ free(*hostname);
|
||||||
|
return nfs_pdn_nomem_err();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
commit 4dd8d833c9350d42528ada0fd65aee41b712f41d
|
||||||
|
Author: Steve Dickson <steved@redhat.com>
|
||||||
|
Date: Tue Jul 20 17:14:04 2021 -0400
|
||||||
|
|
||||||
|
mount.nfs: Fix the sloppy option processing
|
||||||
|
|
||||||
|
The new mount API broke how the sloppy option is parsed.
|
||||||
|
So the option processing needs to be moved up in
|
||||||
|
the mount.nfs command.
|
||||||
|
|
||||||
|
The option needs to be the first option in the string
|
||||||
|
that is passed into the kernel with the -s mount(8)
|
||||||
|
and/or the -o sloppy is used.
|
||||||
|
|
||||||
|
Commit 92b664ef fixed the process of the -s flag
|
||||||
|
and this version fixes the -o sloppy processing
|
||||||
|
as well works when libmount-mount is and is not
|
||||||
|
enabled plus cleans up the mount options passed
|
||||||
|
to the kernel.
|
||||||
|
|
||||||
|
Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
|
||||||
|
index f98cb47d..f1b76936 100644
|
||||||
|
--- a/utils/mount/nfs.man
|
||||||
|
+++ b/utils/mount/nfs.man
|
||||||
|
@@ -555,6 +555,13 @@ using the FS-Cache facility. See cachefilesd(8)
|
||||||
|
and <kernel_source>/Documentation/filesystems/caching
|
||||||
|
for detail on how to configure the FS-Cache facility.
|
||||||
|
Default value is nofsc.
|
||||||
|
+.TP 1.5i
|
||||||
|
+.B sloppy
|
||||||
|
+The
|
||||||
|
+.B sloppy
|
||||||
|
+option is an alternative to specifying
|
||||||
|
+.BR mount.nfs " -s " option.
|
||||||
|
+
|
||||||
|
.SS "Options for NFS versions 2 and 3 only"
|
||||||
|
Use these options, along with the options in the above subsection,
|
||||||
|
for NFS versions 2 and 3 only.
|
||||||
|
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
|
||||||
|
index 82b054a5..fa67a66f 100644
|
||||||
|
--- a/utils/mount/stropts.c
|
||||||
|
+++ b/utils/mount/stropts.c
|
||||||
|
@@ -339,11 +339,19 @@ static int nfs_verify_lock_option(struct mount_options *options)
|
||||||
|
|
||||||
|
static int nfs_insert_sloppy_option(struct mount_options *options)
|
||||||
|
{
|
||||||
|
- if (!sloppy || linux_version_code() < MAKE_VERSION(2, 6, 27))
|
||||||
|
+ if (linux_version_code() < MAKE_VERSION(2, 6, 27))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
- if (po_insert(options, "sloppy") == PO_FAILED)
|
||||||
|
- return 0;
|
||||||
|
+ if (po_contains(options, "sloppy")) {
|
||||||
|
+ po_remove_all(options, "sloppy");
|
||||||
|
+ sloppy++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (sloppy) {
|
||||||
|
+ if (po_insert(options, "sloppy") == PO_FAILED)
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
commit d4de031fbb2d797ec9e738deda50feec97db7593
|
||||||
|
Author: Steve Dickson <steved@redhat.com>
|
||||||
|
Date: Fri Oct 28 10:56:36 2022 -0400
|
||||||
|
|
||||||
|
nfsd.man: Explain that setting nfsv4=n turns off all v4 versions
|
||||||
|
|
||||||
|
Update the man page to explicitly say setting
|
||||||
|
nfsv4=n turns off all v4 versions
|
||||||
|
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
|
||||||
|
index 634b8a63..bb99fe2b 100644
|
||||||
|
--- a/utils/nfsd/nfsd.man
|
||||||
|
+++ b/utils/nfsd/nfsd.man
|
||||||
|
@@ -159,7 +159,9 @@ Enable or disable TCP support.
|
||||||
|
.B vers3
|
||||||
|
.TP
|
||||||
|
.B vers4
|
||||||
|
-Enable or disable a major NFS version. 3 and 4 are normally enabled
|
||||||
|
+Enable or disable
|
||||||
|
+.B all
|
||||||
|
+NFSv4 versions. All versions are normally enabled
|
||||||
|
by default.
|
||||||
|
.TP
|
||||||
|
.B vers4.1
|
@ -0,0 +1,86 @@
|
|||||||
|
diff -up nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c.orig nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c
|
||||||
|
--- nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c.orig 2021-06-10 14:07:47.000000000 -0400
|
||||||
|
+++ nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c 2021-08-18 13:44:11.839124879 -0400
|
||||||
|
@@ -507,7 +507,7 @@ cltrack_gracedone(const char *timestr)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *tail;
|
||||||
|
- time_t gracetime;
|
||||||
|
+ uint64_t gracetime;
|
||||||
|
|
||||||
|
|
||||||
|
ret = sqlite_prepare_dbh(storagedir);
|
||||||
|
diff -up nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c.orig nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c
|
||||||
|
--- nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c.orig 2021-06-10 14:07:47.000000000 -0400
|
||||||
|
+++ nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c 2021-08-18 13:48:16.264408309 -0400
|
||||||
|
@@ -48,6 +48,7 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sqlite3.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
|
|
||||||
|
#include "xlog.h"
|
||||||
|
@@ -539,7 +540,7 @@ out_err:
|
||||||
|
* remove any client records that were not reclaimed since grace_start.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
-sqlite_remove_unreclaimed(time_t grace_start)
|
||||||
|
+sqlite_remove_unreclaimed(uint64_t grace_start)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *err = NULL;
|
||||||
|
diff -up nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h.orig nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h
|
||||||
|
--- nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h.orig 2021-06-10 14:07:47.000000000 -0400
|
||||||
|
+++ nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h 2021-08-18 13:44:11.839124879 -0400
|
||||||
|
@@ -26,7 +26,7 @@ int sqlite_insert_client(const unsigned
|
||||||
|
int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
|
||||||
|
int sqlite_check_client(const unsigned char *clname, const size_t namelen,
|
||||||
|
const bool has_session);
|
||||||
|
-int sqlite_remove_unreclaimed(const time_t grace_start);
|
||||||
|
+int sqlite_remove_unreclaimed(const uint64_t grace_start);
|
||||||
|
int sqlite_query_reclaiming(const time_t grace_start);
|
||||||
|
|
||||||
|
#endif /* _SQLITE_H */
|
||||||
|
diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
|
||||||
|
index 2f8bea81..7c1c4bcc 100644
|
||||||
|
--- a/utils/nfsdcltrack/nfsdcltrack.c
|
||||||
|
+++ b/utils/nfsdcltrack/nfsdcltrack.c
|
||||||
|
@@ -33,6 +33,7 @@
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
+#include <inttypes.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <sys/inotify.h>
|
||||||
|
@@ -525,7 +526,7 @@ cltrack_gracedone(const char *timestr)
|
||||||
|
if (*tail)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
- xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
|
||||||
|
+ xlog(D_GENERAL, "%s: grace done. gracetime=%"PRIu64, __func__, gracetime);
|
||||||
|
|
||||||
|
ret = sqlite_remove_unreclaimed(gracetime);
|
||||||
|
|
||||||
|
diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
|
||||||
|
index b6573544..78c22af8 100644
|
||||||
|
--- a/utils/nfsdcltrack/sqlite.c
|
||||||
|
+++ b/utils/nfsdcltrack/sqlite.c
|
||||||
|
@@ -46,6 +46,7 @@
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
+#include <inttypes.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sqlite3.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
@@ -545,7 +546,7 @@ sqlite_remove_unreclaimed(uint64_t grace_start)
|
||||||
|
int ret;
|
||||||
|
char *err = NULL;
|
||||||
|
|
||||||
|
- ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
|
||||||
|
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %"PRIu64,
|
||||||
|
grace_start);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
@ -0,0 +1,37 @@
|
|||||||
|
commit 28deb4f398363e4e75ea41ff0fe604b11f6ee91a
|
||||||
|
Author: Olga Kornievskaia <kolga@netapp.com>
|
||||||
|
Date: Tue Sep 21 13:00:12 2021 -0400
|
||||||
|
|
||||||
|
nfs.man: adding new mount option max_connect
|
||||||
|
|
||||||
|
When client discovers trunkable servers, instead of dropping newly
|
||||||
|
created trunkable connections, add this connection to the existing
|
||||||
|
RPC client.
|
||||||
|
|
||||||
|
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
|
||||||
|
index f1b76936..57a693fd 100644
|
||||||
|
--- a/utils/mount/nfs.man
|
||||||
|
+++ b/utils/mount/nfs.man
|
||||||
|
@@ -416,6 +416,19 @@ Note that the
|
||||||
|
option may also be used by some pNFS drivers to decide how many
|
||||||
|
connections to set up to the data servers.
|
||||||
|
.TP 1.5i
|
||||||
|
+.BR max_connect= n
|
||||||
|
+While
|
||||||
|
+.BR nconnect
|
||||||
|
+option sets a limit on the number of connections that can be established
|
||||||
|
+to a given server IP,
|
||||||
|
+.BR max_connect
|
||||||
|
+option allows the user to specify maximum number of connections to different
|
||||||
|
+server IPs that belong to the same NFSv4.1+ server (session trunkable
|
||||||
|
+connections) up to a limit of 16. When client discovers that it established
|
||||||
|
+a client ID to an already existing server, instead of dropping the newly
|
||||||
|
+created network transport, the client will add this new connection to the
|
||||||
|
+list of available transports for that RPC client.
|
||||||
|
+.TP 1.5i
|
||||||
|
.BR rdirplus " / " nordirplus
|
||||||
|
Selects whether to use NFS v3 or v4 READDIRPLUS requests.
|
||||||
|
If this option is not specified, the NFS client uses READDIRPLUS requests
|
@ -0,0 +1,406 @@
|
|||||||
|
diff --git a/.gitignore b/.gitignore
|
||||||
|
index c89d1cd2..df791a83 100644
|
||||||
|
--- a/.gitignore
|
||||||
|
+++ b/.gitignore
|
||||||
|
@@ -61,6 +61,8 @@ utils/statd/statd
|
||||||
|
tools/locktest/testlk
|
||||||
|
tools/getiversion/getiversion
|
||||||
|
tools/nfsconf/nfsconf
|
||||||
|
+tools/nfsrahead/nfsrahead
|
||||||
|
+tools/nfsrahead/99-nfs_bdi.rules
|
||||||
|
support/export/mount.h
|
||||||
|
support/export/mount_clnt.c
|
||||||
|
support/export/mount_xdr.c
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index d01ce6e4..3f48bd54 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -251,6 +251,16 @@ AC_ARG_ENABLE(nfsdcld,
|
||||||
|
enable_nfsdcld=$enableval,
|
||||||
|
enable_nfsdcld="yes")
|
||||||
|
|
||||||
|
+AC_ARG_ENABLE(nfsrahead,
|
||||||
|
+ [AS_HELP_STRING([--disable-nfsrahead],[disable nfsrahead command @<:@default=no@:>@])],
|
||||||
|
+ enable_nfsrahead=$enableval,
|
||||||
|
+ enable_nfsrahead="yes")
|
||||||
|
+ AM_CONDITIONAL(CONFIG_NFSRAHEAD, [test "$enable_nfsrahead" = "yes" ])
|
||||||
|
+ if test "$enable_nfsrahead" = yes; then
|
||||||
|
+ dnl Check for -lmount
|
||||||
|
+ PKG_CHECK_MODULES([LIBMOUNT], [mount])
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
AC_ARG_ENABLE(nfsdcltrack,
|
||||||
|
[AC_HELP_STRING([--disable-nfsdcltrack],
|
||||||
|
[disable NFSv4 clientid tracking programs @<:@default=no@:>@])],
|
||||||
|
@@ -712,6 +722,7 @@ AC_CONFIG_FILES([
|
||||||
|
tools/rpcgen/Makefile
|
||||||
|
tools/mountstats/Makefile
|
||||||
|
tools/nfs-iostat/Makefile
|
||||||
|
+ tools/nfsrahead/Makefile
|
||||||
|
tools/rpcctl/Makefile
|
||||||
|
tools/nfsdclnts/Makefile
|
||||||
|
tools/nfsconf/Makefile
|
||||||
|
diff --git a/nfs.conf b/nfs.conf
|
||||||
|
index bc1de8d1..6aec1dd9 100644
|
||||||
|
--- a/nfs.conf
|
||||||
|
+++ b/nfs.conf
|
||||||
|
@@ -5,6 +5,10 @@
|
||||||
|
[general]
|
||||||
|
# pipefs-directory=/var/lib/nfs/rpc_pipefs
|
||||||
|
#
|
||||||
|
+[nfsrahead]
|
||||||
|
+# nfs=15000
|
||||||
|
+# nfs4=16000
|
||||||
|
+#
|
||||||
|
[exports]
|
||||||
|
# rootdir=/export
|
||||||
|
#
|
||||||
|
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
|
||||||
|
index be487a11..e74083e9 100644
|
||||||
|
--- a/systemd/nfs.conf.man
|
||||||
|
+++ b/systemd/nfs.conf.man
|
||||||
|
@@ -294,6 +294,17 @@ Only
|
||||||
|
.B debug=
|
||||||
|
is recognized.
|
||||||
|
|
||||||
|
+.TP
|
||||||
|
+.B nfsrahead
|
||||||
|
+Recognized values:
|
||||||
|
+.BR nfs ,
|
||||||
|
+.BR nfsv4 ,
|
||||||
|
+.BR default .
|
||||||
|
+
|
||||||
|
+See
|
||||||
|
+.BR nfsrahead (5)
|
||||||
|
+for deatils.
|
||||||
|
+
|
||||||
|
.SH FILES
|
||||||
|
.TP 10n
|
||||||
|
.I /etc/nfs.conf
|
||||||
|
diff --git a/tools/Makefile.am b/tools/Makefile.am
|
||||||
|
index c3feabbe..48fd0cdf 100644
|
||||||
|
--- a/tools/Makefile.am
|
||||||
|
+++ b/tools/Makefile.am
|
||||||
|
@@ -12,6 +12,10 @@ if CONFIG_NFSDCLD
|
||||||
|
OPTDIRS += nfsdclddb
|
||||||
|
endif
|
||||||
|
|
||||||
|
+if CONFIG_NFSRAHEAD
|
||||||
|
+OPTDIRS += nfsrahead
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat rpcctl nfsdclnts $(OPTDIRS)
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
diff --git a/tools/nfsrahead/99-nfs.rules b/tools/nfsrahead/99-nfs.rules
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..c74914b2
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/nfsrahead/99-nfs.rules
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+SUBSYSTEM=="bdi", ACTION=="add", PROGRAM="/usr/libexec/nfsrahead %k", ATTR{read_ahead_kb}="%c"
|
||||||
|
diff --git a/tools/nfsrahead/99-nfs.rules.in b/tools/nfsrahead/99-nfs.rules.in
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..648813c5
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/nfsrahead/99-nfs.rules.in
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+SUBSYSTEM=="bdi", ACTION=="add", PROGRAM="_libexecdir_/nfsrahead %k", ATTR{read_ahead_kb}="%c"
|
||||||
|
diff --git a/tools/nfsrahead/Makefile.am b/tools/nfsrahead/Makefile.am
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..7e08233a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/nfsrahead/Makefile.am
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+libexec_PROGRAMS = nfsrahead
|
||||||
|
+nfsrahead_SOURCES = main.c
|
||||||
|
+nfsrahead_LDFLAGS= $(LIBMOUNT_LIBS)
|
||||||
|
+nfsrahead_LDADD = ../../support/nfs/libnfsconf.la
|
||||||
|
+
|
||||||
|
+man5_MANS = nfsrahead.man
|
||||||
|
+EXTRA_DIST = $(man5_MANS)
|
||||||
|
+
|
||||||
|
+udev_rulesdir = /usr/lib/udev/rules.d/
|
||||||
|
+udev_rules_DATA = 99-nfs.rules
|
||||||
|
+
|
||||||
|
+99-nfs.rules: 99-nfs.rules.in $(builddefs)
|
||||||
|
+ $(SED) "s|_libexecdir_|@libexecdir@|g" 99-nfs.rules.in > $@
|
||||||
|
+
|
||||||
|
+clean-local:
|
||||||
|
+ $(RM) 99-nfs.rules
|
||||||
|
diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..c83c6f71
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/nfsrahead/main.c
|
||||||
|
@@ -0,0 +1,192 @@
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+#include <libmount/libmount.h>
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+
|
||||||
|
+#include "xlog.h"
|
||||||
|
+#include "conffile.h"
|
||||||
|
+
|
||||||
|
+#ifndef MOUNTINFO_PATH
|
||||||
|
+#define MOUNTINFO_PATH "/proc/self/mountinfo"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#define CONF_NAME "nfsrahead"
|
||||||
|
+#define NFS_DEFAULT_READAHEAD 128
|
||||||
|
+
|
||||||
|
+/* Device information from the system */
|
||||||
|
+struct device_info {
|
||||||
|
+ char *device_number;
|
||||||
|
+ dev_t dev;
|
||||||
|
+ char *mountpoint;
|
||||||
|
+ char *fstype;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Convert a string in the format n:m to a device number */
|
||||||
|
+static int fill_device_number(struct device_info *info)
|
||||||
|
+{
|
||||||
|
+ char *s = strdup(info->device_number), *p;
|
||||||
|
+ char *maj_s, *min_s;
|
||||||
|
+ unsigned int maj, min;
|
||||||
|
+ int err = -EINVAL;
|
||||||
|
+
|
||||||
|
+ maj_s = p = s;
|
||||||
|
+ for ( ; *p != ':' && *p != '\0'; p++)
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+ if (*p == '\0')
|
||||||
|
+ goto out_free;
|
||||||
|
+
|
||||||
|
+ err = 0;
|
||||||
|
+ *p = '\0';
|
||||||
|
+ min_s = p + 1;
|
||||||
|
+
|
||||||
|
+ maj = strtol(maj_s, NULL, 10);
|
||||||
|
+ min = strtol(min_s, NULL, 10);
|
||||||
|
+
|
||||||
|
+ info->dev = makedev(maj, min);
|
||||||
|
+out_free:
|
||||||
|
+ free(s);
|
||||||
|
+ return err;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#define sfree(ptr) if (ptr) free(ptr)
|
||||||
|
+
|
||||||
|
+/* device_info maintenance */
|
||||||
|
+static void init_device_info(struct device_info *di, const char *device_number)
|
||||||
|
+{
|
||||||
|
+ di->device_number = strdup(device_number);
|
||||||
|
+ di->dev = 0;
|
||||||
|
+ di->mountpoint = NULL;
|
||||||
|
+ di->fstype = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void free_device_info(struct device_info *di)
|
||||||
|
+{
|
||||||
|
+ sfree(di->mountpoint);
|
||||||
|
+ sfree(di->fstype);
|
||||||
|
+ sfree(di->device_number);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_mountinfo(const char *device_number, struct device_info *device_info, const char *mountinfo_path)
|
||||||
|
+{
|
||||||
|
+ int ret = 0;
|
||||||
|
+ struct libmnt_table *mnttbl;
|
||||||
|
+ struct libmnt_fs *fs;
|
||||||
|
+ char *target;
|
||||||
|
+
|
||||||
|
+ init_device_info(device_info, device_number);
|
||||||
|
+ if ((ret = fill_device_number(device_info)) < 0)
|
||||||
|
+ goto out_free_device_info;
|
||||||
|
+
|
||||||
|
+ mnttbl = mnt_new_table();
|
||||||
|
+
|
||||||
|
+ if ((ret = mnt_table_parse_file(mnttbl, mountinfo_path)) < 0) {
|
||||||
|
+ xlog(D_GENERAL, "Failed to parse %s\n", mountinfo_path);
|
||||||
|
+ goto out_free_tbl;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((fs = mnt_table_find_devno(mnttbl, device_info->dev, MNT_ITER_FORWARD)) == NULL) {
|
||||||
|
+ ret = ENOENT;
|
||||||
|
+ goto out_free_tbl;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((target = (char *)mnt_fs_get_target(fs)) == NULL) {
|
||||||
|
+ ret = ENOENT;
|
||||||
|
+ goto out_free_fs;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ device_info->mountpoint = strdup(target);
|
||||||
|
+ target = (char *)mnt_fs_get_fstype(fs);
|
||||||
|
+ if (target)
|
||||||
|
+ device_info->fstype = strdup(target);
|
||||||
|
+
|
||||||
|
+out_free_fs:
|
||||||
|
+ mnt_free_fs(fs);
|
||||||
|
+out_free_tbl:
|
||||||
|
+ mnt_free_table(mnttbl);
|
||||||
|
+out_free_device_info:
|
||||||
|
+ free(device_info->device_number);
|
||||||
|
+ device_info->device_number = NULL;
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_device_info(const char *device_number, struct device_info *device_info)
|
||||||
|
+{
|
||||||
|
+ int ret = ENOENT;
|
||||||
|
+ for (int retry_count = 0; retry_count < 10 && ret != 0; retry_count++)
|
||||||
|
+ ret = get_mountinfo(device_number, device_info, MOUNTINFO_PATH);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int conf_get_readahead(const char *kind) {
|
||||||
|
+ int readahead = 0;
|
||||||
|
+
|
||||||
|
+ if((readahead = conf_get_num(CONF_NAME, kind, -1)) == -1)
|
||||||
|
+ readahead = conf_get_num(CONF_NAME, "default", NFS_DEFAULT_READAHEAD);
|
||||||
|
+
|
||||||
|
+ return readahead;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int main(int argc, char **argv)
|
||||||
|
+{
|
||||||
|
+ int ret = 0, retry, opt;
|
||||||
|
+ struct device_info device;
|
||||||
|
+ unsigned int readahead = 128, log_level, log_stderr = 0;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ log_level = D_ALL & ~D_GENERAL;
|
||||||
|
+ while((opt = getopt(argc, argv, "dF")) != -1) {
|
||||||
|
+ switch (opt) {
|
||||||
|
+ case 'd':
|
||||||
|
+ log_level = D_ALL;
|
||||||
|
+ break;
|
||||||
|
+ case 'F':
|
||||||
|
+ log_stderr = 1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ conf_init_file(NFS_CONFFILE);
|
||||||
|
+
|
||||||
|
+ xlog_stderr(log_stderr);
|
||||||
|
+ xlog_syslog(~log_stderr);
|
||||||
|
+ xlog_config(log_level, 1);
|
||||||
|
+ xlog_open(CONF_NAME);
|
||||||
|
+
|
||||||
|
+ // xlog_err causes the system to exit
|
||||||
|
+ if ((argc - optind) != 1)
|
||||||
|
+ xlog_err("expected the device number of a BDI; is udev ok?");
|
||||||
|
+
|
||||||
|
+ for (retry = 0; retry <= 10; retry++ )
|
||||||
|
+ if ((ret = get_device_info(argv[optind], &device)) == 0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ xlog(D_GENERAL, "unable to find device %s\n", argv[optind]);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (strncmp("nfs", device.fstype, 3) != 0) {
|
||||||
|
+ xlog(D_GENERAL,
|
||||||
|
+ "not setting readahead for non supported fstype %s on device %s\n",
|
||||||
|
+ device.fstype, argv[optind]);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ readahead = conf_get_readahead(device.fstype);
|
||||||
|
+
|
||||||
|
+ xlog(D_FAC7, "setting %s readahead to %d\n", device.mountpoint, readahead);
|
||||||
|
+
|
||||||
|
+ printf("%d\n", readahead);
|
||||||
|
+
|
||||||
|
+out:
|
||||||
|
+ free_device_info(&device);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
diff --git a/tools/nfsrahead/nfsrahead.man b/tools/nfsrahead/nfsrahead.man
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..5488f633
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/nfsrahead/nfsrahead.man
|
||||||
|
@@ -0,0 +1,72 @@
|
||||||
|
+.\" Manpage for nfsrahead.
|
||||||
|
+.nh
|
||||||
|
+.ad l
|
||||||
|
+.TH man 5 "08 Mar 2022" "1.0" "nfsrahead man page"
|
||||||
|
+.SH NAME
|
||||||
|
+
|
||||||
|
+nfsrahead \- Configure the readahead for NFS mounts
|
||||||
|
+
|
||||||
|
+.SH SYNOPSIS
|
||||||
|
+
|
||||||
|
+nfsrahead [-F] [-d] <device>
|
||||||
|
+
|
||||||
|
+.SH DESCRIPTION
|
||||||
|
+
|
||||||
|
+\fInfsrahead\fR is a tool intended to be used with udev to set the \fIread_ahead_kb\fR parameter of NFS mounts, according to the configuration file (see \fICONFIGURATION\fR). \fIdevice\fR is the device number for the NFS backing device as provided by the kernel.
|
||||||
|
+
|
||||||
|
+.SH OPTIONS
|
||||||
|
+.TP
|
||||||
|
+.B -F
|
||||||
|
+Send messages to
|
||||||
|
+.I stderr
|
||||||
|
+instead of
|
||||||
|
+.I syslog
|
||||||
|
+
|
||||||
|
+.TP
|
||||||
|
+.B -d
|
||||||
|
+Increase the debugging level.
|
||||||
|
+
|
||||||
|
+.SH CONFIGURATION
|
||||||
|
+.I nfsrahead
|
||||||
|
+is configured in
|
||||||
|
+.IR /etc/nfs.conf ,
|
||||||
|
+in the section titled
|
||||||
|
+.IR nfsrahead .
|
||||||
|
+It accepts the following configurations.
|
||||||
|
+
|
||||||
|
+.TP
|
||||||
|
+.B nfs=<value>
|
||||||
|
+The readahead value applied to NFSv3 mounts.
|
||||||
|
+
|
||||||
|
+.TP
|
||||||
|
+.B nfs4=<value>
|
||||||
|
+The readahead value applied to NFSv4 mounts.
|
||||||
|
+
|
||||||
|
+.TP
|
||||||
|
+.B default=<value>
|
||||||
|
+The default configuration when none of the configurations above is set.
|
||||||
|
+
|
||||||
|
+.SH EXAMPLE CONFIGURATION
|
||||||
|
+[nfsrahead]
|
||||||
|
+.br
|
||||||
|
+nfs=15000 # readahead of 15000 for NFSv3 mounts
|
||||||
|
+.br
|
||||||
|
+nfs4=16000 # readahead of 16000 for NFSv4 mounts
|
||||||
|
+.br
|
||||||
|
+default=128 # default is 128
|
||||||
|
+
|
||||||
|
+.SH SEE ALSO
|
||||||
|
+
|
||||||
|
+.BR mount.nfs (8),
|
||||||
|
+.BR nfs (5),
|
||||||
|
+.BR nfs.conf (5),
|
||||||
|
+.BR udev (7),
|
||||||
|
+.BR bcc-readahead (8)
|
||||||
|
+
|
||||||
|
+.SH BUGS
|
||||||
|
+
|
||||||
|
+No known bugs.
|
||||||
|
+
|
||||||
|
+.SH AUTHOR
|
||||||
|
+
|
||||||
|
+Thiago Rafael Becker <trbecker@gmail.com>
|
@ -0,0 +1,36 @@
|
|||||||
|
diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py
|
||||||
|
index b8df556b..d2110ad6 100755
|
||||||
|
--- a/tools/rpcctl/rpcctl.py
|
||||||
|
+++ b/tools/rpcctl/rpcctl.py
|
||||||
|
@@ -90,10 +90,18 @@ class Xprt:
|
||||||
|
self.dstaddr = write_addr_file(self.path / "dstaddr", newaddr)
|
||||||
|
|
||||||
|
def set_state(self, state):
|
||||||
|
+ if self.info.get("main_xprt"):
|
||||||
|
+ raise Exception(f"Main xprts cannot be set {state}")
|
||||||
|
with open(self.path / "xprt_state", 'w') as f:
|
||||||
|
f.write(state)
|
||||||
|
self.read_state()
|
||||||
|
|
||||||
|
+ def remove(self):
|
||||||
|
+ if self.info.get("main_xprt"):
|
||||||
|
+ raise Exception("Main xprts cannot be removed")
|
||||||
|
+ self.set_state("offline")
|
||||||
|
+ self.set_state("remove")
|
||||||
|
+
|
||||||
|
def add_command(subparser):
|
||||||
|
parser = subparser.add_parser("xprt", help="Commands for individual xprts")
|
||||||
|
parser.set_defaults(func=Xprt.show, xprt=None)
|
||||||
|
@@ -139,10 +147,9 @@ class Xprt:
|
||||||
|
if args.property == "dstaddr":
|
||||||
|
xprt.set_dstaddr(socket.gethostbyname(args.newaddr[0]))
|
||||||
|
elif args.property == "remove":
|
||||||
|
- xprt.set_state("offline")
|
||||||
|
- xprt.set_state("remove")
|
||||||
|
+ xprt.remove()
|
||||||
|
else:
|
||||||
|
- args.set_state(args.property)
|
||||||
|
+ xprt.set_state(args.property)
|
||||||
|
print(xprt)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,377 @@
|
|||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 93520a80..d01ce6e4 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -712,6 +712,7 @@ AC_CONFIG_FILES([
|
||||||
|
tools/rpcgen/Makefile
|
||||||
|
tools/mountstats/Makefile
|
||||||
|
tools/nfs-iostat/Makefile
|
||||||
|
+ tools/rpcctl/Makefile
|
||||||
|
tools/nfsdclnts/Makefile
|
||||||
|
tools/nfsconf/Makefile
|
||||||
|
tools/nfsdclddb/Makefile
|
||||||
|
diff --git a/tools/Makefile.am b/tools/Makefile.am
|
||||||
|
index 9b4b0803..c3feabbe 100644
|
||||||
|
--- a/tools/Makefile.am
|
||||||
|
+++ b/tools/Makefile.am
|
||||||
|
@@ -12,6 +12,6 @@ if CONFIG_NFSDCLD
|
||||||
|
OPTDIRS += nfsdclddb
|
||||||
|
endif
|
||||||
|
|
||||||
|
-SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat nfsdclnts $(OPTDIRS)
|
||||||
|
+SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat rpcctl nfsdclnts $(OPTDIRS)
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
diff --git a/tools/rpcctl/Makefile.am b/tools/rpcctl/Makefile.am
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..33fb431f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/rpcctl/Makefile.am
|
||||||
|
@@ -0,0 +1,13 @@
|
||||||
|
+## Process this file with automake to produce Makefile.in
|
||||||
|
+PYTHON_FILES = rpcctl.py
|
||||||
|
+
|
||||||
|
+man8_MANS = rpcctl.man
|
||||||
|
+
|
||||||
|
+EXTRA_DIST = $(man8_MANS) $(PYTHON_FILES)
|
||||||
|
+
|
||||||
|
+all-local: $(PYTHON_FILES)
|
||||||
|
+
|
||||||
|
+install-data-hook:
|
||||||
|
+ $(INSTALL) -m 755 rpcctl.py $(DESTDIR)$(sbindir)/rpcctl
|
||||||
|
+
|
||||||
|
+MAINTAINERCLEANFILES=Makefile.in
|
||||||
|
diff --git a/tools/rpcctl/rpcctl.man b/tools/rpcctl/rpcctl.man
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..b87ba0df
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/rpcctl/rpcctl.man
|
||||||
|
@@ -0,0 +1,67 @@
|
||||||
|
+.\"
|
||||||
|
+.\" rpcctl(8)
|
||||||
|
+.\"
|
||||||
|
+.TH rpcctl 8 "15 Feb 2022"
|
||||||
|
+.SH NAME
|
||||||
|
+rpcctl \- Displays SunRPC connection information
|
||||||
|
+.SH SYNOPSIS
|
||||||
|
+.nf
|
||||||
|
+.BR rpcctl " [ \fB\-h \fR| \fB\-\-help \fR] { \fBclient \fR| \fBswitch \fR| \fBxprt \fR}"
|
||||||
|
+.P
|
||||||
|
+.BR "rpcctl client" " \fR[ \fB\-h \fR| \fB\-\-help \fR] { \fBshow \fR}"
|
||||||
|
+.BR "rpcctl client show " "\fR[ \fB\-h \f| \fB\-\-help \fR] [ \fIXPRT \fR]"
|
||||||
|
+.P
|
||||||
|
+.BR "rpcctl switch" " \fR[ \fB\-h \fR| \fB\-\-help \fR] { \fBset \fR| \fBshow \fR}"
|
||||||
|
+.BR "rpcctl switch set" " \fR[ \fB\-h \fR| \fB\-\-help \fR] \fISWITCH \fBdstaddr \fINEWADDR"
|
||||||
|
+.BR "rpcctl switch show" " \fR[ \fB\-h \fR| \fB\-\-help \fR] [ \fISWITCH \fR]"
|
||||||
|
+.P
|
||||||
|
+.BR "rpcctl xprt" " \fR[ \fB\-h \fR| \fB\-\-help \fR] { \fBremove \fR| \fBset \fR| \fBshow \fR}"
|
||||||
|
+.BR "rpcctl xprt remove" " \fR[ \fB\-h \fR| \fB\-\-help \fR] \fIXPRT"
|
||||||
|
+.BR "rpcctl xprt set" " \fR[ \fB\-h \fR| \fB\-\-help \fR] \fIXPRT \fR{ \fBdstaddr \fINEWADDR \fR| \fBoffline \fR| \fBonline \fR}"
|
||||||
|
+.BR "rpcctl xprt show" " \fR[ \fB\-h \fR| \fB\-\-help \fR] [ \fIXPRT \fR]"
|
||||||
|
+.fi
|
||||||
|
+.SH DESCRIPTION
|
||||||
|
+.RB "The " rpcctl " command displays information collected in the SunRPC sysfs files about the system's SunRPC objects.
|
||||||
|
+.P
|
||||||
|
+.SS rpcctl client \fR- \fBCommands operating on RPC clients
|
||||||
|
+.IP "\fBshow \fR[ \fICLIENT \fR] \fB(default)"
|
||||||
|
+Show detailed information about the RPC clients on this system.
|
||||||
|
+If \fICLIENT \fRwas provided, then only show information about a single RPC client.
|
||||||
|
+.P
|
||||||
|
+.SS rpcctl switch \fR- \fBCommands operating on groups of transports
|
||||||
|
+.IP "\fBset \fISWITCH \fBdstaddr \fINEWADDR"
|
||||||
|
+Change the destination address of all transports in the \fISWITCH \fRto \fINEWADDR\fR.
|
||||||
|
+\fINEWADDR \fRcan be an IP address, DNS name, or anything else resolvable by \fBgethostbyname\fR(3).
|
||||||
|
+.IP "\fBshow \fR[ \fISWITCH \fR] \fB(default)"
|
||||||
|
+Show detailed information about groups of transports on this system.
|
||||||
|
+If \fISWITCH \fRwas provided, then only show information about a single transport group.
|
||||||
|
+.P
|
||||||
|
+.SS rpcctl xprt \fR- \fBCommands operating on individual transports
|
||||||
|
+.IP "\fBremove \fIXPRT"
|
||||||
|
+Removes the specified \fIXPRT \fRfrom the system.
|
||||||
|
+Note that "main" transports cannot be removed.
|
||||||
|
+.P
|
||||||
|
+.IP "\fBset \fIXPRT \fBdstaddr \fINEWADDR"
|
||||||
|
+Change the destination address of the specified \fIXPRT \fR to \fINEWADDR\fR.
|
||||||
|
+\fINEWADDR \fRcan be an IP address, DNS name, or anything else resolvable by \fBgethostbyname\fR(3).
|
||||||
|
+.P
|
||||||
|
+.IP "\fBset \fIXPRT \fBoffline"
|
||||||
|
+Sets the specified \fIXPRT\fR's state to offline.
|
||||||
|
+.P
|
||||||
|
+.IP "\fBset \fIXPRT \fBonline"
|
||||||
|
+Sets the specified \fIXPRT\fR's state to online.
|
||||||
|
+.IP "\fBshow \fR[ \fIXPRT \fR] \fB(default)"
|
||||||
|
+Show detailed information about this system's transports.
|
||||||
|
+If \fIXPRT \fRwas provided, then only show information about a single transport.
|
||||||
|
+.SH EXAMPLES
|
||||||
|
+.IP "\fBrpcctl switch show switch-2"
|
||||||
|
+Show details about the RPC switch named "switch-2".
|
||||||
|
+.IP "\fBrpcctl xprt remove xprt-4"
|
||||||
|
+Remove the xprt named "xprt-4" from the system.
|
||||||
|
+.IP "\fBrpcctl xprt set xprt-3 dstaddr https://linux-nfs.org
|
||||||
|
+Change the dstaddr of the xprt named "xprt-3" to point to linux-nfs.org
|
||||||
|
+.SH DIRECTORY
|
||||||
|
+.TP
|
||||||
|
+.B /sys/kernel/sunrpc/
|
||||||
|
+.SH AUTHOR
|
||||||
|
+Anna Schumaker <Anna.Schumaker@Netapp.com>
|
||||||
|
diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py
|
||||||
|
new file mode 100755
|
||||||
|
index 00000000..b8df556b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/rpcctl/rpcctl.py
|
||||||
|
@@ -0,0 +1,255 @@
|
||||||
|
+#!/usr/bin/python3
|
||||||
|
+import argparse
|
||||||
|
+import collections
|
||||||
|
+import errno
|
||||||
|
+import os
|
||||||
|
+import pathlib
|
||||||
|
+import socket
|
||||||
|
+import sys
|
||||||
|
+
|
||||||
|
+with open("/proc/mounts", 'r') as f:
|
||||||
|
+ mount = [ line.split()[1] for line in f if "sysfs" in line ]
|
||||||
|
+ if len(mount) == 0:
|
||||||
|
+ print("ERROR: sysfs is not mounted")
|
||||||
|
+ sys.exit(1)
|
||||||
|
+
|
||||||
|
+sunrpc = pathlib.Path(mount[0]) / "kernel" / "sunrpc"
|
||||||
|
+if not sunrpc.is_dir():
|
||||||
|
+ print("ERROR: sysfs does not have sunrpc directory")
|
||||||
|
+ sys.exit(1)
|
||||||
|
+
|
||||||
|
+def read_addr_file(path):
|
||||||
|
+ try:
|
||||||
|
+ with open(path, 'r') as f:
|
||||||
|
+ return f.readline().strip()
|
||||||
|
+ except:
|
||||||
|
+ return "(enoent)"
|
||||||
|
+
|
||||||
|
+def write_addr_file(path, newaddr):
|
||||||
|
+ with open(path, 'w') as f:
|
||||||
|
+ f.write(newaddr)
|
||||||
|
+ return read_addr_file(path)
|
||||||
|
+
|
||||||
|
+def read_info_file(path):
|
||||||
|
+ res = collections.defaultdict(int)
|
||||||
|
+ try:
|
||||||
|
+ with open(path) as info:
|
||||||
|
+ lines = [ l.split("=", 1) for l in info if "=" in l ]
|
||||||
|
+ res.update({ key:int(val.strip()) for (key, val) in lines })
|
||||||
|
+ finally:
|
||||||
|
+ return res
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+class Xprt:
|
||||||
|
+ def __init__(self, path):
|
||||||
|
+ self.path = path
|
||||||
|
+ self.name = path.stem.rsplit("-", 1)[0]
|
||||||
|
+ self.type = path.stem.split("-")[2]
|
||||||
|
+ self.info = read_info_file(path / "xprt_info")
|
||||||
|
+ self.dstaddr = read_addr_file(path / "dstaddr")
|
||||||
|
+ self.srcaddr = read_addr_file(path / "srcaddr")
|
||||||
|
+ self.read_state()
|
||||||
|
+
|
||||||
|
+ def __lt__(self, rhs):
|
||||||
|
+ return self.name < rhs.name
|
||||||
|
+
|
||||||
|
+ def _xprt(self):
|
||||||
|
+ main = ", main" if self.info.get("main_xprt") else ""
|
||||||
|
+ return f"{self.name}: {self.type}, {self.dstaddr}, " \
|
||||||
|
+ f"port {self.info['dst_port']}, state <{self.state}>{main}"
|
||||||
|
+
|
||||||
|
+ def _src_reqs(self):
|
||||||
|
+ return f" Source: {self.srcaddr}, port {self.info['src_port']}, " \
|
||||||
|
+ f"Requests: {self.info['num_reqs']}"
|
||||||
|
+
|
||||||
|
+ def _cong_slots(self):
|
||||||
|
+ return f" Congestion: cur {self.info['cur_cong']}, win {self.info['cong_win']}, " \
|
||||||
|
+ f"Slots: min {self.info['min_num_slots']}, max {self.info['max_num_slots']}"
|
||||||
|
+
|
||||||
|
+ def _queues(self):
|
||||||
|
+ return f" Queues: binding {self.info['binding_q_len']}, " \
|
||||||
|
+ f"sending {self.info['sending_q_len']}, pending {self.info['pending_q_len']}, " \
|
||||||
|
+ f"backlog {self.info['backlog_q_len']}, tasks {self.info['tasks_queuelen']}"
|
||||||
|
+
|
||||||
|
+ def __str__(self):
|
||||||
|
+ if not self.path.exists():
|
||||||
|
+ return f"{self.name}: has been removed"
|
||||||
|
+ return "\n".join([self._xprt(), self._src_reqs(),
|
||||||
|
+ self._cong_slots(), self._queues() ])
|
||||||
|
+
|
||||||
|
+ def read_state(self):
|
||||||
|
+ if self.path.exists():
|
||||||
|
+ with open(self.path / "xprt_state") as f:
|
||||||
|
+ self.state = ','.join(f.readline().split()[1:])
|
||||||
|
+
|
||||||
|
+ def small_str(self):
|
||||||
|
+ main = " [main]" if self.info.get("main_xprt") else ""
|
||||||
|
+ return f"{self.name}: {self.type}, {self.dstaddr}{main}"
|
||||||
|
+
|
||||||
|
+ def set_dstaddr(self, newaddr):
|
||||||
|
+ self.dstaddr = write_addr_file(self.path / "dstaddr", newaddr)
|
||||||
|
+
|
||||||
|
+ def set_state(self, state):
|
||||||
|
+ with open(self.path / "xprt_state", 'w') as f:
|
||||||
|
+ f.write(state)
|
||||||
|
+ self.read_state()
|
||||||
|
+
|
||||||
|
+ def add_command(subparser):
|
||||||
|
+ parser = subparser.add_parser("xprt", help="Commands for individual xprts")
|
||||||
|
+ parser.set_defaults(func=Xprt.show, xprt=None)
|
||||||
|
+ subparser = parser.add_subparsers()
|
||||||
|
+
|
||||||
|
+ remove = subparser.add_parser("remove", help="Remove an xprt")
|
||||||
|
+ remove.add_argument("xprt", metavar="XPRT", nargs=1,
|
||||||
|
+ help="Name of the xprt to remove")
|
||||||
|
+ remove.set_defaults(func=Xprt.set_property, property="remove")
|
||||||
|
+
|
||||||
|
+ show = subparser.add_parser("show", help="Show xprts")
|
||||||
|
+ show.add_argument("xprt", metavar="XPRT", nargs='?',
|
||||||
|
+ help="Name of a specific xprt to show")
|
||||||
|
+ show.set_defaults(func=Xprt.show)
|
||||||
|
+
|
||||||
|
+ set = subparser.add_parser("set", help="Change an xprt property")
|
||||||
|
+ set.add_argument("xprt", metavar="XPRT", nargs=1,
|
||||||
|
+ help="Name of a specific xprt to modify")
|
||||||
|
+ subparser = set.add_subparsers(required=True)
|
||||||
|
+ online = subparser.add_parser("online", help="Set an xprt online")
|
||||||
|
+ online.set_defaults(func=Xprt.set_property, property="online")
|
||||||
|
+ offline = subparser.add_parser("offline", help="Set an xprt offline")
|
||||||
|
+ offline.set_defaults(func=Xprt.set_property, property="offline")
|
||||||
|
+ dstaddr = subparser.add_parser("dstaddr", help="Change an xprt's dstaddr")
|
||||||
|
+ dstaddr.add_argument("newaddr", metavar="NEWADDR", nargs=1,
|
||||||
|
+ help="The new address for the xprt")
|
||||||
|
+ dstaddr.set_defaults(func=Xprt.set_property, property="dstaddr")
|
||||||
|
+
|
||||||
|
+ def get_by_name(name):
|
||||||
|
+ glob = f"**/{name}-*" if name else "**/xprt-*"
|
||||||
|
+ res = [ Xprt(x) for x in (sunrpc / "xprt-switches").glob(glob) ]
|
||||||
|
+ if name and len(res) == 0:
|
||||||
|
+ raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT),
|
||||||
|
+ f"{sunrpc / 'xprt-switches' / glob}")
|
||||||
|
+ return sorted(res)
|
||||||
|
+
|
||||||
|
+ def show(args):
|
||||||
|
+ for xprt in Xprt.get_by_name(args.xprt):
|
||||||
|
+ print(xprt)
|
||||||
|
+
|
||||||
|
+ def set_property(args):
|
||||||
|
+ for xprt in Xprt.get_by_name(args.xprt[0]):
|
||||||
|
+ if args.property == "dstaddr":
|
||||||
|
+ xprt.set_dstaddr(socket.gethostbyname(args.newaddr[0]))
|
||||||
|
+ elif args.property == "remove":
|
||||||
|
+ xprt.set_state("offline")
|
||||||
|
+ xprt.set_state("remove")
|
||||||
|
+ else:
|
||||||
|
+ args.set_state(args.property)
|
||||||
|
+ print(xprt)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+class XprtSwitch:
|
||||||
|
+ def __init__(self, path, sep=":"):
|
||||||
|
+ self.path = path
|
||||||
|
+ self.name = path.stem
|
||||||
|
+ self.info = read_info_file(path / "xprt_switch_info")
|
||||||
|
+ self.xprts = sorted([ Xprt(p) for p in self.path.iterdir() if p.is_dir() ])
|
||||||
|
+ self.sep = sep
|
||||||
|
+
|
||||||
|
+ def __lt__(self, rhs):
|
||||||
|
+ return self.name < rhs.name
|
||||||
|
+
|
||||||
|
+ def __str__(self):
|
||||||
|
+ switch = f"{self.name}{self.sep} " \
|
||||||
|
+ f"xprts {self.info['num_xprts']}, " \
|
||||||
|
+ f"active {self.info['num_active']}, " \
|
||||||
|
+ f"queue {self.info['queue_len']}"
|
||||||
|
+ xprts = [ f" {x.small_str()}" for x in self.xprts ]
|
||||||
|
+ return "\n".join([ switch ] + xprts)
|
||||||
|
+
|
||||||
|
+ def add_command(subparser):
|
||||||
|
+ parser = subparser.add_parser("switch", help="Commands for xprt switches")
|
||||||
|
+ parser.set_defaults(func=XprtSwitch.show, switch=None)
|
||||||
|
+ subparser = parser.add_subparsers()
|
||||||
|
+
|
||||||
|
+ show = subparser.add_parser("show", help="Show xprt switches")
|
||||||
|
+ show.add_argument("switch", metavar="SWITCH", nargs='?',
|
||||||
|
+ help="Name of a specific switch to show")
|
||||||
|
+ show.set_defaults(func=XprtSwitch.show)
|
||||||
|
+
|
||||||
|
+ set = subparser.add_parser("set", help="Change an xprt switch property")
|
||||||
|
+ set.add_argument("switch", metavar="SWITCH", nargs=1,
|
||||||
|
+ help="Name of a specific xprt switch to modify")
|
||||||
|
+ subparser = set.add_subparsers(required=True)
|
||||||
|
+ dstaddr = subparser.add_parser("dstaddr", help="Change an xprt switch's dstaddr")
|
||||||
|
+ dstaddr.add_argument("newaddr", metavar="NEWADDR", nargs=1,
|
||||||
|
+ help="The new address for the xprt switch")
|
||||||
|
+ dstaddr.set_defaults(func=XprtSwitch.set_property, property="dstaddr")
|
||||||
|
+
|
||||||
|
+ def get_by_name(name):
|
||||||
|
+ xprt_switches = sunrpc / "xprt-switches"
|
||||||
|
+ if name:
|
||||||
|
+ return [ XprtSwitch(xprt_switches / name) ]
|
||||||
|
+ return [ XprtSwitch(f) for f in sorted(xprt_switches.iterdir()) ]
|
||||||
|
+
|
||||||
|
+ def show(args):
|
||||||
|
+ for switch in XprtSwitch.get_by_name(args.switch):
|
||||||
|
+ print(switch)
|
||||||
|
+
|
||||||
|
+ def set_property(args):
|
||||||
|
+ for switch in XprtSwitch.get_by_name(args.switch[0]):
|
||||||
|
+ resolved = socket.gethostbyname(args.newaddr[0])
|
||||||
|
+ for xprt in switch.xprts:
|
||||||
|
+ xprt.set_dstaddr(resolved)
|
||||||
|
+ print(switch)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+class RpcClient:
|
||||||
|
+ def __init__(self, path):
|
||||||
|
+ self.path = path
|
||||||
|
+ self.name = path.stem
|
||||||
|
+ self.switch = XprtSwitch(path / (path / "switch").readlink(), sep=",")
|
||||||
|
+
|
||||||
|
+ def __lt__(self, rhs):
|
||||||
|
+ return self.name < rhs.name
|
||||||
|
+
|
||||||
|
+ def __str__(self):
|
||||||
|
+ return f"{self.name}: {self.switch}"
|
||||||
|
+
|
||||||
|
+ def add_command(subparser):
|
||||||
|
+ parser = subparser.add_parser("client", help="Commands for rpc clients")
|
||||||
|
+ parser.set_defaults(func=RpcClient.show, client=None)
|
||||||
|
+ subparser = parser.add_subparsers()
|
||||||
|
+
|
||||||
|
+ show = subparser.add_parser("show", help="Show rpc clients")
|
||||||
|
+ show.add_argument("client", metavar="CLIENT", nargs='?',
|
||||||
|
+ help="Name of a specific rpc client to show")
|
||||||
|
+ parser.set_defaults(func=RpcClient.show)
|
||||||
|
+
|
||||||
|
+ def get_by_name(name):
|
||||||
|
+ rpc_clients = sunrpc / "rpc-clients"
|
||||||
|
+ if name:
|
||||||
|
+ return [ RpcClient(rpc_clients / name) ]
|
||||||
|
+ return [ RpcClient(f) for f in sorted(rpc_clients.iterdir()) ]
|
||||||
|
+
|
||||||
|
+ def show(args):
|
||||||
|
+ for client in RpcClient.get_by_name(args.client):
|
||||||
|
+ print(client)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+parser = argparse.ArgumentParser()
|
||||||
|
+
|
||||||
|
+def show_small_help(args):
|
||||||
|
+ parser.print_usage()
|
||||||
|
+ print("sunrpc dir:", sunrpc)
|
||||||
|
+parser.set_defaults(func=show_small_help)
|
||||||
|
+
|
||||||
|
+subparser = parser.add_subparsers(title="commands")
|
||||||
|
+RpcClient.add_command(subparser)
|
||||||
|
+XprtSwitch.add_command(subparser)
|
||||||
|
+Xprt.add_command(subparser)
|
||||||
|
+
|
||||||
|
+args = parser.parse_args()
|
||||||
|
+try:
|
||||||
|
+ args.func(args)
|
||||||
|
+except Exception as e:
|
||||||
|
+ print(str(e))
|
||||||
|
+ sys.exit(1)
|
@ -0,0 +1,40 @@
|
|||||||
|
commit 9abd3b4b57155dfdfd6895e6086ef550ee56fc49
|
||||||
|
Author: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
Date: Tue Feb 22 16:06:51 2022 -0500
|
||||||
|
|
||||||
|
idmapd: Fix error status when nfs-idmapd exits
|
||||||
|
|
||||||
|
nfs-idmapd.service would report following error when stopped:
|
||||||
|
|
||||||
|
Starting NFSv4 ID-name mapping service...
|
||||||
|
rpc.idmapd[1198]: Setting log level to 0
|
||||||
|
Started NFSv4 ID-name mapping service.
|
||||||
|
rpc.idmapd[1198]: exiting on signal 15
|
||||||
|
Stopping NFSv4 ID-name mapping service...
|
||||||
|
nfs-idmapd.service: Main process exited, code=exited, status=1/FAILURE
|
||||||
|
nfs-idmapd.service: Failed with result 'exit-code'.
|
||||||
|
Stopped NFSv4 ID-name mapping service.
|
||||||
|
|
||||||
|
commit 93e8f092(idmapd: Add graceful exit and resource cleanup)
|
||||||
|
redirected SIGTERM, so when executing "systemctl stop nfs-idmapd", the
|
||||||
|
main() of idmapd would running to tail to return, while it returned 1
|
||||||
|
which considered as error by systemd.
|
||||||
|
|
||||||
|
So here just return 0 in main().
|
||||||
|
|
||||||
|
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
|
||||||
|
index e2c160e8..e79c124d 100644
|
||||||
|
--- a/utils/idmapd/idmapd.c
|
||||||
|
+++ b/utils/idmapd/idmapd.c
|
||||||
|
@@ -474,7 +474,7 @@ main(int argc, char **argv)
|
||||||
|
event_free(svrdirev);
|
||||||
|
event_base_free(evbase);
|
||||||
|
|
||||||
|
- return 1;
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
@ -0,0 +1,31 @@
|
|||||||
|
commit 7f8463fe702174bd613df9d308cc899af25ae02e
|
||||||
|
Author: Steve Dickson <steved@redhat.com>
|
||||||
|
Date: Wed Feb 23 15:19:51 2022 -0500
|
||||||
|
|
||||||
|
systemd: Fix format-overflow warning
|
||||||
|
|
||||||
|
rpc-pipefs-generator.c:35:23: error: '%s' directive output between 0 and 2147483653 bytes may exceed minimum required size of 4095 [-Werror=format-overflow=]
|
||||||
|
35 | sprintf(path, "%s/%s", dirname, pipefs_unit);
|
||||||
|
| ^
|
||||||
|
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
|
||||||
|
index c24db567..7b2bb4f7 100644
|
||||||
|
--- a/systemd/rpc-pipefs-generator.c
|
||||||
|
+++ b/systemd/rpc-pipefs-generator.c
|
||||||
|
@@ -28,11 +28,12 @@ static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit,
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
FILE *f;
|
||||||
|
+ size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit) + 1);
|
||||||
|
|
||||||
|
- path = malloc(strlen(dirname) + 1 + strlen(pipefs_unit));
|
||||||
|
+ path = malloc(size);
|
||||||
|
if (!path)
|
||||||
|
return 1;
|
||||||
|
- sprintf(path, "%s/%s", dirname, pipefs_unit);
|
||||||
|
+ snprintf(path, size, "%s/%s", dirname, pipefs_unit);
|
||||||
|
f = fopen(path, "w");
|
||||||
|
if (!f)
|
||||||
|
{
|
@ -0,0 +1,31 @@
|
|||||||
|
commit 8a835cebb149ba2a54b6518722c79019cf8e3da4
|
||||||
|
Author: Benjamin Coddington <bcodding@redhat.com>
|
||||||
|
Date: Mon Aug 1 13:19:04 2022 -0400
|
||||||
|
|
||||||
|
rpc-statd.service: Stop rpcbind and rpc.stat in an exit race
|
||||||
|
|
||||||
|
When `systemctl stop rpcbind.socket` is run, the dependency means
|
||||||
|
that systemd first sends SIGTERM to rpcbind, then sigterm to rpc.statd.
|
||||||
|
|
||||||
|
On SIGTERM, rpcbind tears down /var/run/rpcbind.sock. However,
|
||||||
|
rpc-statd on SIGTERM attempts to unregister from rpcbind
|
||||||
|
|
||||||
|
systemd needs to wait for rpc.statd to exit before sending
|
||||||
|
SIGTERM to rpcbind
|
||||||
|
|
||||||
|
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2100395
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service
|
||||||
|
index 095629f2..392750da 100644
|
||||||
|
--- a/systemd/rpc-statd.service
|
||||||
|
+++ b/systemd/rpc-statd.service
|
||||||
|
@@ -5,7 +5,7 @@ Conflicts=umount.target
|
||||||
|
Requires=nss-lookup.target rpcbind.socket
|
||||||
|
Wants=network-online.target
|
||||||
|
Wants=rpc-statd-notify.service
|
||||||
|
-After=network-online.target nss-lookup.target rpcbind.socket
|
||||||
|
+After=network-online.target nss-lookup.target rpcbind.service
|
||||||
|
|
||||||
|
PartOf=nfs-utils.service
|
||||||
|
IgnoreOnIsolate=yes
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue