OBS User unknown 2008-08-21 23:20:49 +00:00 committed by Git OBS Bridge
parent 4b95d2850c
commit 49c7412e34
8 changed files with 307 additions and 177 deletions

View File

@ -0,0 +1,41 @@
From 59f85cc9ab483bea0da743a876bf70f483dd36eb Mon Sep 17 00:00:00 2001
From: Neil Brown <neilb@suse.de>
Date: Mon, 21 Jul 2008 11:12:59 +1000
References: bnc#404170
Subject: [PATCH] Use connected socket when probing portmap with UDP.
This allows us to get errors back promptly, and sometimes avoid
timeout.
---
utils/mount/network.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- nfs-utils-1.1.3.orig/utils/mount/network.c
+++ nfs-utils-1.1.3/utils/mount/network.c
@@ -447,7 +447,7 @@ static unsigned short getport(struct soc
bind_saddr = *saddr;
bind_saddr.sin_port = htons(PMAPPORT);
- socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, FALSE);
+ socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, TRUE);
if (socket == RPC_ANYSOCK) {
if (proto == IPPROTO_TCP &&
rpc_createerr.cf_error.re_errno == ETIMEDOUT)
@@ -539,6 +539,7 @@ static int probe_port(clnt_addr_t *serve
}
if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED &&
rpc_createerr.cf_stat != RPC_TIMEDOUT &&
+ rpc_createerr.cf_stat != RPC_CANTRECV &&
rpc_createerr.cf_stat != RPC_PROGVERSMISMATCH)
goto out_bad;
@@ -547,7 +548,8 @@ static int probe_port(clnt_addr_t *serve
continue;
p_prot = protos;
}
- if (rpc_createerr.cf_stat == RPC_TIMEDOUT)
+ if (rpc_createerr.cf_stat == RPC_TIMEDOUT ||
+ rpc_createerr.cf_stat == RPC_CANTRECV)
goto out_bad;
if (vers || !*++p_vers)

View File

@ -1,100 +0,0 @@
From a22d681bb98b212f8f67986222a9577180479551 Mon Sep 17 00:00:00 2001
From: Neil Brown <neilb@suse.de>
Date: Tue, 6 May 2008 14:35:47 +1000
Subject: [PATCH] Make sure statd gets started when 'string options' are in use.
The code for checking and starting statd was only in the binary-options
branch of the code.
This moves it into common code.
... and don't check for statd if '-o remount'
---
utils/mount/mount.c | 22 ++++++++++++++++++++--
utils/mount/nfsmount.c | 11 -----------
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index 5076468..0036caa 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -334,7 +334,8 @@ static void parse_opt(const char *opt, int *mask, char *extra_opts, int len)
* standard options (indicated by MS_ bits), and output parameter
* "@extra_opts" gets all the filesystem-specific options.
*/
-static void parse_opts(const char *options, int *flags, char **extra_opts)
+static void parse_opts(const char *options, int *flags, char **extra_opts,
+ int *lock)
{
if (options != NULL) {
char *opts = xstrdup(options);
@@ -358,6 +359,10 @@ static void parse_opts(const char *options, int *flags, char **extra_opts)
/* end of option item or last item */
if (*p == '\0' || *(p + 1) == '\0') {
parse_opt(opt, flags, *extra_opts, len);
+ if (strcmp(opt, "lock") == 0)
+ *lock = 1;
+ if (strcmp(opt, "nolock") == 0)
+ *lock = 0;
opt = NULL;
}
}
@@ -421,6 +426,7 @@ int main(int argc, char *argv[])
char *spec, *mount_point, *fs_type = "nfs";
char *extra_opts = NULL, *mount_opts = NULL;
uid_t uid = getuid();
+ int lock = 1;
progname = basename(argv[0]);
@@ -531,7 +537,7 @@ int main(int argc, char *argv[])
goto out;
}
- parse_opts(mount_opts, &flags, &extra_opts);
+ parse_opts(mount_opts, &flags, &extra_opts, &lock);
if (uid != 0) {
if (!(flags & (MS_USERS|MS_USER))) {
@@ -546,6 +552,18 @@ int main(int argc, char *argv[])
goto out;
}
+ if (!fake && lock && ! (flags & MS_REMOUNT) && strcmp(fs_type,"nfs")==0) {
+ if (!start_statd()) {
+ nfs_error(_("%s: rpc.statd is not running but is "
+ "required for remote locking.\n"
+ " Either use '-o nolock' to keep "
+ "locks local, or start statd."),
+ progname);
+ mnt_err = EX_FAIL;
+ goto out;
+ }
+ }
+
mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts,
mount_opts, fake, nomtab, FOREGROUND);
if (mnt_err == EX_BG) {
diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c
index 6c0c365..e6ed019 100644
--- a/utils/mount/nfsmount.c
+++ b/utils/mount/nfsmount.c
@@ -851,17 +851,6 @@ noauth_flavors:
*extra_opts = xstrdup(new_opts);
- if (!fake && !(data.flags & NFS_MOUNT_NONLM)) {
- if (!start_statd()) {
- nfs_error(_("%s: rpc.statd is not running but is "
- "required for remote locking.\n"
- " Either use '-o nolock' to keep "
- "locks local, or start statd."),
- progname);
- goto fail;
- }
- }
-
if (!fake) {
if (mount(spec, node, "nfs",
flags & ~(MS_USER|MS_USERS), &data)) {
--
1.5.5.1

View File

@ -0,0 +1,228 @@
From 852424a9a02dbe1a7c3b75a014bc71cad2ab6d5e Mon Sep 17 00:00:00 2001
From: Neil Brown <neilb@suse.de>
Date: Mon, 21 Jul 2008 12:45:50 +1000
References: bnc#404170
Subject: [PATCH] Check nfs options (vers/protocol) before trying mount.
As the kernels nfs-mount client does not have heuristics to pick the
best protocol/version, also check with portmap to find what is
available before requesting a mount.
However don't try to 'ping' the services. For NFS, this ping would
need to come from a reserved port, and these are a scarce resource.
If the mount found, retry the probe doing any ping that might be
needed in the hope of finding the problem.
Note: this patch also removes the (recently added) setting of
mountport= in the mount arguments. This is because:
1/ the kernel can find it easily itself
2/ it could confuse unmount which may be run much later
when mountd is running on a different port.
Signed-off-by: Neil Brown <neilb@suse.de>
---
utils/mount/network.c | 35 +++++++++++++++++++++--------------
utils/mount/network.h | 2 +-
utils/mount/nfsmount.c | 2 +-
utils/mount/stropts.c | 18 +++++++-----------
4 files changed, 30 insertions(+), 27 deletions(-)
--- nfs-utils-1.1.3.orig/utils/mount/network.c
+++ nfs-utils-1.1.3/utils/mount/network.c
@@ -500,9 +500,11 @@ static unsigned short getport(struct soc
* Use the portmapper to discover whether or not the service we want is
* available. The lists 'versions' and 'protos' define ordered sequences
* of service versions and udp/tcp protocols to probe for.
+ * If 'ping' is set, set an RPC NULL request to make sure the service
+ * is there. Else just assume that it is.
*/
static int probe_port(clnt_addr_t *server, const unsigned long *versions,
- const unsigned int *protos)
+ const unsigned int *protos, int ping)
{
struct sockaddr_in *saddr = &server->saddr;
struct pmap *pmap = &server->pmap;
@@ -530,7 +532,8 @@ static int probe_port(clnt_addr_t *serve
_("UDP") : _("TCP"),
p_port);
}
- if (clnt_ping(saddr, prog, *p_vers, *p_prot, NULL))
+ if (!ping ||
+ clnt_ping(saddr, prog, *p_vers, *p_prot, NULL))
goto out_ok;
}
}
@@ -565,7 +568,7 @@ out_ok:
return 1;
}
-static int probe_nfsport(clnt_addr_t *nfs_server)
+static int probe_nfsport(clnt_addr_t *nfs_server, int ping)
{
struct pmap *pmap = &nfs_server->pmap;
@@ -573,12 +576,14 @@ static int probe_nfsport(clnt_addr_t *nf
return 1;
if (nfs_mount_data_version >= 4)
- return probe_port(nfs_server, probe_nfs3_first, probe_tcp_first);
+ return probe_port(nfs_server, probe_nfs3_first, probe_tcp_first,
+ ping);
else
- return probe_port(nfs_server, probe_nfs2_only, probe_udp_only);
+ return probe_port(nfs_server, probe_nfs2_only, probe_udp_only,
+ ping);
}
-static int probe_mntport(clnt_addr_t *mnt_server)
+static int probe_mntport(clnt_addr_t *mnt_server, int ping)
{
struct pmap *pmap = &mnt_server->pmap;
@@ -586,9 +591,11 @@ static int probe_mntport(clnt_addr_t *mn
return 1;
if (nfs_mount_data_version >= 4)
- return probe_port(mnt_server, probe_mnt3_first, probe_udp_first);
+ return probe_port(mnt_server, probe_mnt3_first, probe_udp_first,
+ ping);
else
- return probe_port(mnt_server, probe_mnt1_first, probe_udp_only);
+ return probe_port(mnt_server, probe_mnt1_first, probe_udp_only,
+ ping);
}
/**
@@ -601,7 +608,7 @@ static int probe_mntport(clnt_addr_t *mn
*
* A side effect of calling this function is that rpccreateerr is set.
*/
-int probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server)
+int probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server, int ping)
{
struct pmap *nfs_pmap = &nfs_server->pmap;
struct pmap *mnt_pmap = &mnt_server->pmap;
@@ -623,9 +630,9 @@ int probe_bothports(clnt_addr_t *mnt_ser
for (; *probe_vers; probe_vers++) {
nfs_pmap->pm_vers = mntvers_to_nfs(*probe_vers);
- if ((res = probe_nfsport(nfs_server) != 0)) {
+ if ((res = probe_nfsport(nfs_server, ping) != 0)) {
mnt_pmap->pm_vers = *probe_vers;
- if ((res = probe_mntport(mnt_server)) != 0)
+ if ((res = probe_mntport(mnt_server, ping)) != 0)
return 1;
memcpy(mnt_pmap, &save_mnt, sizeof(*mnt_pmap));
}
@@ -643,9 +650,9 @@ out_bad:
return 0;
version_fixed:
- if (!probe_nfsport(nfs_server))
+ if (!probe_nfsport(nfs_server, ping))
goto out_bad;
- return probe_mntport(mnt_server);
+ return probe_mntport(mnt_server, ping);
}
static int probe_statd(void)
@@ -712,7 +719,7 @@ int nfs_call_umount(clnt_addr_t *mnt_ser
enum clnt_stat res = 0;
int msock;
- if (!probe_mntport(mnt_server))
+ if (!probe_mntport(mnt_server, 0))
return 0;
clnt = mnt_openclnt(mnt_server, &msock);
if (!clnt)
--- nfs-utils-1.1.3.orig/utils/mount/network.h
+++ nfs-utils-1.1.3/utils/mount/network.h
@@ -39,7 +39,7 @@ typedef struct {
static const struct timeval TIMEOUT = { 20, 0 };
static const struct timeval RETRY_TIMEOUT = { 3, 0 };
-int probe_bothports(clnt_addr_t *, clnt_addr_t *);
+int probe_bothports(clnt_addr_t *, clnt_addr_t *, int);
int nfs_gethostbyname(const char *, struct sockaddr_in *);
int nfs_name_to_address(const char *, const sa_family_t,
struct sockaddr *, socklen_t *);
--- nfs-utils-1.1.3.orig/utils/mount/nfsmount.c
+++ nfs-utils-1.1.3/utils/mount/nfsmount.c
@@ -129,7 +129,7 @@ nfs_call_mount(clnt_addr_t *mnt_server,
enum clnt_stat stat;
int msock;
- if (!probe_bothports(mnt_server, nfs_server))
+ if (!probe_bothports(mnt_server, nfs_server, 1))
goto out_bad;
clnt = mnt_openclnt(mnt_server, &msock);
--- nfs-utils-1.1.3.orig/utils/mount/stropts.c
+++ nfs-utils-1.1.3/utils/mount/stropts.c
@@ -314,7 +314,7 @@ static int nfs_is_permanent_error(int er
* Returns a new group of mount options if successful; otherwise
* NULL is returned if some failure occurred.
*/
-static struct mount_options *nfs_rewrite_mount_options(char *str)
+static struct mount_options *nfs_rewrite_mount_options(char *str, int ping)
{
struct mount_options *options;
char *option, new_option[64];
@@ -405,7 +405,7 @@ static struct mount_options *nfs_rewrite
po_remove_all(options, "tcp");
po_remove_all(options, "udp");
- if (!probe_bothports(&mnt_server, &nfs_server)) {
+ if (!probe_bothports(&mnt_server, &nfs_server, ping)) {
errno = ESPIPE;
goto err;
}
@@ -441,11 +441,6 @@ static struct mount_options *nfs_rewrite
if (po_append(options, new_option) == PO_FAILED)
goto err;
- snprintf(new_option, sizeof(new_option) - 1,
- "mountport=%lu", mnt_server.pmap.pm_port);
- if (po_append(options, new_option) == PO_FAILED)
- goto err;
-
errno = 0;
return options;
@@ -486,13 +481,13 @@ static int nfs_sys_mount(const struct nf
* 'extra_opts' are updated to reflect the mount options that worked.
* If the retry fails, 'options' and 'extra_opts' are left unchanged.
*/
-static int nfs_retry_nfs23mount(struct nfsmount_info *mi)
+static int nfs_try_nfs23mount_probe(struct nfsmount_info *mi, int ping)
{
struct mount_options *retry_options;
char *retry_str = NULL;
char **extra_opts = mi->extra_opts;
- retry_options = nfs_rewrite_mount_options(*extra_opts);
+ retry_options = nfs_rewrite_mount_options(*extra_opts, ping);
if (!retry_options)
return 0;
@@ -547,7 +542,7 @@ static int nfs_try_nfs23mount(struct nfs
if (mi->fake)
return 1;
- if (nfs_sys_mount(mi, "nfs", *extra_opts))
+ if (nfs_try_nfs23mount_probe(mi, 0))
return 1;
/*
@@ -557,7 +552,8 @@ static int nfs_try_nfs23mount(struct nfs
if (errno != EOPNOTSUPP && errno != EPROTONOSUPPORT)
return 0;
- return nfs_retry_nfs23mount(mi);
+ /* Probe harder */
+ return nfs_try_nfs23mount_probe(mi, 1);
}
/*

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af49737a7c7561968ebf6664de10aaf23871b5f31c8149bef0888cdaef92ef3e
size 573985

3
nfs-utils-1.1.3.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f82c497c449cdbecd1ce116863b8fff0e2983aa53eca89043fec4006f6e869f7
size 573942

View File

@ -1,67 +0,0 @@
From: "Andrew Gray" <7114@blargh.com>
To: nfs@lists.sourceforge.net
Subject: [NFS] Patch to mountd to mount files > 2GB
Date: Tue, 13 Jan 2004 21:19:16 -0800
Greetings all,
If this has been problem/solution has been posted before, please disregard
:)
I'm using NFS to serve out FLAR archives to Sun machines. These files are >
2GB, and the auto-installer for the Sun boxes mount the files, not the
directories. mountd was refusing to authenticate these otherwise legit
requests because the stat() call was bombing due the filesize being too
large. I hacked up the quick diff below that fixed the problem. The files
transfer correctly and completely, but I admit I haven't performed further
testing.
diff -u nfs-utils-1.0.6-orig/utils/mountd/mountd.c
nfs-utils-1.0.6/utils/mountd/mountd.c
--- nfs-utils-1.0.6-orig/utils/mountd/mountd.c Fri Sep 12 15:14:16 2003
+++ nfs-utils-1.0.6/utils/mountd/mountd.c Tue Jan 13 20:11:49 2004
@@ -176,7 +176,7 @@
{
struct sockaddr_in *sin
= (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
- struct stat stb;
+ struct stat64 stb;
nfs_export *exp;
char rpath[MAXPATHLEN+1];
char *p = *path;
@@ -198,7 +198,7 @@
/* Now authenticate the intruder... */
if (!(exp = auth_authenticate("pathconf", sin, p))) {
return 1;
- } else if (stat(p, &stb) < 0) {
+ } else if (stat64(p, &stb) < 0) {
xlog(L_WARNING, "can't stat exported dir %s: %s",
p, strerror(errno));
export_reset (exp);
@@ -248,7 +248,7 @@
{
struct sockaddr_in *sin =
(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
- struct stat stb, estb;
+ struct stat64 stb, estb;
nfs_export *exp;
char rpath[MAXPATHLEN+1];
char *p = *path;
@@ -268,7 +268,7 @@
/* Now authenticate the intruder... */
if (!(exp = auth_authenticate("mount", sin, p))) {
*error = NFSERR_ACCES;
- } else if (stat(p, &stb) < 0) {
+ } else if (stat64(p, &stb) < 0) {
xlog(L_WARNING, "can't stat exported dir %s: %s",
p, strerror(errno));
if (errno == ENOENT)
@@ -278,7 +278,7 @@
} else if (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) {
xlog(L_WARNING, "%s is not a directory or regular file", p);
*error = NFSERR_NOTDIR;
- } else if (stat(exp->m_export.e_path, &estb) < 0) {
+ } else if (stat64(exp->m_export.e_path, &estb) < 0) {
xlog(L_WARNING, "can't stat export point %s: %s",
p, strerror(errno));
*error = NFSERR_NOENT;

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Mon Aug 18 18:09:11 CEST 2008 - mrueckert@suse.de
- remove outdated options in the fillup_and_insserv call
-------------------------------------------------------------------
Fri Aug 15 03:11:30 CEST 2008 - nfbrown@suse.de
- upgrade to nfs-utils-1.1.3
- assorted bugfixes including some that we have fixed in our 1.1.2
release
- some work towards client-side IPv6 support
- Remove included patches.
- Add patches that are still not upstream
They relate to mounting from server which does not listen
to UDP for portmap
-------------------------------------------------------------------
Wed Aug 13 13:19:33 CEST 2008 - werner@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package nfs-utils (Version 1.1.2)
# spec file for package nfs-utils (Version 1.1.3)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -21,8 +21,8 @@ Name: nfs-utils
BuildRequires: e2fsprogs-devel gcc-c++ krb5-devel libevent libgssglue-devel librpcsecgss nfsidmap-devel pkgconfig tcpd-devel
Url: http://nfs.sourceforge.net
Summary: Support Utilities for Kernel nfsd
Version: 1.1.2
Release: 14
Version: 1.1.3
Release: 1
Group: Productivity/Networking/NFS
License: GPL v2 or later
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -40,9 +40,9 @@ Source7: fw-client
Source8: fw-server
Source9: mkinitrd-setup.sh
Source10: mkinitrd-boot.sh
Patch0: nfs-utils-largefiles.patch
Patch1: nfs-utils-1.0.7-bind-syntax.patch
Patch2: nfs-utils-1.1.2-start-statd.patch
Patch0: nfs-utils-1.0.7-bind-syntax.patch
Patch1: nfs-utils-1.1.2-try-before-mount.patch
Patch2: nfs-utils-1.1.2-connect-UDP.patch
%description
This package contains the NFS utilities. You can tune the number of
@ -193,7 +193,7 @@ rm -rf $RPM_BUILD_ROOT
%stop_on_removal nfsserver
%post -n nfs-kernel-server
%{fillup_and_insserv -s nfsserver NFS_SERVER}
%{fillup_and_insserv nfsserver}
%postun -n nfs-kernel-server
%restart_on_update nfsserver
@ -274,6 +274,17 @@ rm -rf $RPM_BUILD_ROOT
%doc nfs/*.html nfs/*.ps linux-nfs/* README.NFSv4
%changelog
* Mon Aug 18 2008 mrueckert@suse.de
- remove outdated options in the fillup_and_insserv call
* Fri Aug 15 2008 nfbrown@suse.de
- upgrade to nfs-utils-1.1.3
- assorted bugfixes including some that we have fixed in our 1.1.2
release
- some work towards client-side IPv6 support
- Remove included patches.
- Add patches that are still not upstream
They relate to mounting from server which does not listen
to UDP for portmap
* Wed Aug 13 2008 werner@suse.de
- Fix boot script and use correct Stop tags
- The nfs boot script uses lazy umount and terminates process