import nfs-utils-2.3.3-35.el8

This commit is contained in:
CentOS Sources 2020-07-28 07:58:11 -04:00 committed by Stepan Oksanichenko
parent b8515c9810
commit ef4cfa13ba
11 changed files with 4953 additions and 23 deletions

View File

@ -1,12 +0,0 @@
diff -up nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c.orig nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c
--- nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c.orig 2017-01-12 10:21:39.000000000 -0500
+++ nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c 2017-04-26 12:47:56.715133443 -0400
@@ -432,7 +432,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_err("Bad arg count. Check /etc/request-key.d/request-key.conf");
xlog_warn(usage, progname);
return EXIT_FAILURE;
}

View File

@ -552,14 +552,6 @@ diff -up nfs-utils-2.3.3/utils/statd/monitor.c.orig nfs-utils-2.3.3/utils/statd/
struct sockaddr_in my_addr = {
.sin_family = AF_INET,
.sin_addr.s_addr = htonl(INADDR_LOOPBACK),
@@ -177,6 +177,7 @@ sm_mon_1_svc(struct mon *argp, struct sv
* We're committed...ignoring errors. Let's hope that a malloc()
* doesn't fail. (I should probably fix this assumption.)
*/
+ clnt = NULL;
if (!existing && !(clnt = nlist_new(my_name, mon_name, 0))) {
free(dnsname);
xlog_warn("out of memory");
@@ -223,6 +224,7 @@ sm_mon_1_svc(struct mon *argp, struct sv
failure:

View File

@ -0,0 +1,27 @@
From c9305f75070abe76155d6db29889bf5dead218c2 Mon Sep 17 00:00:00 2001
From: Steve Dickson <steved@redhat.com>
Date: Fri, 7 Feb 2020 10:18:21 -0500
Subject: [PATCH] query_krb5_ccache: Removed dead code that was flagged by a
covscan
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/gssd/krb5_util.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index bff759f..a1c43d2 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -1066,8 +1066,6 @@ query_krb5_ccache(const char* cred_cache, char **ret_princname,
*ret_realm = strdup(str+1);
}
k5_free_unparsed_name(context, princstring);
- } else {
- found = 0;
}
}
krb5_free_principal(context, principal);
--
2.24.1

View File

@ -0,0 +1,118 @@
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index eb993aab..26e51edf 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -459,7 +459,7 @@ gssd_get_single_krb5_cred(krb5_context context,
if (ccache)
krb5_cc_close(context, ccache);
krb5_free_cred_contents(context, &my_creds);
- free(k5err);
+ krb5_free_string(context, k5err);
return (code);
}
@@ -698,7 +698,7 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
"we failed to unparse principal name: %s\n",
k5err);
k5_free_kt_entry(context, kte);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
continue;
}
@@ -745,7 +745,7 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
if (retval < 0)
retval = 0;
out:
- free(k5err);
+ krb5_free_string(context, k5err);
return retval;
}
@@ -774,7 +774,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
int tried_all = 0, tried_default = 0, tried_upper = 0;
krb5_principal princ;
const char *notsetstr = "not set";
- char *adhostoverride;
+ char *adhostoverride = NULL;
/* Get full target hostname */
@@ -802,7 +802,6 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
adhostoverride);
/* No overflow: Windows cannot handle strings longer than 19 chars */
strcpy(myhostad, adhostoverride);
- free(adhostoverride);
} else {
strcpy(myhostad, myhostname);
for (i = 0; myhostad[i] != 0; ++i) {
@@ -811,6 +810,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
myhostad[i] = '$';
myhostad[i+1] = 0;
}
+ if (adhostoverride)
+ krb5_free_string(context, adhostoverride);
if (!srchost) {
retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
@@ -901,7 +902,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
k5err = gssd_k5_err_msg(context, code);
printerr(1, "%s while building principal for '%s'\n",
k5err, spn);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
continue;
}
@@ -911,7 +912,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
k5err = gssd_k5_err_msg(context, code);
printerr(3, "%s while getting keytab entry for '%s'\n",
k5err, spn);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
/*
* We tried the active directory machine account
@@ -960,7 +961,7 @@ out:
k5_free_default_realm(context, default_realm);
if (realmnames)
krb5_free_host_realm(context, realmnames);
- free(k5err);
+ krb5_free_string(context, k5err);
return retval;
}
@@ -1223,7 +1224,7 @@ gssd_destroy_krb5_machine_creds(void)
printerr(0, "WARNING: %s while resolving credential "
"cache '%s' for destruction\n", k5err,
ple->ccname);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
continue;
}
@@ -1232,13 +1233,13 @@ gssd_destroy_krb5_machine_creds(void)
k5err = gssd_k5_err_msg(context, code);
printerr(0, "WARNING: %s while destroying credential "
"cache '%s'\n", k5err, ple->ccname);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
}
}
krb5_free_context(context);
out:
- free(k5err);
+ krb5_free_string(context, k5err);
}
/*
@@ -1321,7 +1322,7 @@ out_free_kt:
out_free_context:
krb5_free_context(context);
out:
- free(k5err);
+ krb5_free_string(context, k5err);
return retval;
}

View File

@ -0,0 +1,12 @@
diff -up nfs-utils-2.3.3/utils/nfsidmap/nfsidmap.c.orig nfs-utils-2.3.3/utils/nfsidmap/nfsidmap.c
--- nfs-utils-2.3.3/utils/nfsidmap/nfsidmap.c.orig 2020-05-05 14:07:24.642693179 -0400
+++ nfs-utils-2.3.3/utils/nfsidmap/nfsidmap.c 2020-05-05 14:08:39.054849153 -0400
@@ -432,7 +432,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;
}

View File

@ -0,0 +1,57 @@
commit efefa7845601f551820fa17cb0808dbb3c3cc3dd
Author: Steve Dickson <steved@redhat.com>
Date: Wed Nov 13 09:32:00 2019 -0500
junction: Fixed debug statement to compile with -Werror=format=2 flag
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/junction/xml.c b/support/junction/xml.c
index 79b0770..7005e95 100644
--- a/support/junction/xml.c
+++ b/support/junction/xml.c
@@ -327,8 +327,8 @@ junction_parse_xml_read(const char *pathname, int fd, const char *name,
if (retval != FEDFS_OK)
return retval;
- xlog(D_CALL, "%s: XML document contained in junction:\n%.*s",
- __func__, len, buf);
+ xlog(D_CALL, "%s: XML document contained in junction:\n%ld.%s",
+ __func__, len, (char *)buf);
retval = junction_parse_xml_buf(pathname, name, buf, len, doc);
commit f7c0c0dc4a02d87965d3fbbab69786ca07fdecea
Author: Guillaume Rousse <guillomovitch@gmail.com>
Date: Fri Nov 22 10:20:03 2019 -0500
fix compilation with -Werror=format on i586
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/junction/xml.c b/support/junction/xml.c
index 7005e95..813110b 100644
--- a/support/junction/xml.c
+++ b/support/junction/xml.c
@@ -327,7 +327,7 @@ junction_parse_xml_read(const char *pathname, int fd, const char *name,
if (retval != FEDFS_OK)
return retval;
- xlog(D_CALL, "%s: XML document contained in junction:\n%ld.%s",
+ xlog(D_CALL, "%s: XML document contained in junction:\n%zu.%s",
__func__, len, (char *)buf);
retval = junction_parse_xml_buf(pathname, name, buf, len, doc);
diff --git a/tools/locktest/testlk.c b/tools/locktest/testlk.c
index b392f71..ea51f78 100644
--- a/tools/locktest/testlk.c
+++ b/tools/locktest/testlk.c
@@ -81,7 +81,7 @@ main(int argc, char **argv)
if (fl.l_type == F_UNLCK) {
printf("%s: no conflicting lock\n", fname);
} else {
- printf("%s: conflicting lock by %d on (%ld;%ld)\n",
+ printf("%s: conflicting lock by %d on (%zd;%zd)\n",
fname, fl.l_pid, fl.l_start, fl.l_len);
}
return 0;

View File

@ -0,0 +1,40 @@
commit 3ff6fad27d2cd0772a40ddb65694ce04f3da83bc
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Wed Jan 29 10:42:03 2020 -0500
manpage: Add a description of the 'nconnect' mount option
Add a description of the 'nconnect' mount option on the 'nfs' generic
manpage.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
index 6ba9cef..84462cd 100644
--- a/utils/mount/nfs.man
+++ b/utils/mount/nfs.man
@@ -369,6 +369,23 @@ using an automounter (refer to
.BR automount (8)
for details).
.TP 1.5i
+.BR nconnect= n
+When using a connection oriented protocol such as TCP, it may
+sometimes be advantageous to set up multiple connections between
+the client and server. For instance, if your clients and/or servers
+are equipped with multiple network interface cards (NICs), using multiple
+connections to spread the load may improve overall performance.
+In such cases, the
+.BR nconnect
+option allows the user to specify the number of connections
+that should be established between the client and server up to
+a limit of 16.
+.IP
+Note that the
+.BR nconnect
+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 rdirplus " / " nordirplus
Selects whether to use NFS v3 or v4 READDIRPLUS requests.
If this option is not specified, the NFS client uses READDIRPLUS requests

View File

@ -0,0 +1,481 @@
diff -up nfs-utils-2.3.3/configure.ac.orig nfs-utils-2.3.3/configure.ac
--- nfs-utils-2.3.3/configure.ac.orig 2020-06-09 10:58:50.178258035 -0400
+++ nfs-utils-2.3.3/configure.ac 2020-06-09 11:02:04.203102954 -0400
@@ -639,6 +639,7 @@ AC_CONFIG_FILES([
tools/rpcgen/Makefile
tools/mountstats/Makefile
tools/nfs-iostat/Makefile
+ tools/nfsdclnts/Makefile
tools/nfsconf/Makefile
tools/nfsdclddb/Makefile
utils/Makefile
diff -up nfs-utils-2.3.3/tools/Makefile.am.orig nfs-utils-2.3.3/tools/Makefile.am
--- nfs-utils-2.3.3/tools/Makefile.am.orig 2020-06-09 10:58:50.178258035 -0400
+++ nfs-utils-2.3.3/tools/Makefile.am 2020-06-09 11:02:04.203102954 -0400
@@ -12,6 +12,6 @@ if CONFIG_NFSDCLD
OPTDIRS += nfsdclddb
endif
-SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat $(OPTDIRS)
+SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat nfsdclnts $(OPTDIRS)
MAINTAINERCLEANFILES = Makefile.in
diff -up nfs-utils-2.3.3/tools/nfsdclnts/Makefile.am.orig nfs-utils-2.3.3/tools/nfsdclnts/Makefile.am
--- nfs-utils-2.3.3/tools/nfsdclnts/Makefile.am.orig 2020-06-09 11:02:04.203102954 -0400
+++ nfs-utils-2.3.3/tools/nfsdclnts/Makefile.am 2020-06-09 11:02:04.203102954 -0400
@@ -0,0 +1,13 @@
+## Process this file with automake to produce Makefile.in
+PYTHON_FILES = nfsdclnts.py
+
+man8_MANS = nfsdclnts.man
+
+EXTRA_DIST = $(man8_MANS) $(PYTHON_FILES)
+
+all-local: $(PYTHON_FILES)
+
+install-data-hook:
+ $(INSTALL) -m 755 nfsdclnts.py $(DESTDIR)$(sbindir)/nfsdclnts
+
+MAINTAINERCLEANFILES=Makefile.in
diff -up nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.man.orig nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.man
--- nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.man.orig 2020-06-09 11:02:04.203102954 -0400
+++ nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.man 2020-06-09 11:02:04.203102954 -0400
@@ -0,0 +1,180 @@
+.\"
+.\" nfsdclnts(8)
+.\"
+.TH "NFSDCLTS" "8" "2020-05-09" "nfsdclnts" "nfsdclnts"
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.ss \n[.ss] 0
+.nh
+.ad l
+.de URL
+\fI\\$2\fP <\\$1>\\$3
+..
+.als MTO URL
+.if \n[.g] \{\
+. mso www.tmac
+. am URL
+. ad l
+. .
+. am MTO
+. ad l
+. .
+. LINKSTYLE blue R < >
+.\}
+.SH "NAME"
+nfsdclnts \- print various nfs client information for knfsd server.
+.SH "SYNOPSIS"
+.sp
+\fBnfsdclnts\fP [\fI\-h\fP] [\fI\-t type\fP] [\fI\-\-clientinfo\fP] [\fI\-\-hostname\fP] [\fI\-q\fP]
+.SH "DESCRIPTION"
+.sp
+The nfsdclnts(8) command parses the content present in /proc/fs/nfsd/clients/ directories. nfsdclnts(8) displays files which are open, locked, delegated by the nfs\-client. It also prints useful client information such as hostname, clientID, NFS version mounted by the nfs\-client.
+.SH "OPTIONS"
+.sp
+\fB\-t, \-\-type\fP=TYPE
+.RS 4
+Specify the type of file to be displayed. Takes only one TYPE at a time.
+.sp
+\fIopen\fP, \fIlock\fP, \fIdeleg\fP, \fIlayout\fP, or \fIall\fP
+.sp
+open: displays the open files by nfs\-client(s).
+.sp
+lock: displays the files locked by nfs\-client(s).
+.sp
+layout: displays the files for which layout is given.
+.sp
+deleg: displays delegated files information and delegation type.
+.sp
+all: prints all the above type.
+.RE
+.sp
+\fB\-\-clientinfo\fP
+.RS 4
+displays various nfs\-client info fields such as version of nfs mounted at nfs\-client and clientID.
+.RE
+.sp
+\fB\-\-hostname\fP
+.RS 4
+Print hostname of nfs\-client instead of ip-address.
+.RE
+.sp
+\fB\-q, \-\-quiet\fP
+.RS 4
+Hide the header information.
+.RE
+.sp
+\fB\-v, \-\-verbose\fP
+.RS 4
+Verbose operation, show debug messages.
+.RE
+.sp
+\fB\-f, \-\-file\fP
+.RS 4
+Instead of processing all client directories under /proc/fs/nfsd/clients, one can provide a specific
+states file to process. One should make sure that info file resides in the same directory as states file.
+If the info file is not valid or present the fields would be marked as "N/A".
+.RE
+.sp
+\fB\-h, \-\-help\fP
+.RS 4
+Print help explaining the command line options.
+.SH "EXAMPLES"
+.sp
+\fBnfsdclnts \-\-type open\fP
+.RS 4
+List all files with open type only.
+.RE
+.sp
+.if n .RS 4
+.nf
+Inode number | Type | Access | Deny | ip address | Filename
+33823232 | open | r\- | \-\- | [::1]:757 | testfile
+.fi
+.if n .RE
+.sp
+\fBnfsdclnts \-\-type deleg\fP
+.RS 4
+List all files with deleg type only.
+.RE
+.sp
+.if n .RS 4
+.nf
+Inode number | Type | Access | ip address | Filename
+33823232 | deleg | r | [::1]:757 | testfile
+.fi
+.if n .RE
+.sp
+\fBnfsdclnts \-\-hostname\fP
+.RS 4
+Print hostname instead of ip\-address.
+.RE
+.sp
+.if n .RS 4
+.nf
+Inode number | Type | Access | Deny | Hostname | Filename
+33823232 | open | r\- | \-\- | nfs\-server | testfile
+33823232 | deleg | r | | nfs\-server | testfile
+.fi
+.if n .RE
+.sp
+\fBnfsdclnts \-\-clientinfo\fP
+.RS 4
+Print client information.
+.RE
+.sp
+.if n .RS 4
+.nf
+Inode number | Type | Access | Deny | ip address | Client ID | vers | Filename
+33823232 | open | r\- | \-\- | [::1]:757 | 0xc79a009f5eb65e84 | 4.2 | testfile
+33823232 | deleg | r | | [::1]:757 | 0xc79a009f5eb65e84 | 4.2 | testfile
+.fi
+.if n .RE
+.sp
+\fBnfsdclnts \-\-file /proc/fs/nfsd/clients/3/states -t open\fP
+.RS 4
+Process specific states file.
+.RE
+.sp
+.if n .RS 4
+.nf
+Inode number | Type | Access | Deny | ip address | Client ID | vers | Filename
+33823232 | open | r\- | \-\- | [::1]:757 | 0xc79a009f5eb65e84 | 4.2 | testfile
+.fi
+.if n .RE
+.sp
+\fBnfsdclnts \-\-quiet \-\-hostname\fP
+.RS 4
+Hide the header information.
+.RE
+.sp
+.if n .RS 4
+.nf
+33823232 | open | r\- | \-\- | nfs\-server | testfile
+33823232 | deleg | r | | nfs\-server | testfile
+.fi
+.if n .RE
+.SH "FILES"
+.sp
+\fB/proc/fs/nfsd/clients/\fP
+.sp
+Displays basic information about each NFSv4 client.
+.sp
+\fB/proc/fs/nfsd/clients/#/info\fP
+.sp
+Displays information about all the opens held by the given client, including open modes, device numbers, inode numbers, and open owners.
+.sp
+\fB/proc/fs/nfsd/clients/#/states\fP
+.SH "NOTES"
+.sp
+/proc/fs/nfsd/clients/ support was initially introduced in 5.3 kernel and is only implemented for mount points using NFSv4.
+.SH "BUGS"
+Please report any BUGs to \c
+.MTO "linux\-nfs\(atvger.kernel.org" "" ""
+.SH SEE ALSO
+.BR nfsd (8),
+.BR exportfs (8),
+.BR idmapd (8),
+.BR statd (8)
+.SH "AUTHORS"
+Achilles Gaikwad <agaikwad@redhat.com> and
+Kenneth D'souza <kdsouza@redhat.com>
diff -up nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.py.orig nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.py
--- nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.py.orig 2020-06-09 11:02:04.203102954 -0400
+++ nfs-utils-2.3.3/tools/nfsdclnts/nfsdclnts.py 2020-06-09 11:02:04.203102954 -0400
@@ -0,0 +1,254 @@
+#!/usr/bin/python3
+# -*- python-mode -*-
+'''
+ Copyright (C) 2020
+ Authors: Achilles Gaikwad <agaikwad@redhat.com>
+ Kenneth D'souza <kdsouza@redhat.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+'''
+
+import multiprocessing as mp
+import os
+import signal
+import sys
+
+try:
+ import argparse
+except ImportError:
+ print('%s: Failed to import argparse - make sure argparse is installed!'
+ % sys.argv[0])
+ sys.exit(1)
+try:
+ import yaml
+except ImportError:
+ print('%s: Failed to import yaml - make sure python3-pyyaml is installed!'
+ % sys.argv[0])
+ sys.exit(1)
+
+BBOLD = '\033[1;30;47m' #Bold black text with white background.
+ENDC = '\033[m' #Rest to defaults
+
+def init_worker():
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+# this function converts the info file to a dictionary format, sorta.
+def file_to_dict(path):
+ client_info = {}
+ try:
+ with open(path) as f:
+ for line in f:
+ try:
+ (key, val) = line.split(':', 1)
+ client_info[key] = val.strip()
+ # FIXME: There has to be a better way of converting the info file to a dictionary.
+ except ValueError as reason:
+ if verbose:
+ print('Exception occured, %s' % reason)
+
+ if len(client_info) == 0 and verbose:
+ print("Provided %s file is not valid" %path)
+ return client_info
+
+ except OSError as reason:
+ if verbose:
+ print('%s' % reason)
+
+# this function gets the paths from /proc/fs/nfsd/clients/
+# returns a list of paths for each client which has nfs-share mounted.
+def getpaths():
+ path = []
+ try:
+ dirs = os.listdir('/proc/fs/nfsd/clients/')
+ except OSError as reason:
+ exit('%s' % reason)
+ if len(dirs) !=0:
+ for i in dirs:
+ path.append('/proc/fs/nfsd/clients/' + i + '/states')
+ return (path)
+ else:
+ exit('Nothing to process')
+
+# A single function to rule them all, in this function we gather all the data
+# from already populated data_list and client_info.
+def printer(data_list, argument):
+ client_info_path = data_list.pop()
+ client_info = file_to_dict(client_info_path)
+ for i in data_list:
+ for key in i:
+ inode = i[key]['superblock'].split(':')[-1]
+ # The ip address is quoted, so we dequote it.
+ try:
+ client_ip = client_info['address'][1:-1]
+ except:
+ client_ip = "N/A"
+ try:
+ # if the nfs-server reboots while the nfs-client holds the files open,
+ # the nfs-server would print the filename as '/'. For such instaces we
+ # print the output as disconnected dentry instead of '/'.
+ if(i[key]['filename']=='/'):
+ fname = 'disconnected dentry'
+ else:
+ fname = i[key]['filename'].split('/')[-1]
+ except KeyError:
+ # for older kernels which do not have the fname patch in kernel, they
+ # won't be able to see the fname field. Therefore post it as N/A.
+ fname = "N/A"
+ otype = i[key]['type']
+ try:
+ access = i[key]['access']
+ except:
+ access = ''
+ try:
+ deny = i[key]['deny']
+ except:
+ deny = ''
+ try:
+ hostname = client_info['name'].split()[-1].split('"')[0]
+ hostname = hostname.split('.')[0]
+ # if the hostname is too long, it messes up with the output being in columns,
+ # therefore we truncate the hostname followed by two '..' as suffix.
+ if len(hostname) > 20:
+ hostname = hostname[0:20] + '..'
+ except:
+ hostname = "N/A"
+ try:
+ clientid = client_info['clientid']
+ except:
+ clientid = "N/A"
+ try:
+ minorversion = "4." + client_info['minor version']
+ except:
+ minorversion = "N/A"
+
+ otype = i[key]['type']
+ # since some fields do not have deny column, we drop those if -t is either
+ # layout or lock.
+ drop = ['layout', 'lock']
+
+ # Printing the output this way instead of a single string which is concatenated
+ # this makes it better to quickly add more columns in future.
+ if(otype == argument.type or argument.type == 'all'):
+ print('%-13s' %inode, end='| ')
+ print('%-7s' %otype, end='| ')
+ if (argument.type not in drop):
+ print('%-7s' %access, end='| ')
+ if (argument.type not in drop and argument.type !='deleg'):
+ print('%-5s' %deny, end='| ')
+ if (argument.hostname == True):
+ print('%-22s' %hostname, end='| ')
+ else:
+ print('%-22s' %client_ip, end='| ')
+ if (argument.clientinfo == True) :
+ print('%-20s' %clientid, end='| ')
+ print('%-5s' %minorversion, end='| ')
+ print(fname)
+
+def opener(path):
+ try:
+ with open(path, 'r') as nfsdata:
+ try:
+ data = yaml.load(nfsdata, Loader = yaml.BaseLoader)
+ if data is not None:
+ clientinfo = path.rsplit('/', 1)[0] + '/info'
+ data.append(clientinfo)
+ return data
+ except:
+ if verbose:
+ print("Exception occurred, Please make sure %s is a YAML file" %path)
+
+ except OSError as reason:
+ if verbose:
+ print('%s' % reason)
+
+def print_cols(argument):
+ title_inode = 'Inode number'
+ title_otype = 'Type'
+ title_access = 'Access'
+ title_deny = 'Deny'
+ title_fname = 'Filename'
+ title_clientID = 'Client ID'
+ title_hostname = 'Hostname'
+ title_ip = 'ip address'
+ title_nfsvers = 'vers'
+
+ drop = ['lock', 'layout']
+ print(BBOLD, end='')
+ print('%-13s' %title_inode, end='| ')
+ print('%-7s' %title_otype, end='| ')
+ if (argument.type not in drop):
+ print('%-7s' %title_access, end='| ')
+ if (argument.type not in drop and argument.type !='deleg'):
+ print('%-5s' %title_deny, end='| ')
+ if (argument.hostname == True):
+ print('%-22s' %title_hostname, end='| ')
+ else:
+ print('%-22s' %title_ip, end='| ')
+ if (argument.clientinfo == True):
+ print('%-20s' %title_clientID, end='| ')
+ print('%-5s' %title_nfsvers, end='| ')
+ print(title_fname, end='')
+ print(ENDC)
+
+def nfsd4_show():
+
+ parser = argparse.ArgumentParser(description = 'Parse the nfsd states and clientinfo files.')
+ parser.add_argument('-t', '--type', metavar = 'type', type = str, choices = ['open',
+ 'deleg', 'lock', 'layout', 'all'],
+ default = 'all',
+ help = 'Input the type that you want to be printed: open, lock, deleg, layout, all')
+ parser.add_argument('--clientinfo', action = 'store_true',
+ help = 'output clients information, --hostname is implied.')
+ parser.add_argument('--hostname', action = 'store_true',
+ help = 'print hostname of client instead of its ip address. Longer hostnames are truncated.')
+ parser.add_argument('-v', '--verbose', action = 'store_true',
+ help = 'Verbose operation, show debug messages.')
+ parser.add_argument('-f', '--file', nargs='+', type = str, metavar='',
+ help = 'pass client states file, provided that info file resides in the same directory.')
+ parser.add_argument('-q', '--quiet', action = 'store_true',
+ help = 'don\'t print the header information')
+
+ args = parser.parse_args()
+
+ global verbose
+ verbose = False
+ if args.verbose:
+ verbose = True
+
+ if args.file:
+ paths = args.file
+ else:
+ paths = getpaths()
+
+ p = mp.Pool(mp.cpu_count(), init_worker)
+ try:
+ result = p.map(opener, paths)
+ ### Drop None entries from list
+ final_result = list(filter(None, result))
+ p.close()
+ p.join()
+
+ if len(final_result) !=0 and not args.quiet:
+ print_cols(args)
+
+ for item in final_result:
+ printer(item, args)
+
+ except KeyboardInterrupt:
+ print('Caught KeyboardInterrupt, terminating workers')
+ p.terminate()
+ p.join()
+
+if __name__ == "__main__":
+ nfsd4_show()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
commit 77d053e4881664e7dbbc3bbb9a242af005598e95
Author: Steve Dickson <steved@redhat.com>
Date: Wed May 13 12:22:41 2020 -0400
nfsdclddb: Redname clddb-tool to nfsdclddb
To try to maintain some type of name convention
rename clddb-tool to nfsdclddb
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/configure.ac b/configure.ac
index df88e58..0b1c8cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -695,7 +695,7 @@ AC_CONFIG_FILES([
tools/mountstats/Makefile
tools/nfs-iostat/Makefile
tools/nfsconf/Makefile
- tools/clddb-tool/Makefile
+ tools/nfsdclddb/Makefile
utils/Makefile
utils/blkmapd/Makefile
utils/nfsdcld/Makefile
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 53e6117..432d35d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -9,7 +9,7 @@ endif
OPTDIRS += nfsconf
if CONFIG_NFSDCLD
-OPTDIRS += clddb-tool
+OPTDIRS += nfsdclddb
endif
SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat $(OPTDIRS)
diff --git a/tools/clddb-tool/Makefile.am b/tools/nfsdclddb/Makefile.am
similarity index 60%
rename from tools/clddb-tool/Makefile.am
rename to tools/nfsdclddb/Makefile.am
index 15a8fd4..18263fb 100644
--- a/tools/clddb-tool/Makefile.am
+++ b/tools/nfsdclddb/Makefile.am
@@ -1,13 +1,13 @@
## Process this file with automake to produce Makefile.in
-PYTHON_FILES = clddb-tool.py
+PYTHON_FILES = nfsdclddb.py
-man8_MANS = clddb-tool.man
+man8_MANS = nfsdclddb.man
EXTRA_DIST = $(man8_MANS) $(PYTHON_FILES)
all-local: $(PYTHON_FILES)
install-data-hook:
- $(INSTALL) -m 755 clddb-tool.py $(DESTDIR)$(sbindir)/clddb-tool
+ $(INSTALL) -m 755 nfsdclddb.py $(DESTDIR)$(sbindir)/nfsdclddb
MAINTAINERCLEANFILES=Makefile.in
diff --git a/tools/clddb-tool/clddb-tool.man b/tools/nfsdclddb/nfsdclddb.man
similarity index 84%
rename from tools/clddb-tool/clddb-tool.man
rename to tools/nfsdclddb/nfsdclddb.man
index e80b2c0..8ec7b18 100644
--- a/tools/clddb-tool/clddb-tool.man
+++ b/tools/nfsdclddb/nfsdclddb.man
@@ -1,20 +1,20 @@
.\"
-.\" clddb-tool(8)
+.\" nfsdclddb(8)
.\"
-.TH clddb-tool 8 "07 Aug 2019"
+.TH nfsdclddb 8 "07 Aug 2019"
.SH NAME
-clddb-tool \- Tool for manipulating the nfsdcld sqlite database
+nfsdclddb \- Tool for manipulating the nfsdcld sqlite database
.SH SYNOPSIS
-.B clddb-tool
+.B nfsdclddb
.RB [ \-h | \-\-help ]
.P
-.B clddb-tool
+.B nfsdclddb
.RB [ \-p | \-\-path
.IR dbpath ]
.B fix-table-names
.RB [ \-h | \-\-help ]
.P
-.B clddb-tool
+.B nfsdclddb
.RB [ \-p | \-\-path
.IR dbpath ]
.B downgrade-schema
@@ -22,7 +22,7 @@ clddb-tool \- Tool for manipulating the nfsdcld sqlite database
.RB [ \-v | \-\-version
.IR to-version ]
.P
-.B clddb-tool
+.B nfsdclddb
.RB [ \-p | \-\-path
.IR dbpath ]
.B print
@@ -31,10 +31,10 @@ clddb-tool \- Tool for manipulating the nfsdcld sqlite database
.P
.SH DESCRIPTION
-.RB "The " clddb-tool " command is provided to perform some manipulation of the nfsdcld sqlite database schema and to print the contents of the database."
+.RB "The " nfsdclddb " command is provided to perform some manipulation of the nfsdcld sqlite database schema and to print the contents of the database."
.SS Sub-commands
Valid
-.B clddb-tool
+.B nfsdclddb
subcommands are:
.IP "\fBfix-table-names\fP"
.RB "A previous version of " nfsdcld "(8) contained a bug that corrupted the reboot epoch table names. This sub-command will fix those table names."
@@ -66,7 +66,7 @@ The schema version to downgrade to. Currently the schema can only be downgraded
Do not list the clients in the reboot epoch tables in the output.
.SH NOTES
The
-.B clddb-tool
+.B nfsdclddb
command will not allow the
.B fix-table-names
or
diff --git a/tools/clddb-tool/clddb-tool.py b/tools/nfsdclddb/nfsdclddb.py
similarity index 100%
rename from tools/clddb-tool/clddb-tool.py
rename to tools/nfsdclddb/nfsdclddb.py

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://linux-nfs.org/
Version: 2.3.3
Release: 28%{?dist}
Release: 35%{?dist}
Epoch: 1
# group all 32bit related archs
@ -49,10 +49,21 @@ Patch019: nfs-utils-2.3.3-nfsiostat-err-cnts.patch
Patch020: nfs-utils-2.3.3-gssd-man-verbose.patch
Patch021: nfs-utils-2.3.3-nfsconf-rdmaport.patch
Patch022: nfs-utils-2.3.3-gssd-early-daemon.patch
Patch023: nfs-utils-2.3.3-covscan-rm-deadcode-leaks.patch
Patch024: nfs-utils-2.3.3-gssd-memoryleak.patch
#
# RHEL 8.3
#
Patch025: nfs-utils-2.3.3-junction-err-fix.patch
Patch026: nfs-utils-2.3.3-nfsdcld-upstream-update.patch
Patch027: nfs-utils-2.3.3-nconnect-manpage.patch
Patch028: nfs-utils-2.3.3-nfsdclddb-rename.patch
Patch029: nfs-utils-2.3.3-nfsclnts-cmd.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
Patch102: nfs-utils-1.2.5-idmap-errmsg.patch
Patch102: nfs-utils-2.3.3-idmap-errmsg.patch
Patch103: nfs-utils-2.3.1-systemd-gssproxy-restart.patch
Patch104: nfs-utils-2.3.1-systemd-svcgssd-removed.patch
@ -74,7 +85,7 @@ Provides: start-statd = %{epoch}:%{version}-%{release}
License: MIT and GPLv2 and GPLv2+ and BSD
Requires: rpcbind, sed, gawk, grep
Requires: kmod, keyutils, quota
Requires: kmod, keyutils, quota, python3-pyyaml
BuildRequires: libevent-devel libcap-devel
BuildRequires: libtirpc-devel libblkid-devel
BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2
@ -310,6 +321,9 @@ fi
%{_sbindir}/nfsconf
%{_sbindir}/nfsref
%{_sbindir}/nfsconvert
%{_sbindir}/nfsdclddb
%{_sbindir}/nfsdcld
%{_sbindir}/nfsdclnts
%{_mandir}/*/*
%{_pkgdir}/*/*
@ -333,6 +347,29 @@ fi
%{_libdir}/libnfsidmap.so
%changelog
* Wed Jun 10 2020 Steve Dickson <steved@redhat.com> 2.3.3-35
- Fix dependency problems with nfsdclnts (bz 1841502)
* Tue Jun 9 2020 Steve Dickson <steved@redhat.com> 2.3.3-34
- New nfsdclnts command added (bz 1841502)
* Mon May 18 2020 Steve Dickson <steved@redhat.com> 2.3.3-33
- manpage: Add a description of the 'nconnect' mount option (bz 1761352)
- nfsdclddb: Redname clddb-tool to nfsdclddb (bz 1836924)
* Wed May 6 2020 Steve Dickson <steved@redhat.com> 2.3.3-32
- junction: Fixed debug statement (bz 1831829)
- Userspace support for the latest nfsdcld daemon (bz 1817756)
* Fri Mar 6 2020 Steve Dickson <steved@redhat.com> 2.3.3-31
- gssd: Closed a memory leak in find_keytab_entry() (bz 1809277)
* Fri Feb 7 2020 Steve Dickson <steved@redhat.com> 2.3.3-30
- Removed dead code that was flagged by a covscan (bz 1746572)
* Thu Jan 16 2020 Steve Dickson <steved@redhat.com> 2.3.3-29
- statd: Fix permission denied error path (bz 1776096)
* Tue Nov 26 2019 Steve Dickson <steved@redhat.com> 2.3.3-28
- gssd: daemonize earlier (bz 1762847)