Bump the patch

Package-Manager: portage-2.2.0_alpha188
RepoMan-Options: --force
This commit is contained in:
Mario Fetka
2013-08-16 08:31:59 +02:00
parent 7e4e7cc350
commit c6e1284c7e
12 changed files with 289 additions and 373 deletions

View File

@@ -0,0 +1,81 @@
From 23d3980b6cfea4e9056d9b7b81e48b4fefc645e0 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 7 May 2013 11:46:18 -0400
Subject: [PATCH] mountd: Fix is_subdirectory again
The problem was that is_subdirectory() would also succeed if the two
directories were the same. This is needed for path_matches() which
needs to see if the child is same-or-descendant.
So this patch rearranges path_matches() to do the "are they the same"
test itself and only bother with is_subdirectory() if it they are not
the same.
So now is_subdirectory() can be strict, and so can be usable for
subexport(), which needs a strong 'in subdirectory - not the same' test.
Acked-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mountd/cache.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 737927c..517aa62 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -347,20 +347,26 @@ static char *next_mnt(void **v, char *p)
static int is_subdirectory(char *child, char *parent)
{
+ /* Check is child is strictly a subdirectory of
+ * parent or a more distant descendant.
+ */
size_t l = strlen(parent);
- if (strcmp(parent, "/") == 0)
+ if (strcmp(parent, "/") == 0 && child[1] != 0)
return 1;
- return strcmp(child, parent) == 0
- || (strncmp(child, parent, l) == 0 && child[l] == '/');
+ return (strncmp(child, parent, l) == 0 && child[l] == '/');
}
static int path_matches(nfs_export *exp, char *path)
{
- if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
- return is_subdirectory(path, exp->m_export.e_path);
- return strcmp(path, exp->m_export.e_path) == 0;
+ /* Does the path match the export? I.e. is it an
+ * exact match, or does the export have CROSSMOUNT, and path
+ * is a descendant?
+ */
+ return strcmp(path, exp->m_export.e_path) == 0
+ || ((exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
+ && is_subdirectory(path, exp->m_export.e_path));
}
static int
@@ -369,15 +375,13 @@ export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai)
return path_matches(exp, path) && client_matches(exp, dom, ai);
}
-/* True iff e1 is a child of e2 and e2 has crossmnt set: */
+/* True iff e1 is a child of e2 (or descendant) and e2 has crossmnt set: */
static bool subexport(struct exportent *e1, struct exportent *e2)
{
char *p1 = e1->e_path, *p2 = e2->e_path;
- size_t l2 = strlen(p2);
return e2->e_flags & NFSEXP_CROSSMOUNT
- && strncmp(p1, p2, l2) == 0
- && p1[l2] == '/';
+ && is_subdirectory(p1, p2);
}
struct parsed_fsid {
--
1.8.3.2

View File

@@ -0,0 +1,126 @@
From 342446a4a624d4ee8254af859bb7f1de6d268679 Mon Sep 17 00:00:00 2001
From: Weston Andros Adamson <dros@netapp.com>
Date: Tue, 7 May 2013 11:25:29 -0400
Subject: [PATCH] statd: exit if a statd is already running
Moves nfs_probe_statd from mount to nfs support lib to share with statd.
Acked-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
support/include/nfsrpc.h | 5 +++++
support/nfs/getport.c | 22 ++++++++++++++++++++++
utils/mount/network.c | 17 -----------------
utils/statd/statd.c | 7 +++++++
4 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/support/include/nfsrpc.h b/support/include/nfsrpc.h
index a0b80e1..1bfae7a 100644
--- a/support/include/nfsrpc.h
+++ b/support/include/nfsrpc.h
@@ -156,6 +156,11 @@ extern unsigned long nfs_pmap_getport(const struct sockaddr_in *,
const struct timeval *);
/*
+ * Use nfs_pmap_getport to see if statd is running locally
+ */
+extern int nfs_probe_statd(void);
+
+/*
* Contact a remote RPC service to discover whether it is responding
* to requests.
*/
diff --git a/support/nfs/getport.c b/support/nfs/getport.c
index 3331ad4..081594c 100644
--- a/support/nfs/getport.c
+++ b/support/nfs/getport.c
@@ -1102,3 +1102,25 @@ unsigned long nfs_pmap_getport(const struct sockaddr_in *sin,
return port;
}
+
+static const char *nfs_ns_pgmtbl[] = {
+ "status",
+ NULL,
+};
+
+/*
+ * nfs_probe_statd - use nfs_pmap_getport to see if statd is running locally
+ *
+ * Returns non-zero if statd is running locally.
+ */
+int nfs_probe_statd(void)
+{
+ struct sockaddr_in addr = {
+ .sin_family = AF_INET,
+ .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
+ };
+ rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl);
+
+ return nfs_getport_ping((struct sockaddr *)(char *)&addr, sizeof(addr),
+ program, (rpcvers_t)1, IPPROTO_UDP);
+}
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 4be48cd..e2cdcaf 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -65,11 +65,6 @@ extern int nfs_mount_data_version;
extern char *progname;
extern int verbose;
-static const char *nfs_ns_pgmtbl[] = {
- "status",
- NULL,
-};
-
static const char *nfs_mnt_pgmtbl[] = {
"mount",
"mountd",
@@ -761,18 +756,6 @@ int probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server)
&nfs_server->pmap);
}
-static int nfs_probe_statd(void)
-{
- struct sockaddr_in addr = {
- .sin_family = AF_INET,
- .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
- };
- rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl);
-
- return nfs_getport_ping(SAFE_SOCKADDR(&addr), sizeof(addr),
- program, (rpcvers_t)1, IPPROTO_UDP);
-}
-
/**
* start_statd - attempt to start rpc.statd
*
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 652546c..8c51bcc 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -28,6 +28,7 @@
#include "statd.h"
#include "nfslib.h"
+#include "nfsrpc.h"
#include "nsm.h"
/* Socket operations */
@@ -237,6 +238,12 @@ int main (int argc, char **argv)
/* Set hostname */
MY_NAME = NULL;
+ /* Refuse to start if another statd is running */
+ if (nfs_probe_statd()) {
+ fprintf(stderr, "Statd service already running!\n");
+ exit(1);
+ }
+
/* Process command line switches */
while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:L", longopts, NULL)) != EOF) {
switch (arg) {
--
1.8.3.2

View File

@@ -1,50 +0,0 @@
https://bugs.gentoo.org/459200
From 2d9fb08c588970b842ce2a609088079181e6aafb Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 24 Mar 2013 17:41:19 -0400
Subject: [PATCH [nfs-utils]] check for libio.h availability
On some systems (like uClibc), there isn't a libio.h header. But it
isn't also needed on them. So check for the header first.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
configure.ac | 2 +-
support/include/sockaddr.h | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index f461219..cc7f3b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -358,7 +358,7 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h \
stdlib.h string.h sys/file.h sys/ioctl.h sys/mount.h \
sys/param.h sys/socket.h sys/time.h sys/vfs.h \
syslog.h unistd.h com_err.h et/com_err.h \
- ifaddrs.h nfs-plugin.h])
+ ifaddrs.h nfs-plugin.h libio.h])
dnl *************************************************************
dnl Checks for typedefs, structures, and compiler characteristics
diff --git a/support/include/sockaddr.h b/support/include/sockaddr.h
index 72766db..a1c30f9 100644
--- a/support/include/sockaddr.h
+++ b/support/include/sockaddr.h
@@ -20,7 +20,13 @@
#ifndef NFS_UTILS_SOCKADDR_H
#define NFS_UTILS_SOCKADDR_H
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_LIBIO_H
#include <libio.h>
+#endif
#include <stdbool.h>
#include <sys/socket.h>
#include <netinet/in.h>
--
1.8.1.2

View File

@@ -1,287 +0,0 @@
From b0e3dc0c1332884a82f509f98434abd78358c7ed Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 24 Mar 2013 15:59:12 -0400
Subject: [PATCH] nfsiostat: make it work w/python3
Simple fixes here to work with python 2 & 3:
- use print() everywhere
- dict.iteritems() -> dict.items()
- file() -> open()
- sys.maxint -> sys.maxsize
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
tools/nfs-iostat/nfs-iostat.py | 130 +++++++++++++++++++++--------------------
1 file changed, 66 insertions(+), 64 deletions(-)
diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index d909632..dfbef87 100644
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -3,6 +3,8 @@
"""Emulate iostat for NFS mount points using /proc/self/mountstats
"""
+from __future__ import print_function
+
__copyright__ = """
Copyright (C) 2005, Chuck Lever <cel@netapp.com>
@@ -201,9 +203,9 @@ class DeviceData:
result = DeviceData()
# copy self into result
- for key, value in self.__nfs_data.iteritems():
+ for key, value in self.__nfs_data.items():
result.__nfs_data[key] = value
- for key, value in self.__rpc_data.iteritems():
+ for key, value in self.__rpc_data.items():
result.__rpc_data[key] = value
# compute the difference of each item in the list
@@ -233,9 +235,9 @@ class DeviceData:
client_bytes_read = float(nfs_stats['serverreadbytes'] - nfs_stats['directreadbytes'])
ratio = ((app_bytes_read - client_bytes_read) * 100) / app_bytes_read
- print
- print 'app bytes: %f client bytes %f' % (app_bytes_read, client_bytes_read)
- print 'Data cache hit ratio: %4.2f%%' % ratio
+ print()
+ print('app bytes: %f client bytes %f' % (app_bytes_read, client_bytes_read))
+ print('Data cache hit ratio: %4.2f%%' % ratio)
def __print_attr_cache_stats(self, sample_time):
"""Print attribute cache efficiency stats
@@ -255,13 +257,13 @@ class DeviceData:
data_invalidates = float(nfs_stats['datainvalidates'])
attr_invalidates = float(nfs_stats['attrinvalidates'])
- print
- print '%d inode revalidations, hitting in cache %4.2f%% of the time' % \
- (revalidates, ratio)
- print '%d open operations (mandatory GETATTR requests)' % opens
+ print()
+ print('%d inode revalidations, hitting in cache %4.2f%% of the time' % \
+ (revalidates, ratio))
+ print('%d open operations (mandatory GETATTR requests)' % opens)
if getattr_ops != 0:
- print '%4.2f%% of GETATTRs resulted in data cache invalidations' % \
- ((data_invalidates * 100) / getattr_ops)
+ print('%4.2f%% of GETATTRs resulted in data cache invalidations' % \
+ ((data_invalidates * 100) / getattr_ops))
def __print_dir_cache_stats(self, sample_time):
"""Print directory stats
@@ -277,13 +279,13 @@ class DeviceData:
lookups = nfs_stats['vfslookup']
getdents = nfs_stats['vfsreaddir']
- print
- print '%d open operations (pathname lookups)' % opens
- print '%d dentry revalidates and %d vfs lookup requests' % \
- (dentry_revals, lookups),
- print 'resulted in %d LOOKUPs on the wire' % lookup_ops
- print '%d vfs getdents calls resulted in %d READDIRs on the wire' % \
- (getdents, readdir_ops)
+ print()
+ print('%d open operations (pathname lookups)' % opens)
+ print('%d dentry revalidates and %d vfs lookup requests' % \
+ (dentry_revals, lookups))
+ print('resulted in %d LOOKUPs on the wire' % lookup_ops)
+ print('%d vfs getdents calls resulted in %d READDIRs on the wire' % \
+ (getdents, readdir_ops))
def __print_page_stats(self, sample_time):
"""Print page cache stats
@@ -297,33 +299,33 @@ class DeviceData:
vfswritepages = nfs_stats['vfswritepages']
pages_written = nfs_stats['writepages']
- print
- print '%d nfs_readpage() calls read %d pages' % \
- (vfsreadpage, vfsreadpage)
- print '%d nfs_readpages() calls read %d pages' % \
- (vfsreadpages, pages_read - vfsreadpage),
+ print()
+ print('%d nfs_readpage() calls read %d pages' % \
+ (vfsreadpage, vfsreadpage))
+ print('%d nfs_readpages() calls read %d pages' % \
+ (vfsreadpages, pages_read - vfsreadpage))
if vfsreadpages != 0:
- print '(%.1f pages per call)' % \
- (float(pages_read - vfsreadpage) / vfsreadpages)
+ print('(%.1f pages per call)' % \
+ (float(pages_read - vfsreadpage) / vfsreadpages))
else:
- print
-
- print
- print '%d nfs_updatepage() calls' % nfs_stats['vfsupdatepage']
- print '%d nfs_writepage() calls wrote %d pages' % \
- (vfswritepage, vfswritepage)
- print '%d nfs_writepages() calls wrote %d pages' % \
- (vfswritepages, pages_written - vfswritepage),
+ print()
+
+ print()
+ print('%d nfs_updatepage() calls' % nfs_stats['vfsupdatepage'])
+ print('%d nfs_writepage() calls wrote %d pages' % \
+ (vfswritepage, vfswritepage))
+ print('%d nfs_writepages() calls wrote %d pages' % \
+ (vfswritepages, pages_written - vfswritepage))
if (vfswritepages) != 0:
- print '(%.1f pages per call)' % \
- (float(pages_written - vfswritepage) / vfswritepages)
+ print('(%.1f pages per call)' % \
+ (float(pages_written - vfswritepage) / vfswritepages))
else:
- print
+ print()
congestionwaits = nfs_stats['congestionwait']
if congestionwaits != 0:
- print
- print '%d congestion waits' % congestionwaits
+ print()
+ print('%d congestion waits' % congestionwaits)
def __print_rpc_op_stats(self, op, sample_time):
"""Print generic stats for one RPC op
@@ -351,15 +353,15 @@ class DeviceData:
exe_per_op = 0.0
op += ':'
- print '%s' % op.lower().ljust(15),
- print ' ops/s\t\t kB/s\t\t kB/op\t\tretrans\t\tavg RTT (ms)\tavg exe (ms)'
+ print('%s' % op.lower().ljust(15))
+ print(' ops/s\t\t kB/s\t\t kB/op\t\tretrans\t\tavg RTT (ms)\tavg exe (ms)')
- print '\t\t%7.3f' % (ops / sample_time),
- print '\t%7.3f' % (kilobytes / sample_time),
- print '\t%7.3f' % kb_per_op,
- print ' %7d (%3.1f%%)' % (retrans, retrans_percent),
- print '\t%7.3f' % rtt_per_op,
- print '\t%7.3f' % exe_per_op
+ print('\t\t%7.3f' % (ops / sample_time))
+ print('\t%7.3f' % (kilobytes / sample_time))
+ print('\t%7.3f' % kb_per_op)
+ print(' %7d (%3.1f%%)' % (retrans, retrans_percent))
+ print('\t%7.3f' % rtt_per_op)
+ print('\t%7.3f' % exe_per_op)
def ops(self, sample_time):
sends = float(self.__rpc_data['rpcsends'])
@@ -384,14 +386,14 @@ class DeviceData:
else:
backlog = 0.0
- print
- print '%s mounted on %s:' % \
- (self.__nfs_data['export'], self.__nfs_data['mountpoint'])
- print
+ print()
+ print('%s mounted on %s:' % \
+ (self.__nfs_data['export'], self.__nfs_data['mountpoint']))
+ print()
- print ' op/s\t\trpc bklog'
- print '%7.2f' % (sends / sample_time),
- print '\t%7.2f' % backlog
+ print(' op/s\t\trpc bklog')
+ print('%7.2f' % (sends / sample_time))
+ print('\t%7.2f' % backlog)
if which == 0:
self.__print_rpc_op_stats('READ', sample_time)
@@ -424,7 +426,7 @@ def parse_stats_file(filename):
ms_dict = dict()
key = ''
- f = file(filename)
+ f = open(filename)
for line in f.readlines():
words = line.split()
if len(words) == 0:
@@ -494,7 +496,7 @@ def list_nfs_mounts(givenlist, mountstats):
if stats.is_nfs_mountpoint():
list += [device]
else:
- for device, descr in mountstats.iteritems():
+ for device, descr in mountstats.items():
stats = DeviceData()
stats.parse_stats(descr)
if stats.is_nfs_mountpoint():
@@ -527,7 +529,7 @@ client are listed.
usage="usage: %prog [ <interval> [ <count> ] ] [ <options> ] [ <mount point> ]",
description=mydescription,
version='version %s' % Iostats_version)
- parser.set_defaults(which=0, sort=False, list=sys.maxint)
+ parser.set_defaults(which=0, sort=False, list=sys.maxsize)
statgroup = OptionGroup(parser, "Statistics Options",
'File I/O is displayed unless one of the following is specified:')
@@ -572,29 +574,29 @@ client are listed.
try:
interval = int(arg)
except:
- print 'Illegal <interval> value %s' % arg
+ print('Illegal <interval> value %s' % arg)
return
if interval > 0:
interval_seen = True
else:
- print 'Illegal <interval> value %s' % arg
+ print('Illegal <interval> value %s' % arg)
return
elif not count_seen:
try:
count = int(arg)
except:
- print 'Ilegal <count> value %s' % arg
+ print('Ilegal <count> value %s' % arg)
return
if count > 0:
count_seen = True
else:
- print 'Illegal <count> value %s' % arg
+ print('Illegal <count> value %s' % arg)
return
# make certain devices contains only NFS mount points
devices = list_nfs_mounts(origdevices, mountstats)
if len(devices) == 0:
- print 'No NFS mount points were found'
+ print('No NFS mount points were found')
return
@@ -616,7 +618,7 @@ client are listed.
# we need to recheck the devices list when reparsing
devices = list_nfs_mounts(origdevices,mountstats)
if len(devices) == 0:
- print 'No NFS mount points were found'
+ print('No NFS mount points were found')
return
count -= 1
else:
@@ -630,7 +632,7 @@ client are listed.
# we need to recheck the devices list when reparsing
devices = list_nfs_mounts(origdevices,mountstats)
if len(devices) == 0:
- print 'No NFS mount points were found'
+ print('No NFS mount points were found')
return
#
@@ -641,7 +643,7 @@ prog = os.path.basename(sys.argv[0])
try:
iostat_command(prog)
except KeyboardInterrupt:
- print 'Caught ^C... exiting'
+ print('Caught ^C... exiting')
sys.exit(1)
sys.exit(0)
--
1.8.1.2

View File

@@ -20,27 +20,6 @@ for us atm, so hack away :(
-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD)
MAINTAINERCLEANFILES = Makefile.in
--- a/tools/rpcdebug/Makefile.am
+++ b/tools/rpcdebug/Makefile.am
@@ -1,15 +1,14 @@
## Process this file with automake to produce Makefile.in
CC=$(CC_FOR_BUILD)
-LIBTOOL = @LIBTOOL@ --tag=CC
+CFLAGS=$(CFLAGS_FOR_BUILD)
+CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+LDFLAGS=$(LDFLAGS_FOR_BUILD)
man8_MANS = rpcdebug.man
EXTRA_DIST = $(man8_MANS)
sbin_PROGRAMS = rpcdebug
rpcdebug_SOURCES = rpcdebug.c
-rpcdebug_CFLAGS=$(CFLAGS_FOR_BUILD)
-rpcdebug_CPPFLAGS=$(CPPFLAGS_FOR_BUILD) -I$(top_srcdir)/support/include
-rpcdebug_LDFLAGS=$(LDFLAGS_FOR_BUILD)
MAINTAINERCLEANFILES = Makefile.in
--- a/tools/rpcgen/Makefile.am
+++ b/tools/rpcgen/Makefile.am

View File

@@ -0,0 +1,16 @@
[Unit]
Description=NFS server
After=rpcbind.service
Requires=rpcbind.service
[Service]
Type=oneshot
EnvironmentFile=/etc/conf.d/nfs
ExecStart=/usr/sbin/rpc.nfsd $OPTS_RPC_NFSD
ExecStartPost=/usr/sbin/exportfs -a
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -a -u
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=NFS Mount Daemon
After=rpcbind.service nfsd.service
Requires=rpcbind.service nfsd.service
[Service]
Type=forking
EnvironmentFile=/etc/conf.d/nfs
ExecStart=/usr/sbin/rpc.mountd $OPTS_RPC_MOUNTD
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,13 @@
[Unit]
Description=NFSv2/3 Network Status Monitor Daemon
After=rpcbind.service
Requires=rpcbind.service
Before=remote-fs-pre.target
[Service]
Type=forking
EnvironmentFile=/etc/conf.d/nfs
ExecStart=/sbin/rpc.statd $OPTS_RPC_STATD
[Install]
WantedBy=multi-user.target