import nfs-utils-2.3.3-28.el8

This commit is contained in:
CentOS Sources 2020-01-21 16:13:19 -05:00 committed by Stepan Oksanichenko
parent 32d95d5a4f
commit b8515c9810
18 changed files with 1629 additions and 3830 deletions

View File

@ -0,0 +1,605 @@
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 2019-09-18 10:57:14.190810677 -0400
+++ nfs-utils-2.3.3/configure.ac 2019-09-18 10:57:56.715567641 -0400
@@ -561,6 +561,7 @@ my_am_cflags="\
-Werror=parentheses \
-Werror=aggregate-return \
-Werror=unused-result \
+ -Wno-cast-function-type \
-fno-strict-aliasing \
"
diff -up nfs-utils-2.3.3/support/junction/path.c.orig nfs-utils-2.3.3/support/junction/path.c
--- nfs-utils-2.3.3/support/junction/path.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/junction/path.c 2019-09-18 10:57:56.715567641 -0400
@@ -163,8 +163,10 @@ nsdb_count_components(const char *pathna
break;
next = strchrnul(component, '/');
tmp = (size_t)(next - component);
- if (tmp > 255)
+ if (tmp > 255) {
+ free(start);
return false;
+ }
length += XDR_UINT_BYTES + (nsdb_quadlen(tmp) << 2);
count++;
@@ -328,11 +330,13 @@ nsdb_posix_to_path_array(const char *pat
length = (size_t)(next - component);
if (length > 255) {
nsdb_free_string_array(result);
+ free(normalized);
return FEDFS_ERR_SVRFAULT;
}
result[i] = strndup(component, length);
if (result[i] == NULL) {
+ free(normalized);
nsdb_free_string_array(result);
return FEDFS_ERR_SVRFAULT;
}
diff -up nfs-utils-2.3.3/support/nfs/exports.c.orig nfs-utils-2.3.3/support/nfs/exports.c
--- nfs-utils-2.3.3/support/nfs/exports.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/exports.c 2019-09-18 10:57:56.715567641 -0400
@@ -714,6 +714,7 @@ parsesquash(char *list, int **idp, int *
}
if (id0 == -1 || id1 == -1) {
syntaxerr("uid/gid -1 not permitted");
+ xfree(id);
return -1;
}
if ((len % 8) == 0)
@@ -724,6 +725,7 @@ parsesquash(char *list, int **idp, int *
break;
if (*cp != ',') {
syntaxerr("bad uid/gid list");
+ xfree(id);
return -1;
}
cp++;
diff -up nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c.orig nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c
--- nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c 2019-09-18 10:57:56.716567635 -0400
@@ -406,8 +406,10 @@ int nfs4_init_name_mapping(char *conffil
nfs4_methods = conf_get_list("Translation", "Method");
if (nfs4_methods) {
IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list"));
- if (load_plugins(nfs4_methods, &nfs4_plugins) == -1)
+ if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) {
+ conf_free_list(nfs4_methods);
return -ENOENT;
+ }
} else {
struct conf_list list;
struct conf_list_node node;
@@ -475,11 +477,15 @@ out:
if (ret) {
if (nfs4_plugins)
unload_plugins(nfs4_plugins);
- if (gss_plugins)
+ if (gss_plugins) {
unload_plugins(gss_plugins);
+ }
nfs4_plugins = gss_plugins = NULL;
}
+ if (gss_methods)
+ conf_free_list(gss_methods);
+
return ret ? -ENOENT: 0;
}
diff -up nfs-utils-2.3.3/support/nfsidmap/static.c.orig nfs-utils-2.3.3/support/nfsidmap/static.c
--- nfs-utils-2.3.3/support/nfsidmap/static.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfsidmap/static.c 2019-09-18 10:57:56.716567635 -0400
@@ -347,6 +347,7 @@ static int static_init(void) {
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *unode);
free(pw);
+ conf_free_list(princ_list);
return -ENOMEM;
}
unode->uid = pw->pw_uid;
@@ -355,6 +356,9 @@ static int static_init(void) {
unode->localname = conf_get_str("Static", cln->field);
if (!unode->localname) {
free(pw);
+ free(unode->principal);
+ free(unode);
+ conf_free_list(princ_list);
return -ENOENT;
}
@@ -379,6 +383,7 @@ static int static_init(void) {
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *gnode);
free(gr);
+ conf_free_list(princ_list);
return -ENOMEM;
}
gnode->gid = gr->gr_gid;
@@ -387,6 +392,9 @@ static int static_init(void) {
gnode->localgroup = conf_get_str("Static", cln->field);
if (!gnode->localgroup) {
free(gr);
+ free(gnode->principal);
+ free(gnode);
+ conf_free_list(princ_list);
return -ENOENT;
}
@@ -394,6 +402,8 @@ static int static_init(void) {
LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link);
}
+
+ conf_free_list(princ_list);
return 0;
}
diff -up nfs-utils-2.3.3/support/nfs/mydaemon.c.orig nfs-utils-2.3.3/support/nfs/mydaemon.c
--- nfs-utils-2.3.3/support/nfs/mydaemon.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/mydaemon.c 2019-09-18 10:57:56.716567635 -0400
@@ -123,6 +123,7 @@ daemon_init(bool fg)
dup2(tempfd, 0);
dup2(tempfd, 1);
dup2(tempfd, 2);
+ close(tempfd);
closelog();
dup2(pipefds[1], 3);
pipefds[1] = 3;
diff -up nfs-utils-2.3.3/support/nfs/rpcmisc.c.orig nfs-utils-2.3.3/support/nfs/rpcmisc.c
--- nfs-utils-2.3.3/support/nfs/rpcmisc.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/rpcmisc.c 2019-09-18 10:57:56.716567635 -0400
@@ -102,6 +102,7 @@ makesock(int port, int proto)
if (bind(sock, (struct sockaddr *) &sin, sizeof(sin)) == -1) {
xlog(L_FATAL, "Could not bind name to socket: %s",
strerror(errno));
+ close(sock);
return -1;
}
diff -up nfs-utils-2.3.3/support/nfs/svc_socket.c.orig nfs-utils-2.3.3/support/nfs/svc_socket.c
--- nfs-utils-2.3.3/support/nfs/svc_socket.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/svc_socket.c 2019-09-18 10:57:56.717567629 -0400
@@ -134,6 +134,7 @@ svc_socket (u_long number, int type, int
if (ret < 0)
{
xlog(L_ERROR, "svc_socket: socket reuse problem: %m");
+ (void) __close(sock);
return ret;
}
}
diff -up nfs-utils-2.3.3/support/nfs/xcommon.c.orig nfs-utils-2.3.3/support/nfs/xcommon.c
--- nfs-utils-2.3.3/support/nfs/xcommon.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/xcommon.c 2019-09-18 10:57:56.717567629 -0400
@@ -53,14 +53,17 @@ char *
xstrconcat3 (const char *s, const char *t, const char *u) {
char *res;
- if (!s) s = "";
+ int dofree = 1;
+
+ if (!s) s = "", dofree=0;
if (!t) t = "";
if (!u) u = "";
res = xmalloc(strlen(s) + strlen(t) + strlen(u) + 1);
strcpy(res, s);
strcat(res, t);
strcat(res, u);
- free((void *) s);
+ if (dofree)
+ free((void *) s);
return res;
}
@@ -69,7 +72,9 @@ char *
xstrconcat4 (const char *s, const char *t, const char *u, const char *v) {
char *res;
- if (!s) s = "";
+ int dofree = 1;
+
+ if (!s) s = "", dofree=0;
if (!t) t = "";
if (!u) u = "";
if (!v) v = "";
@@ -78,7 +83,8 @@ xstrconcat4 (const char *s, const char *
strcat(res, t);
strcat(res, u);
strcat(res, v);
- free((void *) s);
+ if (dofree)
+ free((void *) s);
return res;
}
diff -up nfs-utils-2.3.3/support/nfs/xlog.c.orig nfs-utils-2.3.3/support/nfs/xlog.c
--- nfs-utils-2.3.3/support/nfs/xlog.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/xlog.c 2019-09-18 10:57:56.717567629 -0400
@@ -135,10 +135,14 @@ xlog_from_conffile(char *service)
struct conf_list_node *n;
kinds = conf_get_list(service, "debug");
- if (!kinds || !kinds->cnt)
+ if (!kinds || !kinds->cnt) {
+ free(kinds);
return;
+ }
TAILQ_FOREACH(n, &(kinds->fields), link)
xlog_sconfig(n->field, 1);
+
+ conf_free_list(kinds);
}
int
diff -up nfs-utils-2.3.3/support/nsm/file.c.orig nfs-utils-2.3.3/support/nsm/file.c
--- nfs-utils-2.3.3/support/nsm/file.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nsm/file.c 2019-09-18 10:57:56.717567629 -0400
@@ -533,6 +533,7 @@ nsm_update_kernel_state(const int state)
len = snprintf(buf, sizeof(buf), "%d", state);
if (error_check(len, sizeof(buf))) {
xlog_warn("Failed to form NSM state number string");
+ close(fd);
return;
}
diff -up nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c.orig nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c
--- nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c 2019-09-18 10:57:56.717567629 -0400
@@ -69,12 +69,16 @@ int generate_target(char *pipefs_path, c
return 1;
ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname);
- if (ret)
+ if (ret) {
+ free(pipefs_unit);
return ret;
+ }
path = malloc(strlen(dirname) + 1 + sizeof(filebase));
- if (!path)
+ if (!path) {
+ free(pipefs_unit);
return 2;
+ }
sprintf(path, "%s", dirname);
mkdir(path, 0755);
strcat(path, filebase);
@@ -82,6 +86,7 @@ int generate_target(char *pipefs_path, c
if (!f)
{
free(path);
+ free(pipefs_unit);
return 1;
}
@@ -90,6 +95,7 @@ int generate_target(char *pipefs_path, c
fprintf(f, "After=%s\n", pipefs_unit);
fclose(f);
free(path);
+ free(pipefs_unit);
return 0;
}
diff -up nfs-utils-2.3.3/utils/blkmapd/device-discovery.c.orig nfs-utils-2.3.3/utils/blkmapd/device-discovery.c
--- nfs-utils-2.3.3/utils/blkmapd/device-discovery.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/blkmapd/device-discovery.c 2019-09-18 10:58:54.444237714 -0400
@@ -186,8 +186,11 @@ static void bl_add_disk(char *filepath)
}
}
- if (disk && diskpath)
+ if (disk && diskpath) {
+ if (serial)
+ free(serial);
return;
+ }
/* add path */
path = malloc(sizeof(struct bl_disk_path));
@@ -223,6 +226,8 @@ static void bl_add_disk(char *filepath)
disk->size = size;
disk->valid_path = path;
}
+ if (serial)
+ free(serial);
}
return;
@@ -232,6 +237,9 @@ static void bl_add_disk(char *filepath)
free(path->full_path);
free(path);
}
+ if (serial)
+ free(serial);
+
return;
}
@@ -375,7 +383,12 @@ static void bl_rpcpipe_cb(void)
if (event->mask & IN_CREATE) {
BL_LOG_WARNING("nfs pipe dir created\n");
bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd);
+ if (bl_pipe_fd >= 0)
+ close(bl_pipe_fd);
bl_pipe_fd = open(bl_pipe_file, O_RDWR);
+ if (bl_pipe_fd < 0)
+ BL_LOG_ERR("open %s failed: %s\n",
+ event->name, strerror(errno));
} else if (event->mask & IN_DELETE) {
BL_LOG_WARNING("nfs pipe dir deleted\n");
inotify_rm_watch(bl_watch_fd, nfs_pipedir_wfd);
@@ -388,6 +401,8 @@ static void bl_rpcpipe_cb(void)
continue;
if (event->mask & IN_CREATE) {
BL_LOG_WARNING("blocklayout pipe file created\n");
+ if (bl_pipe_fd >= 0)
+ close(bl_pipe_fd);
bl_pipe_fd = open(bl_pipe_file, O_RDWR);
if (bl_pipe_fd < 0)
BL_LOG_ERR("open %s failed: %s\n",
diff -up nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig nfs-utils-2.3.3/utils/gssd/krb5_util.c
--- nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/gssd/krb5_util.c 2019-09-18 10:57:56.718567624 -0400
@@ -698,6 +698,8 @@ gssd_search_krb5_keytab(krb5_context con
"we failed to unparse principal name: %s\n",
k5err);
k5_free_kt_entry(context, kte);
+ free(k5err);
+ k5err = NULL;
continue;
}
printerr(4, "Processing keytab entry for principal '%s'\n",
@@ -899,6 +901,8 @@ find_keytab_entry(krb5_context context,
k5err = gssd_k5_err_msg(context, code);
printerr(1, "%s while building principal for '%s'\n",
k5err, spn);
+ free(k5err);
+ k5err = NULL;
continue;
}
code = krb5_kt_get_entry(context, kt, princ, 0, 0, kte);
@@ -1168,7 +1172,8 @@ gssd_get_krb5_machine_cred_list(char ***
*list = l;
retval = 0;
goto out;
- }
+ } else
+ free((void *)l);
out:
return retval;
}
@@ -1216,6 +1221,8 @@ gssd_destroy_krb5_machine_creds(void)
printerr(0, "WARNING: %s while resolving credential "
"cache '%s' for destruction\n", k5err,
ple->ccname);
+ free(k5err);
+ k5err = NULL;
continue;
}
diff -up nfs-utils-2.3.3/utils/mount/configfile.c.orig nfs-utils-2.3.3/utils/mount/configfile.c
--- nfs-utils-2.3.3/utils/mount/configfile.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mount/configfile.c 2019-09-18 10:57:56.718567624 -0400
@@ -404,7 +404,7 @@ char *conf_get_mntopts(char *spec, char
/* list_size + optlen + ',' + '\0' */
config_opts = calloc(1, (list_size+optlen+2));
- if (server == NULL) {
+ if (config_opts == NULL) {
xlog_warn("conf_get_mountops: Unable calloc memory for config_opts");
free_all();
return mount_opts;
diff -up nfs-utils-2.3.3/utils/mountd/cache.c.orig nfs-utils-2.3.3/utils/mountd/cache.c
--- nfs-utils-2.3.3/utils/mountd/cache.c.orig 2019-09-18 10:57:14.190810677 -0400
+++ nfs-utils-2.3.3/utils/mountd/cache.c 2019-09-18 10:57:56.718567624 -0400
@@ -1240,7 +1240,7 @@ static struct exportent *lookup_junction
goto out;
}
status = nfs_get_basic_junction(pathname, &locations);
- switch (status) {
+ if (status) {
xlog(L_WARNING, "Dangling junction %s: %s",
pathname, strerror(status));
goto out;
@@ -1248,10 +1248,11 @@ static struct exportent *lookup_junction
parent = lookup_parent_export(dom, pathname, ai);
if (parent == NULL)
- goto out;
+ goto free_locations;
exp = locations_to_export(locations, pathname, parent);
+free_locations:
nfs_free_locations(locations->ns_list);
free(locations);
diff -up nfs-utils-2.3.3/utils/mountd/fsloc.c.orig nfs-utils-2.3.3/utils/mountd/fsloc.c
--- nfs-utils-2.3.3/utils/mountd/fsloc.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mountd/fsloc.c 2019-09-18 10:57:56.719567618 -0400
@@ -102,6 +102,7 @@ static struct servers *parse_list(char *
cp = strchr(list[i], '@');
if ((!cp) || list[i][0] != '/') {
xlog(L_WARNING, "invalid entry '%s'", list[i]);
+ free(mp);
continue; /* XXX Need better error handling */
}
res->h_mp[i] = mp;
diff -up nfs-utils-2.3.3/utils/mount/nfsmount.c.orig nfs-utils-2.3.3/utils/mount/nfsmount.c
--- nfs-utils-2.3.3/utils/mount/nfsmount.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mount/nfsmount.c 2019-09-18 10:57:56.730567555 -0400
@@ -452,6 +452,7 @@ parse_options(char *old_opts, struct nfs
nfs_error(_("%s: Bad nfs mount parameter: %s\n"), progname, opt);
out_bad:
free(tmp_opts);
+ free(mounthost);
return 0;
}
diff -up nfs-utils-2.3.3/utils/mount/stropts.c.orig nfs-utils-2.3.3/utils/mount/stropts.c
--- nfs-utils-2.3.3/utils/mount/stropts.c.orig 2019-09-18 10:57:14.183810717 -0400
+++ nfs-utils-2.3.3/utils/mount/stropts.c 2019-09-18 10:57:56.730567555 -0400
@@ -982,8 +982,11 @@ static int nfs_try_mount(struct nfsmount
}
if (!nfs_append_addr_option(address->ai_addr,
- address->ai_addrlen, mi->options))
+ address->ai_addrlen, mi->options)) {
+ freeaddrinfo(address);
+ errno = ENOMEM;
return 0;
+ }
mi->address = address;
}
diff -up nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c.orig nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c
--- nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c 2019-09-18 10:57:56.731567549 -0400
@@ -215,6 +215,8 @@ sqlite_maindb_init_v2(void)
&err);
if (ret != SQLITE_OK) {
xlog(L_ERROR, "Unable to begin transaction: %s", err);
+ if (err)
+ sqlite3_free(err);
return ret;
}
diff -up nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c.orig nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c
--- nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c.orig 2019-11-11 08:49:06.044870974 -0500
+++ nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c 2019-11-11 09:19:10.391896845 -0500
@@ -486,6 +486,9 @@ out:
if (gss_methods)
conf_free_list(gss_methods);
+ if (nfs4_methods)
+ conf_free_list(nfs4_methods);
+
return ret ? -ENOENT: 0;
}
diff -up nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig nfs-utils-2.3.3/utils/gssd/krb5_util.c
--- nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig 2019-11-11 08:49:06.045870979 -0500
+++ nfs-utils-2.3.3/utils/gssd/krb5_util.c 2019-11-11 09:19:10.393896856 -0500
@@ -911,6 +911,8 @@ find_keytab_entry(krb5_context context,
k5err = gssd_k5_err_msg(context, code);
printerr(3, "%s while getting keytab entry for '%s'\n",
k5err, spn);
+ free(k5err);
+ k5err = NULL;
/*
* We tried the active directory machine account
* with the hostname part as-is and failed...
@@ -1013,6 +1015,8 @@ query_krb5_ccache(const char* cred_cache
char *str = NULL;
char *princstring;
+ *ret_princname = *ret_realm = NULL;
+
ret = krb5_init_context(&context);
if (ret)
return 0;
@@ -1047,7 +1051,7 @@ err_princ:
krb5_cc_close(context, ccache);
err_cache:
krb5_free_context(context);
- return found;
+ return (*ret_princname && *ret_realm);
}
/*==========================*/
@@ -1230,6 +1234,8 @@ 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);
+ k5err = NULL;
}
}
krb5_free_context(context);
diff -up nfs-utils-2.3.3/utils/idmapd/idmapd.c.orig nfs-utils-2.3.3/utils/idmapd/idmapd.c
--- nfs-utils-2.3.3/utils/idmapd/idmapd.c.orig 2019-11-11 08:49:06.029870889 -0500
+++ nfs-utils-2.3.3/utils/idmapd/idmapd.c 2019-11-11 09:19:10.393896856 -0500
@@ -517,14 +517,16 @@ static void
clntscancb(int UNUSED(fd), short UNUSED(which), void *data)
{
struct idmap_clientq *icq = data;
- struct idmap_client *ic;
+ struct idmap_client *ic, *ic_next;
- TAILQ_FOREACH(ic, icq, ic_next)
+ for (ic = TAILQ_FIRST(icq); ic != NULL; ic = ic_next) {
+ ic_next = TAILQ_NEXT(ic, ic_next);
if (ic->ic_fd == -1 && nfsopen(ic) == -1) {
close(ic->ic_dirfd);
TAILQ_REMOVE(icq, ic, ic_next);
free(ic);
}
+ }
}
static void
diff -up nfs-utils-2.3.3/utils/statd/monitor.c.orig nfs-utils-2.3.3/utils/statd/monitor.c
--- nfs-utils-2.3.3/utils/statd/monitor.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/statd/monitor.c 2019-11-11 09:19:10.393896856 -0500
@@ -66,7 +66,7 @@ sm_mon_1_svc(struct mon *argp, struct sv
*my_name = argp->mon_id.my_id.my_name;
struct my_id *id = &argp->mon_id.my_id;
char *cp;
- notify_list *clnt;
+ notify_list *clnt = NULL;
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:
xlog_warn("STAT_FAIL to %s for SM_MON of %s", my_name, mon_name);
+ free(clnt);
return (&result);
}
@@ -242,6 +244,7 @@ load_one_host(const char *hostname,
clnt->dns_name = strdup(hostname);
if (clnt->dns_name == NULL) {
nlist_free(NULL, clnt);
+ free(clnt);
return 0;
}
diff -up nfs-utils-2.3.3/utils/statd/notlist.c.orig nfs-utils-2.3.3/utils/statd/notlist.c
--- nfs-utils-2.3.3/utils/statd/notlist.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/statd/notlist.c 2019-11-11 09:19:10.394896861 -0500
@@ -210,7 +210,6 @@ nlist_free(notify_list **head, notify_li
if (NL_MON_NAME(entry))
free(NL_MON_NAME(entry));
free(entry->dns_name);
- free(entry);
}
/*
@@ -219,8 +218,14 @@ nlist_free(notify_list **head, notify_li
void
nlist_kill(notify_list **head)
{
- while (*head)
+ notify_list *next;
+
+ while (*head) {
+ next = (*head)->next;
nlist_free(head, *head);
+ free(*head);
+ *head = next;
+ }
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
diff -up nfs-utils-2.3.3/utils/gssd/gssd.c.orig nfs-utils-2.3.3/utils/gssd/gssd.c
--- nfs-utils-2.3.3/utils/gssd/gssd.c.orig 2019-11-11 09:23:28.920435729 -0500
+++ nfs-utils-2.3.3/utils/gssd/gssd.c 2019-11-26 13:59:52.812685585 -0500
@@ -1020,11 +1020,11 @@ main(int argc, char *argv[])
"support setting debug levels\n");
#endif
+ daemon_init(fg);
+
if (gssd_check_mechs() != 0)
errx(1, "Problem with gssapi library");
- daemon_init(fg);
-
event_init();
pipefs_dir = opendir(pipefs_path);

View File

@ -0,0 +1,29 @@
commit 52db5259fe78c2b948df279b697412f99e12f229
Author: Yongcheng Yang <yongcheng.yang@gmail.com>
Date: Fri Aug 23 14:06:42 2019 -0400
gssd: add configure options verbosity to man page rpc.gssd(8)
Signed-off-by: Pierguido Lambri <plambri@redhat.com>
Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
index e620f0d1..cc3a210a 100644
--- a/utils/gssd/gssd.man
+++ b/utils/gssd/gssd.man
@@ -305,6 +305,14 @@ section of the
.I /etc/nfs.conf
configuration file. Values recognized include:
.TP
+.B verbosity
+Value which is equivalent to the number of
+.BR -v .
+.TP
+.B rpc-verbosity
+Value which is equivalent to the number of
+.BR -r .
+.TP
.B use-memcache
A Boolean flag equivalent to
.BR -M .

View File

@ -0,0 +1,52 @@
commit 64d83364b08ab32c6b8fee903529314349175772
Author: Pierguido Lambri <plambri@redhat.com>
Date: Mon Mar 11 13:50:57 2019 -0400
gssd: add verbosity options to the rpc.gssd man page
It also adds the commented out entries in the nfs.conf
default file.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1668026
Signed-off-by: Pierguido Lambri <plambri@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff -up nfs-utils-2.3.3/nfs.conf.orig nfs-utils-2.3.3/nfs.conf
--- nfs-utils-2.3.3/nfs.conf.orig 2019-03-19 11:04:16.903567972 -0400
+++ nfs-utils-2.3.3/nfs.conf 2019-03-19 11:10:54.452251970 -0400
@@ -9,6 +9,8 @@
# debug=0
#
[gssd]
+# verbosity=0
+# rpc-verbosity=0
# use-memcache=0
# use-machine-creds=1
use-gss-proxy=1
diff -up nfs-utils-2.3.3/systemd/nfs.conf.man.orig nfs-utils-2.3.3/systemd/nfs.conf.man
--- nfs-utils-2.3.3/systemd/nfs.conf.man.orig 2019-03-19 11:04:16.911567926 -0400
+++ nfs-utils-2.3.3/systemd/nfs.conf.man 2019-03-19 11:10:54.452251970 -0400
@@ -211,6 +211,8 @@ for details.
.TP
.B gssd
Recognized values:
+.BR verbosity ,
+.BR rpc-verbosity ,
.BR use-memcache ,
.BR use-machine-creds ,
.BR use-gss-proxy ,
diff -up nfs-utils-2.3.3/utils/gssd/gssd.c.orig nfs-utils-2.3.3/utils/gssd/gssd.c
--- nfs-utils-2.3.3/utils/gssd/gssd.c.orig 2019-03-19 11:04:16.893568031 -0400
+++ nfs-utils-2.3.3/utils/gssd/gssd.c 2019-03-19 11:10:54.453251964 -0400
@@ -890,8 +890,8 @@ main(int argc, char *argv[])
read_gss_conf();
- verbosity = conf_get_num("gssd", "Verbosity", verbosity);
- rpc_verbosity = conf_get_num("gssd", "RPC-Verbosity", rpc_verbosity);
+ verbosity = conf_get_num("gssd", "verbosity", verbosity);
+ rpc_verbosity = conf_get_num("gssd", "rpc-verbosity", rpc_verbosity);
while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) {
switch (opt) {

View File

@ -0,0 +1,49 @@
From fd2e952319c748e1c7babb1db97b371ebf6748a9 Mon Sep 17 00:00:00 2001
From: Alice J Mitchell <ajmitchell@redhat.com>
Date: Mon, 29 Jul 2019 15:47:40 +0100
Subject: [PATCH] Fix the error handling if the lseek fails
The error case when lseek returns a negative value was not correctly handled,
and the error cleanup routine was potentially leaking memory also.
Signed-off-by: Alice J Mitchell <ajmitchell@redhat.com>
---
support/nfs/conffile.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index b6400be..6ba8a35 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -500,7 +500,7 @@ conf_readfile(const char *path)
if ((stat (path, &sb) == 0) || (errno != ENOENT)) {
char *new_conf_addr = NULL;
- size_t sz = sb.st_size;
+ off_t sz;
int fd = open (path, O_RDONLY, 0);
if (fd == -1) {
@@ -517,6 +517,11 @@ conf_readfile(const char *path)
/* only after we have the lock, check the file size ready to read it */
sz = lseek(fd, 0, SEEK_END);
+ if (sz < 0) {
+ xlog_warn("conf_readfile: unable to determine file size: %s",
+ strerror(errno));
+ goto fail;
+ }
lseek(fd, 0, SEEK_SET);
new_conf_addr = malloc(sz+1);
@@ -2162,6 +2167,7 @@ conf_write(const char *filename, const char *section, const char *arg,
ret = 0;
cleanup:
+ flush_outqueue(&inqueue, NULL);
flush_outqueue(&outqueue, NULL);
if (buff)
--
1.8.3.1

View File

@ -0,0 +1,37 @@
From ccdd8c803182f5c172580379a56e84a23789cf0d Mon Sep 17 00:00:00 2001
From: Alice J Mitchell <ajmitchell@redhat.com>
Date: Mon, 29 Jul 2019 15:49:34 +0100
Subject: [PATCH] Fix memory leak on error in nfs-server-generator
Fix the trivial memory leak in the error handling of nfs-server-generator
Resolves: bz1440524
Signed-off-by: Alice J Mitchell <ajmitchell@redhat.com>
---
systemd/nfs-server-generator.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c
index 737f109..eec98fd 100644
--- a/systemd/nfs-server-generator.c
+++ b/systemd/nfs-server-generator.c
@@ -25,6 +25,7 @@
#include <ctype.h>
#include <stdio.h>
#include <mntent.h>
+#include <alloca.h>
#include "misc.h"
#include "nfslib.h"
@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
exit(1);
}
- path = malloc(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase));
+ path = alloca(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase));
if (!path)
exit(2);
if (export_read(_PATH_EXPORTS, 1) +
--
1.8.3.1

View File

@ -0,0 +1,48 @@
commit a709f25c1da4a2fb44a1f3fd060298fbbd88aa3c
Author: Steve Dickson <steved@redhat.com>
Date: Tue May 14 15:52:50 2019 -0400
mount: Report correct error in the fall_back cases.
In mount auto negotiation, a v3 mount is tried
when the v4 fails with error that could mean
v4 is not supported.
When the v3 mount fails, the original v4 failure
should be used to set the errno, not the v3 failure.
Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=1709961
Signed-off-by: Steve Dickson <steved@redhat.com>
diff -up nfs-utils-2.3.3/utils/mount/stropts.c.orig nfs-utils-2.3.3/utils/mount/stropts.c
--- nfs-utils-2.3.3/utils/mount/stropts.c.orig 2019-08-12 10:58:32.610650773 -0400
+++ nfs-utils-2.3.3/utils/mount/stropts.c 2019-08-12 11:10:39.661142985 -0400
@@ -888,7 +888,7 @@ out:
*/
static int nfs_autonegotiate(struct nfsmount_info *mi)
{
- int result;
+ int result, olderrno;
result = nfs_try_mount_v4(mi);
check_result:
@@ -948,7 +948,18 @@ fall_back:
if (mi->version.v_mode == V_GENERAL)
/* v2,3 fallback not allowed */
return result;
- return nfs_try_mount_v3v2(mi, FALSE);
+
+ /*
+ * Save the original errno in case the v3
+ * mount fails from one of the fall_back cases.
+ * Report the first failure not the v3 mount failure
+ */
+ olderrno = errno;
+ if ((result = nfs_try_mount_v3v2(mi, FALSE)))
+ return result;
+
+ errno = olderrno;
+ return result;
}
/*

View File

@ -0,0 +1,77 @@
commit 50ef80739d9e1e0df6616289ef2ff626a94666ee
Author: Steve Dickson <steved@redhat.com>
Date: Thu May 23 09:24:49 2019 -0400
rpc.mountd: Fix e_hostname and e_uuid leaks
strdup of exportent uuid and hostname in getexportent() ends up leaking
memory. Free the memory before getexportent() is called again from xtab_read()
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1713360
Signed-off-by: Nikhil Kshirsagar <nkshirsa@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/export/xtab.c b/support/export/xtab.c
index d42eeef..1e1d679 100644
--- a/support/export/xtab.c
+++ b/support/export/xtab.c
@@ -50,6 +50,14 @@ xtab_read(char *xtab, char *lockfn, int is_export)
while ((xp = getexportent(is_export==0, 0)) != NULL) {
if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
!(exp = export_create(xp, is_export!=1))) {
+ if(xp->e_hostname) {
+ free(xp->e_hostname);
+ xp->e_hostname=NULL;
+ }
+ if(xp->e_uuid) {
+ free(xp->e_uuid);
+ xp->e_uuid=NULL;
+ }
continue;
}
switch (is_export) {
@@ -62,7 +70,16 @@ xtab_read(char *xtab, char *lockfn, int is_export)
if ((xp->e_flags & NFSEXP_FSID) && xp->e_fsid == 0)
v4root_needed = 0;
break;
- }
+ }
+ if(xp->e_hostname) {
+ free(xp->e_hostname);
+ xp->e_hostname=NULL;
+ }
+ if(xp->e_uuid) {
+ free(xp->e_uuid);
+ xp->e_uuid=NULL;
+ }
+
}
endexportent();
xfunlock(lockid);
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index 5f4cb95..a7582ca 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -179,9 +179,20 @@ getexportent(int fromkernel, int fromexports)
}
ee.e_hostname = xstrdup(hostname);
- if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
- return NULL;
+ if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) {
+ if(ee.e_hostname)
+ {
+ xfree(ee.e_hostname);
+ ee.e_hostname=NULL;
+ }
+ if(ee.e_uuid)
+ {
+ xfree(ee.e_uuid);
+ ee.e_uuid=NULL;
+ }
+ return NULL;
+ }
/* resolve symlinks */
if (realpath(ee.e_path, rpath) != NULL) {
rpath[sizeof (rpath) - 1] = '\0';

View File

@ -0,0 +1,276 @@
diff -up nfs-utils-2.3.3/support/nfs/conffile.c.orig nfs-utils-2.3.3/support/nfs/conffile.c
--- nfs-utils-2.3.3/support/nfs/conffile.c.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/support/nfs/conffile.c 2019-04-25 10:58:27.199907596 -0400
@@ -50,6 +50,7 @@
#include <err.h>
#include <syslog.h>
#include <libgen.h>
+#include <sys/file.h>
#include "conffile.h"
#include "xlog.h"
@@ -509,6 +510,17 @@ conf_readfile(const char *path)
return NULL;
}
+ /* Grab a shared lock to ensure its not mid-rewrite */
+ if (flock(fd, LOCK_SH)) {
+ xlog_warn("conf_readfile: attempt to grab read lock failed: %s",
+ strerror(errno));
+ goto fail;
+ }
+
+ /* only after we have the lock, check the file size ready to read it */
+ sz = lseek(fd, 0, SEEK_END);
+ lseek(fd, 0, SEEK_SET);
+
new_conf_addr = malloc(sz+1);
if (!new_conf_addr) {
xlog_warn("conf_readfile: malloc (%lu) failed", (unsigned long)sz);
@@ -1588,6 +1600,17 @@ flush_outqueue(struct tailhead *queue, F
return 0;
}
+/* append one queue to another */
+static void
+append_queue(struct tailhead *inq, struct tailhead *outq)
+{
+ while (inq->tqh_first != NULL) {
+ struct outbuffer *ob = inq->tqh_first;
+ TAILQ_REMOVE(inq, ob, link);
+ TAILQ_INSERT_TAIL(outq, ob, link);
+ }
+}
+
/* read one line of text from a file, growing the buffer as necessary */
static int
read_line(char **buff, int *buffsize, FILE *in)
@@ -1728,6 +1751,16 @@ is_folded(const char *line)
return false;
}
+static int
+lock_file(FILE *f)
+{
+ int ret;
+ ret = flock(fileno(f), LOCK_EX);
+ if (ret)
+ xlog(L_ERROR, "Error could not lock the file");
+ return ret;
+}
+
/***
* Write a value to an nfs.conf style filename
*
@@ -1738,15 +1771,14 @@ int
conf_write(const char *filename, const char *section, const char *arg,
const char *tag, const char *value)
{
- int fdout = -1;
- char *outpath = NULL;
- FILE *outfile = NULL;
FILE *infile = NULL;
int ret = 1;
struct tailhead outqueue;
+ struct tailhead inqueue;
char * buff = NULL;
int buffsize = 0;
+ TAILQ_INIT(&inqueue);
TAILQ_INIT(&outqueue);
if (!filename) {
@@ -1759,26 +1791,7 @@ conf_write(const char *filename, const c
return ret;
}
- if (asprintf(&outpath, "%s.XXXXXX", filename) == -1) {
- xlog(L_ERROR, "conf_write: error composing temp filename");
- return ret;
- }
-
- fdout = mkstemp(outpath);
- if (fdout < 0) {
- xlog(L_ERROR, "conf_write: open temp file %s failed: %s",
- outpath, strerror(errno));
- goto cleanup;
- }
-
- outfile = fdopen(fdout, "w");
- if (!outfile) {
- xlog(L_ERROR, "conf_write: fdopen temp file failed: %s",
- strerror(errno));
- goto cleanup;
- }
-
- infile = fopen(filename, "r");
+ infile = fopen(filename, "r+");
if (!infile) {
if (!value) {
xlog_warn("conf_write: config file \"%s\" not found, nothing to do", filename);
@@ -1787,18 +1800,29 @@ conf_write(const char *filename, const c
}
xlog_warn("conf_write: config file \"%s\" not found, creating.", filename);
- if (append_line(&outqueue, NULL, make_section(section, arg)))
+ infile = fopen(filename, "wx");
+ if (!infile) {
+ xlog(L_ERROR, "conf_write: Error creating config file \"%s\".", filename);
+ goto cleanup;
+ }
+
+ if (lock_file(infile))
goto cleanup;
- if (append_line(&outqueue, NULL, make_tagline(tag, value)))
+ if (append_line(&inqueue, NULL, make_section(section, arg)))
goto cleanup;
- if (flush_outqueue(&outqueue, outfile))
+ if (append_line(&inqueue, NULL, make_tagline(tag, value)))
goto cleanup;
+
+ append_queue(&inqueue, &outqueue);
} else {
bool found = false;
int err = 0;
+ if (lock_file(infile))
+ goto cleanup;
+
buffsize = 4096;
buff = calloc(1, buffsize);
if (buff == NULL) {
@@ -1813,7 +1837,7 @@ conf_write(const char *filename, const c
/* read in one section worth of lines */
do {
if (*buff != '\0') {
- if (append_line(&outqueue, NULL, strdup(buff)))
+ if (append_line(&inqueue, NULL, strdup(buff)))
goto cleanup;
}
@@ -1821,7 +1845,7 @@ conf_write(const char *filename, const c
} while (err == 0 && buff[0] != '[');
/* find the section header */
- where = TAILQ_FIRST(&outqueue);
+ where = TAILQ_FIRST(&inqueue);
while (where != NULL) {
if (where->text != NULL && where->text[0] == '[')
break;
@@ -1845,7 +1869,7 @@ conf_write(const char *filename, const c
/* remove current tag */
do {
struct outbuffer *next = TAILQ_NEXT(where, link);
- TAILQ_REMOVE(&outqueue, where, link);
+ TAILQ_REMOVE(&inqueue, where, link);
if (is_folded(where->text))
again = true;
else
@@ -1857,14 +1881,14 @@ conf_write(const char *filename, const c
/* insert new tag */
if (value) {
- if (append_line(&outqueue, prev, make_tagline(tag, value)))
+ if (append_line(&inqueue, prev, make_tagline(tag, value)))
goto cleanup;
}
} else
/* no existing assignment found and we need to add one */
if (value) {
/* rewind past blank lines and comments */
- struct outbuffer *tail = TAILQ_LAST(&outqueue, tailhead);
+ struct outbuffer *tail = TAILQ_LAST(&inqueue, tailhead);
/* comments immediately before a section usually relate
* to the section below them */
@@ -1876,7 +1900,7 @@ conf_write(const char *filename, const c
tail = TAILQ_PREV(tail, tailhead, link);
/* now add the tag here */
- if (append_line(&outqueue, tail, make_tagline(tag, value)))
+ if (append_line(&inqueue, tail, make_tagline(tag, value)))
goto cleanup;
found = true;
@@ -1886,49 +1910,45 @@ conf_write(const char *filename, const c
/* EOF and correct section not found, so add one */
if (err && !found && value) {
/* did the last section end in a blank line */
- struct outbuffer *tail = TAILQ_LAST(&outqueue, tailhead);
+ struct outbuffer *tail = TAILQ_LAST(&inqueue, tailhead);
if (tail && !is_empty(tail->text)) {
/* no, so add one for clarity */
- if (append_line(&outqueue, NULL, strdup("\n")))
+ if (append_line(&inqueue, NULL, strdup("\n")))
goto cleanup;
}
/* add the new section header */
- if (append_line(&outqueue, NULL, make_section(section, arg)))
+ if (append_line(&inqueue, NULL, make_section(section, arg)))
goto cleanup;
/* now add the tag */
- if (append_line(&outqueue, NULL, make_tagline(tag, value)))
+ if (append_line(&inqueue, NULL, make_tagline(tag, value)))
goto cleanup;
}
- /* we are done with this section, write it out */
- if (flush_outqueue(&outqueue, outfile))
- goto cleanup;
+ /* we are done with this section, move it to the out queue */
+ append_queue(&inqueue, &outqueue);
} while(err == 0);
}
- if (infile) {
- fclose(infile);
- infile = NULL;
- }
+ /* now rewind and overwrite the file with the updated data */
+ rewind(infile);
- fdout = -1;
- if (fclose(outfile)) {
- xlog(L_ERROR, "Error writing config file: %s", strerror(errno));
+ if (ftruncate(fileno(infile), 0)) {
+ xlog(L_ERROR, "Error truncating config file");
goto cleanup;
}
- /* now swap the old file for the new one */
- if (rename(outpath, filename)) {
- xlog(L_ERROR, "Error updating config file: %s: %s\n", filename, strerror(errno));
- ret = 1;
- } else {
- ret = 0;
- free(outpath);
- outpath = NULL;
+ if (flush_outqueue(&outqueue, infile))
+ goto cleanup;
+
+ if (infile) {
+ fclose(infile);
+ infile = NULL;
}
+ ret = 0;
+
cleanup:
flush_outqueue(&outqueue, NULL);
@@ -1936,11 +1956,5 @@ cleanup:
free(buff);
if (infile)
fclose(infile);
- if (fdout != -1)
- close(fdout);
- if (outpath) {
- unlink(outpath);
- free(outpath);
- }
return ret;
}

View File

@ -0,0 +1,23 @@
commit 268e3c0cff6d6aee3b8f5458545f8dab76d7d444
Author: Steve Dickson <steved@redhat.com>
Date: Mon Feb 4 15:17:42 2019 -0500
nfs.conf: Fixed manage-gids option typo
Reported-by: Adam DiFrischia <adifrischia@curtisswright.com>
BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=333
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/nfs.conf b/nfs.conf
index 796bee4..722b024 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -26,7 +26,7 @@
#
[mountd]
# debug=0
-# manage_gids=n
+# manage-gids=n
# descriptors=0
# port=0
# threads=1

View File

@ -0,0 +1,73 @@
commit 0240df0e8ccf7be2706a6a10a2a620f8eda55275
Author: Yongcheng Yang <yongcheng.yang@gmail.com>
Date: Thu Sep 5 07:36:26 2019 -0400
nfsd: Adjust nfs.conf setting/parsing of rdma port
The rpc.nfsd program can use option "--rdma" to enable
RDMA on the standard port (nfsrdma/20049) or "--rdma=port"
for an alternate port.
But now in /etc/nfs.conf, we need to specify the port
number (e.g. rdma=nfsrdma) to enable it, which is not
convenient.
The default setting "rdma=n" may cause more confusion.
Update to enable RDMA on standard port when setting
boolean YES to "rdma=". And using "rdma-port=" for an
alternate port if necessary.
Also let previous config (e.g. rdma=nfsrdma) work as well.
Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/nfs.conf b/nfs.conf
index 85097fd..186a5b1 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -63,6 +63,7 @@
# vers4.1=y
# vers4.2=y
# rdma=n
+# rdma-port=20049
#
[statd]
# debug=0
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index b256bd9..a412a02 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -92,7 +92,14 @@ main(int argc, char **argv)
port = conf_get_str("nfsd", "port");
if (!port)
port = "nfs";
- rdma_port = conf_get_str("nfsd", "rdma");
+ if (conf_get_bool("nfsd", "rdma", false)) {
+ rdma_port = conf_get_str("nfsd", "rdma-port");
+ if (!rdma_port)
+ rdma_port = "nfsrdma";
+ }
+ /* backward compatibility - nfs.conf used to set rdma port directly */
+ if (!rdma_port)
+ rdma_port = conf_get_str("nfsd", "rdma");
if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
NFSCTL_UDPSET(protobits);
else
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index d83ef86..2701ba7 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -144,7 +144,11 @@ The lease time for NFSv4, in seconds.
Set the port for TCP/UDP to bind to.
.TP
.B rdma
-Set RDMA port. Use "rdma=nfsrdma" to enable standard port.
+Enable RDMA port (with "on" or "yes" etc) on the standard port
+("nfsrdma", port 20049).
+.TP
+.B rdma-port
+Set an alternate RDMA port.
.TP
.B UDP
Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.

View File

@ -0,0 +1,159 @@
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 48ef0964..bda9af67 100755
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -308,6 +308,8 @@ class DeviceData:
op = words[0][:-1]
self.__rpc_data['ops'] += [op]
self.__rpc_data[op] = [int(word) for word in words[1:]]
+ if len(self.__rpc_data[op]) < 9:
+ self.__rpc_data[op] += [0]
def parse_stats(self, lines):
"""Turn a list of lines from a mount stat file into a
@@ -475,7 +477,9 @@ class DeviceData:
retrans = stats[2] - count
if retrans != 0:
print('\t%d retrans (%d%%)' % (retrans, ((retrans * 100) / count)), end=' ')
- print('\t%d major timeouts' % stats[3])
+ print('\t%d major timeouts' % stats[3], end='')
+ if len(stats) >= 10 and stats[9] != 0:
+ print('\t%d errors (%d%%)' % (stats[9], ((stats[9] * 100) / count)))
else:
print('')
print('\tavg bytes sent per op: %d\tavg bytes received per op: %d' % \
@@ -580,7 +584,7 @@ class DeviceData:
self.__nfs_data['fstype'] = 'nfs4'
self.__rpc_data['ops'] = ops
for op in ops:
- self.__rpc_data[op] = [0 for i in range(8)]
+ self.__rpc_data[op] = [0 for i in range(9)]
def accumulate_iostats(self, new_stats):
"""Accumulate counters from all RPC op buckets in new_stats. This is
@@ -605,6 +609,8 @@ class DeviceData:
queued_for = float(rpc_stats[5])
rtt = float(rpc_stats[6])
exe = float(rpc_stats[7])
+ if len(rpc_stats) >= 9:
+ errs = int(rpc_stats[8])
# prevent floating point exceptions
if ops != 0:
@@ -613,12 +619,15 @@ class DeviceData:
rtt_per_op = rtt / ops
exe_per_op = exe / ops
queued_for_per_op = queued_for / ops
+ if len(rpc_stats) >= 9:
+ errs_percent = (errs * 100) / ops
else:
kb_per_op = 0.0
retrans_percent = 0.0
rtt_per_op = 0.0
exe_per_op = 0.0
queued_for_per_op = 0.0
+ errs_percent = 0.0
op += ':'
print(format(op.lower(), '<16s'), end='')
@@ -628,7 +637,10 @@ class DeviceData:
print(format('retrans', '>16s'), end='')
print(format('avg RTT (ms)', '>16s'), end='')
print(format('avg exe (ms)', '>16s'), end='')
- print(format('avg queue (ms)', '>16s'))
+ print(format('avg queue (ms)', '>16s'), end='')
+ if len(rpc_stats) >= 9:
+ print(format('errors', '>16s'), end='')
+ print()
print(format((ops / sample_time), '>24.3f'), end='')
print(format((kilobytes / sample_time), '>16.3f'), end='')
@@ -637,7 +649,11 @@ class DeviceData:
print(format(retransmits, '>16'), end='')
print(format(rtt_per_op, '>16.3f'), end='')
print(format(exe_per_op, '>16.3f'), end='')
- print(format(queued_for_per_op, '>16.3f'))
+ print(format(queued_for_per_op, '>16.3f'), end='')
+ if len(rpc_stats) >= 9:
+ errors = '{0:>10.0f} ({1:>3.1f}%)'.format(errs, errs_percent).strip()
+ print(format(errors, '>16'), end='')
+ print()
def display_iostats(self, sample_time):
"""Display NFS and RPC stats in an iostat-like way
diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
old mode 100644
new mode 100755
index f1556fb7..5b2260ad
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -329,6 +329,8 @@ class DeviceData:
queued_for = float(rpc_stats[5])
rtt = float(rpc_stats[6])
exe = float(rpc_stats[7])
+ if len(rpc_stats) >= 9:
+ errs = float(rpc_stats[8])
# prevent floating point exceptions
if ops != 0:
@@ -337,12 +339,16 @@ class DeviceData:
rtt_per_op = rtt / ops
exe_per_op = exe / ops
queued_for_per_op = queued_for / ops
+ if len(rpc_stats) >= 9:
+ errs_percent = (errs * 100) / ops
else:
kb_per_op = 0.0
retrans_percent = 0.0
rtt_per_op = 0.0
exe_per_op = 0.0
queued_for_per_op = 0.0
+ if len(rpc_stats) >= 9:
+ errs_percent = 0.0
op += ':'
print(format(op.lower(), '<16s'), end='')
@@ -352,7 +358,10 @@ class DeviceData:
print(format('retrans', '>16s'), end='')
print(format('avg RTT (ms)', '>16s'), end='')
print(format('avg exe (ms)', '>16s'), end='')
- print(format('avg queue (ms)', '>16s'))
+ print(format('avg queue (ms)', '>16s'), end='')
+ if len(rpc_stats) >= 9:
+ print(format('errors', '>16s'), end='')
+ print()
print(format((ops / sample_time), '>24.3f'), end='')
print(format((kilobytes / sample_time), '>16.3f'), end='')
@@ -361,7 +370,11 @@ class DeviceData:
print(format(retransmits, '>16'), end='')
print(format(rtt_per_op, '>16.3f'), end='')
print(format(exe_per_op, '>16.3f'), end='')
- print(format(queued_for_per_op, '>16.3f'))
+ print(format(queued_for_per_op, '>16.3f'), end='')
+ if len(rpc_stats) >= 9:
+ errors = '{0:>10.0f} ({1:>3.1f}%)'.format(errs, errs_percent).strip()
+ print(format(errors, '>16'), end='')
+ print()
def ops(self, sample_time):
sends = float(self.__rpc_data['rpcsends'])
diff --git a/tools/nfs-iostat/nfsiostat.man b/tools/nfs-iostat/nfsiostat.man
index 9ae94c5f..940c0431 100644
--- a/tools/nfs-iostat/nfsiostat.man
+++ b/tools/nfs-iostat/nfsiostat.man
@@ -97,6 +97,14 @@ This is the duration from the time the NFS client created the RPC request task t
.RE
.RE
.RE
+.RS 8
+- \fBerrors\fR
+.RS
+This is the number of operations that completed with an error status (status < 0). This count is only available on kernels with RPC iostats version 1.1 or above.
+.RS
+.RE
+.RE
+.RE
.TP
Note that if an interval is used as argument to \fBnfsiostat\fR, then the diffrence from previous interval will be displayed, otherwise the results will be from the time that the share was mounted.

View File

@ -0,0 +1,22 @@
commit 2b78802c4eda6f74b77330832c54fd6b59991adf
Author: Josef Radinger <cheese@nosuchhost.net>
Date: Wed Jul 24 10:59:51 2019 -0400
nfs.man: Fixed small typo in man page
Fixes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=337
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
index 9ee9bd9..6ba9cef 100644
--- a/utils/mount/nfs.man
+++ b/utils/mount/nfs.man
@@ -1252,7 +1252,7 @@ If absolute cache coherence among clients is required,
applications should use file locking. Alternatively, applications
can also open their files with the O_DIRECT flag
to disable data caching entirely.
-.SS "File timestamp maintainence"
+.SS "File timestamp maintenance"
NFS servers are responsible for managing file and directory timestamps
.RB ( atime ,
.BR ctime ", and"

View File

@ -0,0 +1,73 @@
diff -up nfs-utils-2.3.3/nfs.conf.orig nfs-utils-2.3.3/nfs.conf
--- nfs-utils-2.3.3/nfs.conf.orig 2019-03-05 10:30:28.100560625 -0500
+++ nfs-utils-2.3.3/nfs.conf 2019-03-05 10:35:28.702004199 -0500
@@ -64,6 +64,7 @@ use-gss-proxy=1
#
[sm-notify]
# debug=0
+# force=0
# retry-time=900
# outgoing-port=
# outgoing-addr=
diff -up nfs-utils-2.3.3/utils/statd/sm-notify.c.orig nfs-utils-2.3.3/utils/statd/sm-notify.c
--- nfs-utils-2.3.3/utils/statd/sm-notify.c.orig 2019-03-05 10:30:28.070560401 -0500
+++ nfs-utils-2.3.3/utils/statd/sm-notify.c 2019-03-05 10:35:28.703004207 -0500
@@ -49,6 +49,7 @@
#define NLM_END_GRACE_FILE "/proc/fs/lockd/nlm_end_grace"
int lift_grace = 1;
+int force = 0;
struct nsm_host {
struct nsm_host * next;
@@ -480,19 +481,10 @@ nsm_lift_grace_period(void)
close(fd);
return;
}
-
-int
-main(int argc, char **argv)
+inline static void
+read_nfsconf(char **argv)
{
- int c, sock, force = 0;
- char * progname;
- char * s;
-
- progname = strrchr(argv[0], '/');
- if (progname != NULL)
- progname++;
- else
- progname = argv[0];
+ char *s;
conf_init_file(NFS_CONFFILE);
xlog_from_conffile("sm-notify");
@@ -500,10 +492,27 @@ main(int argc, char **argv)
opt_srcport = conf_get_str("sm-notify", "outgoing-port");
opt_srcaddr = conf_get_str("sm-notify", "outgoing-addr");
lift_grace = conf_get_bool("sm-notify", "lift-grace", lift_grace);
+
s = conf_get_str("statd", "state-directory-path");
if (s && !nsm_setup_pathnames(argv[0], s))
exit(1);
opt_update_state = conf_get_bool("sm-notify", "update-state", opt_update_state);
+ force = conf_get_bool("sm-notify", "force", force);
+}
+
+int
+main(int argc, char **argv)
+{
+ int c, sock;
+ char * progname;
+
+ progname = strrchr(argv[0], '/');
+ if (progname != NULL)
+ progname++;
+ else
+ progname = argv[0];
+
+ read_nfsconf(argv);
while ((c = getopt(argc, argv, "dm:np:v:P:f")) != -1) {
switch (c) {

View File

@ -104,12 +104,13 @@ CONV_STATD = {'-o': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
}
# options for sm-notify found in SMNOTIFYARGS
OPTS_SMNOTIFY = 'dm:np:v:P:'
OPTS_SMNOTIFY = 'dm:np:v:P:f'
CONV_SMNOTIFY = {'-d': (CONF_NFS, 'sm-notify', 'debug', 'all'),
'-m': (CONF_NFS, 'sm-notify', 'retry-time', '$1'),
'-n': (CONF_NFS, 'sm-notify', 'update-state', '1'),
'-p': (CONF_NFS, 'sm-notify', 'outgoing-port', '$1'),
'-v': (CONF_NFS, 'sm-notify', 'outgoing-addr', '$1'),
'-f': (CONF_NFS, 'sm-notify', 'force', '1'),
'-P': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
}
@ -152,6 +153,10 @@ GETOPT_MAPS = [('RPCNFSDARGS', OPTS_NFSD, LONG_NFSD, CONV_NFSD),
('BLKMAPDARGS', OPTS_BLKMAPD, [], CONV_BLKMAPD),
]
# any fixups we need to apply first
GETOPT_FIXUP = {'RPCNFSDARGS': ('--rdma', '--rdma=nfsrdma'),
}
# map for all of the single option values
VALUE_MAPS = {'LOCKD_TCPPORT': (CONF_NFS, 'lockd', 'port', '$1'),
'LOCKD_UDPPORT': (CONF_NFS, 'lockd', 'udp-port', '$1'),
@ -206,6 +211,13 @@ def convert_getopt(optname, options, optstring, longopts, conversions):
optcount = 0
try:
args = options.strip('\"').split()
if optname in GETOPT_FIXUP:
(k, v) = GETOPT_FIXUP[optname]
for i, opt in enumerate(args):
if opt == k:
args[i] = v
elif opt == '--':
break
optlist, optargs = getopt.gnu_getopt(args, optstring, longopts=longopts)
except getopt.GetoptError as err:
eprint(err)

View File

@ -36,9 +36,3 @@ fi
#
/usr/sbin/nfsconvert
#
# Make sure the modes are correct
#
if [ $? -eq 0 ]; then
chmod 644 /etc/nfs.conf
fi

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: 14%{?dist}
Release: 28%{?dist}
Epoch: 1
# group all 32bit related archs
@ -26,12 +26,29 @@ Patch004: nfs-utils-2.3.3-gssd-usegssproxy.patch
Patch005: nfs-utils-2.3.3-nfsconf-usegssproxy.patch
Patch006: nfs-utils-2.3.3-man-tcpwrappers.patch
Patch007: nfs-utils-2.3.3-junction-update.patch
Patch008: nfs-utils-2.3.3-gating-tests.patch
#
# RHEL 8.0-Z
# RHEL 8.1
#
Patch009: nfs-utils-2.3.3-statd-no-notify.patch
Patch008: nfs-utils-2.3.3-nfsconf-manage-gids.patch
Patch009: nfs-utils-2.3.3-statd-force.patch
Patch010: nfs-utils-2.3.3-statd-no-notify.patch
Patch011: nfs-utils-2.3.3-gssd-verbose.patch
Patch012: nfs-utils-2.3.3-nfsconf-inplace.patch
Patch013: nfs-utils-2.3.3-covscan-resource-leaks.patch
Patch014: nfs-utils-2.3.3-nfsman-typo.patch
Patch015: nfs-utils-2.3.3-mount-fallback.patch
Patch016: nfs-utils-2.3.3-mountd-memleak.patch
Patch017: nfs-utils-2.3.3-lseek-error-handling.patch
Patch018: nfs-utils-2.3.3-memleak-on-error.patch
#
# RHEL 8.2
#
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
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
@ -265,7 +282,7 @@ fi
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm.bak
%ghost %attr(644,rpcuser,rpcuser) %{_statdpath}/state
%ghost %attr(644,root,root) %{_statdpath}/state
%config(noreplace) %{_sharedstatedir}/nfs/etab
%config(noreplace) %{_sharedstatedir}/nfs/rmtab
%config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf
@ -308,8 +325,6 @@ fi
%config(noreplace) %{_sysconfdir}/idmapd.conf
%{_libdir}/libnfsidmap.so.*
%{_libdir}/libnfsidmap/*.so
%{_mandir}/man3/nfs4_uid_to_name.*
%{_mandir}/man5/idmapd.conf.*
%files -n libnfsidmap-devel
%{_libdir}/pkgconfig/libnfsidmap.pc
@ -318,9 +333,60 @@ fi
%{_libdir}/libnfsidmap.so
%changelog
* Wed Apr 3 2019 Steve Dickson <steved@redhat.com> 2.3.3-14_0
- Add nfs.conf equivalent for the statd --no-notify cmdline option (1690280)
- Correct the modes on /etc/nfs.conf after a conversion (bz 1690266)
* Tue Nov 26 2019 Steve Dickson <steved@redhat.com> 2.3.3-28
- gssd: daemonize earlier (bz 1762847)
* Mon Nov 11 2019 Steve Dickson <steved@redhat.com> 2.3.3-27
- More coverity scans updates (bz 1746572)
- nfsd: Adjust nfs.conf setting/parsing of rdma port (bz 1710532)
- Add plain --rdma option to nfs.conf convertor (bz 1747295)
- mountstats: Add per-op error counts to iostat command (bz 1719983)
- gssd: add configure options verbosity to man page (bz 1749642)
* Wed Sep 18 2019 Steve Dickson <steved@redhat.com> 2.3.3-26
- Updated coverity scans patch to not do a double free (bz 1752326)
* Mon Aug 19 2019 Steve Dickson <steved@redhat.com> 2.3.3-25
- Change the owner/group of the state file (bz 1733445)
* Mon Aug 12 2019 Steve Dickson <steved@redhat.com> 2.3.3-24
- nfs.man: Fixed small typo in man page (bz 1732877)
- mount: Report correct error in the fall_back cases (bz 1709963)
- rpc.mountd: Fix e_hostname and e_uuid leaks (bz 1712202)
- spec: Remove redundant manpage files (bz 1718738)
* Wed Jul 31 2019 Alice Mitchell <ajmitchell@redhat.com> 2.3.3-23
- Fix memory leak on error (bz 1440524)
- Fix error handling on lseek (bz 1733887)
* Thu Jul 18 2019 Alice Mitchell <ajmitchell@redhat.com> 2.3.3-22
- Revert the forced chmod of nfs.conf as unneccessary (bz 1687496)
* Mon Jul 15 2019 Steve Dickson <steved@redhat.com> 2.3.3-21
- Gating tests: run tests from tests namespace (bz 1653927)
* Tue Jul 9 2019 Steve Dickson <steved@redhat.com> 2.3.3-20
- Gating tests: Fix _env data and source it in every test run (bz 1653927)
* Fri May 3 2019 Steve Dickson <steved@redhat.com> 2.3.3-19
- Removed resource leaks found by coverity scans (bz 1602633)
* Thu Apr 25 2019 Steve Dickson <steved@redhat.com> 2.3.3-18
- Modify nfs.conf in-place instead of replacing the file (bz 1687496)
* Tue Mar 19 2019 Steve Dickson <steved@redhat.com> 2.3.3-17
- Moved the gating tests out of a patch and into the top dir (bz 1653927)
- Move the mode corrections on /etc/nfs.conf to nfsconvert.py (bz 1655880)
- gssd: add verbosity options to the rpc.gssd man page (bz 1668026)
* Fri Mar 8 2019 Steve Dickson <steved@redhat.com> 2.3.3-16
- Add a conversion for new sm-notify force option in nfs.conf (bz 1677576)
- Correct the modes on /etc/nfs.conf after a conversion (bz 1655880)
* Tue Mar 5 2019 Steve Dickson <steved@redhat.com> 2.3.3-15
- nfs.conf: Fixed manage-gids option typo (bz 1672395)
- sm-notify: Added -f flag to nfs.conf parsing (bz 1677576)
- Add nfs.conf equivalent for the statd --no-notify cmdline option (bz 1683714)
* Wed Feb 13 2019 Steve Dickson <steved@redhat.com> 2.3.3-14
- Fix typo in checking for the 65534 uid/gid (bz 1655960)