* [PATCH] mount.nfs command: old glibc missing some flags
@ 2008-07-29 16:16 Chuck Lever
2008-07-30 6:50 ` Gabor Z. Papp
0 siblings, 1 reply; 10+ messages in thread
From: Chuck Lever @ 2008-07-29 16:16 UTC (permalink / raw)
To: gzp-2g/1Y3AqmNE; +Cc: linux-nfs
Old versions of glibc (< 2.4) have a getaddrinfo(3) implementation, but
do not include public definitions of the AI_V4MAPPED, AI_ALL, and
AI_ADDRCONFIG flags because it was believed that these flags were not
standardized. However, these flags have standard definitions both in
POSIX 1003 and in RFCs, and were thus included in later releases of
glibc.
To allow the mount.nfs command to build on systems with these older
versions of glibc, add conditional definitions for these flags in
utils/mount/network.c.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
Untested. Gabor, can you please try this?
utils/mount/network.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 75354a7..0023769 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -48,6 +48,24 @@
#include "mount_constants.h"
#include "network.h"
+/*
+ * Earlier versions of glibc's /usr/include/netdb.h exclude these
+ * definitions because it was thought they were not part of a stable
+ * POSIX standard. However, they are defined by RFC 2553 and 3493
+ * and in POSIX 1003.1-2001, so these definitions were added in later
+ * versions of netdb.h.
+ */
+#ifndef AI_V4MAPPED
+#define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
+#endif /* AI_V4MAPPED */
+#ifndef AI_ALL
+#define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
+#endif /* AI_ALL */
+#ifndef AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose \
+ returned address type. */
+#endif /* AI_ADDRCONFIG */
+
#define PMAP_TIMEOUT (10)
#define CONNECT_TIMEOUT (20)
#define MOUNT_TIMEOUT (30)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-29 16:16 [PATCH] mount.nfs command: old glibc missing some flags Chuck Lever
@ 2008-07-30 6:50 ` Gabor Z. Papp
2008-07-30 18:02 ` Chuck Lever
2008-07-30 19:00 ` Steve Dickson
0 siblings, 2 replies; 10+ messages in thread
From: Gabor Z. Papp @ 2008-07-30 6:50 UTC (permalink / raw)
To: Chuck Lever; +Cc: linux-nfs
[-- Attachment #1: Type: text/plain, Size: 964 bytes --]
* Chuck Lever <chuck.lever@oracle.com>:
| Untested. Gabor, can you please try this?
Compiled fine.
utils/mountd/Makefile:
LIBBLKID = -lblkid
-lblkid doesn't enough in dependency, needs -luuid
Is this problem in my e2fsprogs install?
BTW, I'm not sure about usage of sm-notify
My nfs startup script looks like:
idmapd
exportfs -ar
mountd
statd #--no-notify
nfsd 8
$ ps fax
10860 ? Ss 0:00 mountd
10862 ? Ss 0:00 statd
10875 ? S 0:00 [nfsd]
10876 ? S 0:00 [nfsd]
10886 ? S 0:00 [lockd]
10887 ? S 0:00 \_ [rpciod]
10888 ? S 0:00 [nfsd]
10889 ? S 0:00 [nfsd]
10890 ? S 0:00 [nfsd]
10891 ? S 0:00 [nfsd]
10892 ? S 0:00 [nfsd]
10893 ? S 0:00 [nfsd]
Looks like no sm-notify started, even I mount something from a remote
host. If I start sm-notify by hand, it exist, strace output attached.
Same apply on glibc 2.3.
[-- Attachment #2: strace --]
[-- Type: application/octet-stream, Size: 3075 bytes --]
execve("/pkg/bin/sm-notify", ["/pkg/bin/sm-notify"], [/* 19 vars */]) = 0
uname({sys="Linux", node="gzpLinux", ...}) = 0
brk(0) = 0x804bac4
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=17615, ...}) = 0
mmap2(NULL, 17615, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40014000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\206\1\0004\0\0\0"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=9861792, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40019000
mmap2(NULL, 1158784, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001a000
mprotect(0x4012c000, 36480, PROT_NONE) = 0
mmap2(0x4012c000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x111) = 0x4012c000
mmap2(0x40131000, 16000, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40131000
close(3) = 0
munmap(0x40014000, 17615) = 0
getpid() = 10899
open("/var/run/sm-notify.pid", O_WRONLY|O_CREAT|O_EXCL, 0600) = 3
write(3, "10899\n", 6) = 6
close(3) = 0
uname({sys="Linux", node="gzpLinux", ...}) = 0
open("/var/lib/nfs/sm", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
brk(0) = 0x804bac4
brk(0x804cb0c) = 0x804cb0c
brk(0x804d000) = 0x804d000
getdents64(3, /* 2 entries */, 4096) = 48
getdents64(3, /* 0 entries */, 4096) = 0
close(3) = 0
open("/var/lib/nfs/sm.bak", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
getdents64(3, /* 2 entries */, 4096) = 48
getdents64(3, /* 0 entries */, 4096) = 0
close(3) = 0
open("/var/lib/nfs/state", O_RDONLY) = 3
read(3, "", 4) = 0
write(2, "/var/lib/nfs/state: bad file siz"..., 52/var/lib/nfs/state: bad file size, setting state = 1) = 52
write(2, "\n", 1
) = 1
close(3) = 0
open("/var/lib/nfs/state.new", O_WRONLY|O_CREAT, 0644) = 3
write(3, "\3\0\0\0", 4) = 4
close(3) = 0
rename("/var/lib/nfs/state.new", "/var/lib/nfs/state") = 0
sync() = 0
open("/proc/sys/fs/nfs/nsm_local_state", O_WRONLY) = -1 ENOENT (No such file or directory)
fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000
fork() = 10900
--- SIGCHLD (Child exited) @ 0 (0) ---
_exit(0) = ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-30 6:50 ` Gabor Z. Papp
@ 2008-07-30 18:02 ` Chuck Lever
2008-07-30 19:00 ` Steve Dickson
1 sibling, 0 replies; 10+ messages in thread
From: Chuck Lever @ 2008-07-30 18:02 UTC (permalink / raw)
To: Gabor Z. Papp, Neil Brown; +Cc: linux-nfs
On Wed, Jul 30, 2008 at 2:50 AM, Gabor Z. Papp <gzp-2g/1Y3AqmNE@public.gmane.org> wrote:
> | Untested. Gabor, can you please try this?
>
> Compiled fine.
Excellent, thanks for testing.
> utils/mountd/Makefile:
>
> LIBBLKID = -lblkid
>
> -lblkid doesn't enough in dependency, needs -luuid
>
> Is this problem in my e2fsprogs install?
This one I'm not an expert on, but it seems to me you might find some
relevant information by searching the archives of the linux-nfs
mailing list over the past year.
I thought libuuid was already called out in configure.ac, but I could
be completely wrong about that.
> BTW, I'm not sure about usage of sm-notify
>
> My nfs startup script looks like:
>
> idmapd
> exportfs -ar
> mountd
> statd #--no-notify
> nfsd 8
>
> $ ps fax
> 10860 ? Ss 0:00 mountd
> 10862 ? Ss 0:00 statd
> 10875 ? S 0:00 [nfsd]
> 10876 ? S 0:00 [nfsd]
> 10886 ? S 0:00 [lockd]
> 10887 ? S 0:00 \_ [rpciod]
> 10888 ? S 0:00 [nfsd]
> 10889 ? S 0:00 [nfsd]
> 10890 ? S 0:00 [nfsd]
> 10891 ? S 0:00 [nfsd]
> 10892 ? S 0:00 [nfsd]
> 10893 ? S 0:00 [nfsd]
>
> Looks like no sm-notify started, even I mount something from a remote
> host. If I start sm-notify by hand, it exist, strace output attached.
> Same apply on glibc 2.3.
That might take some debugging. There were some last minute changes
to sm-notify before 1.1.3 was released.
--
Chuck Lever
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-30 6:50 ` Gabor Z. Papp
2008-07-30 18:02 ` Chuck Lever
@ 2008-07-30 19:00 ` Steve Dickson
2008-07-30 19:20 ` Gabor Z. Papp
1 sibling, 1 reply; 10+ messages in thread
From: Steve Dickson @ 2008-07-30 19:00 UTC (permalink / raw)
To: Gabor Z. Papp; +Cc: Chuck Lever, linux-nfs
Gabor Z. Papp wrote:
> * Chuck Lever <chuck.lever@oracle.com>:
>
> | Untested. Gabor, can you please try this?
>
> Compiled fine.
>
> utils/mountd/Makefile:
>
> LIBBLKID = -lblkid
>
> -lblkid doesn't enough in dependency, needs -luuid
>
> Is this problem in my e2fsprogs install?
At least in my world you also need the e2fsprogs-devel package
installed as well...
>
> BTW, I'm not sure about usage of sm-notify
>
> My nfs startup script looks like:
>
> idmapd
> exportfs -ar
> mountd
> statd #--no-notify
> nfsd 8
>
> $ ps fax
> 10860 ? Ss 0:00 mountd
> 10862 ? Ss 0:00 statd
> 10875 ? S 0:00 [nfsd]
> 10876 ? S 0:00 [nfsd]
> 10886 ? S 0:00 [lockd]
> 10887 ? S 0:00 \_ [rpciod]
> 10888 ? S 0:00 [nfsd]
> 10889 ? S 0:00 [nfsd]
> 10890 ? S 0:00 [nfsd]
> 10891 ? S 0:00 [nfsd]
> 10892 ? S 0:00 [nfsd]
> 10893 ? S 0:00 [nfsd]
>
> Looks like no sm-notify started, even I mount something from a remote
> host. If I start sm-notify by hand, it exist, strace output attached.
> Same apply on glibc 2.3.
Note that sm-notify is a very short lived process....
If have found using the -d flag is very handy when starting sm-notify
by hand... If there is no output, it means the /var/run/sm-notify.pid exists
which causes sm-notify to immediately exit. So remove that file and try
again...
In general, if there are file(s) in /var/lib/nfs/sm (or /var/lib/nfs/statd/sm
depending on your distro) means sm-notify did not work. With Fedora, doing
a 'service nfslock restart' will cause sm-notify to be rerun... I'm not
sure how to do that with other distros...
steved.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-30 19:00 ` Steve Dickson
@ 2008-07-30 19:20 ` Gabor Z. Papp
2008-07-30 19:48 ` Steve Dickson
0 siblings, 1 reply; 10+ messages in thread
From: Gabor Z. Papp @ 2008-07-30 19:20 UTC (permalink / raw)
To: Steve Dickson; +Cc: Chuck Lever, linux-nfs
* Steve Dickson <SteveD@redhat.com>:
| > -lblkid doesn't enough in dependency, needs -luuid
| >
| > Is this problem in my e2fsprogs install?
| At least in my world you also need the e2fsprogs-devel package
| installed as well...
libs and headers presents
| > Same apply on glibc 2.3.
| Note that sm-notify is a very short lived process....
| If have found using the -d flag is very handy when starting sm-notify
| by hand... If there is no output, it means the /var/run/sm-notify.pid exists
| which causes sm-notify to immediately exit. So remove that file and try
| again...
Sure done that first. Attached strace output happens on fresh start.
| In general, if there are file(s) in /var/lib/nfs/sm (or /var/lib/nfs/statd/sm
| depending on your distro) means sm-notify did not work. With Fedora, doing
| a 'service nfslock restart' will cause sm-notify to be rerun... I'm not
| sure how to do that with other distros...
Those dirs are empty.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-30 19:20 ` Gabor Z. Papp
@ 2008-07-30 19:48 ` Steve Dickson
2008-07-30 20:37 ` Gabor Z. Papp
0 siblings, 1 reply; 10+ messages in thread
From: Steve Dickson @ 2008-07-30 19:48 UTC (permalink / raw)
To: Gabor Z. Papp; +Cc: Chuck Lever, linux-nfs
Gabor Z. Papp wrote:
> * Steve Dickson <SteveD@redhat.com>:
>
> | > -lblkid doesn't enough in dependency, needs -luuid
> | >
> | > Is this problem in my e2fsprogs install?
> | At least in my world you also need the e2fsprogs-devel package
> | installed as well...
>
> libs and headers presents
hmm... that's curious... I wonder if there is some type of dependences
in later lib versions that will automagically load the need libs...
>
> | > Same apply on glibc 2.3.
> | Note that sm-notify is a very short lived process....
>
> | If have found using the -d flag is very handy when starting sm-notify
> | by hand... If there is no output, it means the /var/run/sm-notify.pid exists
> | which causes sm-notify to immediately exit. So remove that file and try
> | again...
>
> Sure done that first. Attached strace output happens on fresh start.
Ah... I did notice that...
>
> | In general, if there are file(s) in /var/lib/nfs/sm (or /var/lib/nfs/statd/sm
> | depending on your distro) means sm-notify did not work. With Fedora, doing
> | a 'service nfslock restart' will cause sm-notify to be rerun... I'm not
> | sure how to do that with other distros...
>
> Those dirs are empty.
So either there were no locks to recover or sm-notify did indeed work...
steved.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-30 19:48 ` Steve Dickson
@ 2008-07-30 20:37 ` Gabor Z. Papp
2008-07-30 23:18 ` Neil Brown
0 siblings, 1 reply; 10+ messages in thread
From: Gabor Z. Papp @ 2008-07-30 20:37 UTC (permalink / raw)
To: Steve Dickson; +Cc: Chuck Lever, linux-nfs
* Steve Dickson <SteveD@redhat.com>:
| > | In general, if there are file(s) in /var/lib/nfs/sm (or /var/lib/nfs/statd/sm
| > | depending on your distro) means sm-notify did not work. With Fedora, doing
| > | a 'service nfslock restart' will cause sm-notify to be rerun... I'm not
| > | sure how to do that with other distros...
| >
| > Those dirs are empty.
| So either there were no locks to recover or sm-notify did indeed work...
How sm-notify works in general? Called by statd?
If first time works, pid file left and second time didn't run as you
mentoided. So something wrong here...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
2008-07-30 20:37 ` Gabor Z. Papp
@ 2008-07-30 23:18 ` Neil Brown
0 siblings, 0 replies; 10+ messages in thread
From: Neil Brown @ 2008-07-30 23:18 UTC (permalink / raw)
To: Gabor Z. Papp; +Cc: Steve Dickson, Chuck Lever, linux-nfs
On Wednesday July 30, gzp-2g/1Y3AqmNE@public.gmane.org wrote:
> * Steve Dickson <SteveD@redhat.com>:
>
> | > | In general, if there are file(s) in /var/lib/nfs/sm (or /var/lib/nfs/statd/sm
> | > | depending on your distro) means sm-notify did not work. With Fedora, doing
> | > | a 'service nfslock restart' will cause sm-notify to be rerun... I'm not
> | > | sure how to do that with other distros...
> | >
> | > Those dirs are empty.
> | So either there were no locks to recover or sm-notify did indeed work...
>
> How sm-notify works in general? Called by statd?
Yes, it will be called by statd (unless -L was given).
It can also be run separately.
> If first time works, pid file left and second time didn't run as you
> mentoided. So something wrong here...
No, nothing wrong there.
sm-notify only needs to run once per boot, to tell peers (either
servers or clients) that this system has rebooted. It deliberately
ensures that if you run it a second time it just exits.
There is even a comment in the source:
/*
* Record pid in /var/run/sm-notify.pid
* This file should remain until a reboot, even if the
* program exits.
* If file already exists, fail.
*/
This assumes that early in reboot /var/run gets cleared. If this
doesn't happen it could be awkward.
NeilBrown
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] mount.nfs command: old glibc missing some flags
@ 2008-07-30 23:58 Chuck Lever
[not found] ` <20080730235637.1447.42422.stgit-lQeC5l55kZ7wdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Chuck Lever @ 2008-07-30 23:58 UTC (permalink / raw)
To: steved; +Cc: linux-nfs
Old versions of glibc (< 2.4) have a getaddrinfo(3) implementation, but
do not include public definitions of the AI_V4MAPPED, AI_ALL, and
AI_ADDRCONFIG flags because it was believed that these flags were not
standardized. However, these flags have standard definitions both in
POSIX 1003 and in RFCs, and were thus included in later releases of
glibc.
To allow the mount.nfs command to build on systems with these older
versions of glibc, add conditional definitions for these flags in
utils/mount/network.c.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
Steve, Gabor tested this and it fixes his build problem (glibc-2.2).
If you have no objections, please apply to your nfs-utils repo.
utils/mount/network.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 75354a7..0023769 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -48,6 +48,24 @@
#include "mount_constants.h"
#include "network.h"
+/*
+ * Earlier versions of glibc's /usr/include/netdb.h exclude these
+ * definitions because it was thought they were not part of a stable
+ * POSIX standard. However, they are defined by RFC 2553 and 3493
+ * and in POSIX 1003.1-2001, so these definitions were added in later
+ * versions of netdb.h.
+ */
+#ifndef AI_V4MAPPED
+#define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
+#endif /* AI_V4MAPPED */
+#ifndef AI_ALL
+#define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
+#endif /* AI_ALL */
+#ifndef AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose \
+ returned address type. */
+#endif /* AI_ADDRCONFIG */
+
#define PMAP_TIMEOUT (10)
#define CONNECT_TIMEOUT (20)
#define MOUNT_TIMEOUT (30)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] mount.nfs command: old glibc missing some flags
[not found] ` <20080730235637.1447.42422.stgit-lQeC5l55kZ7wdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
@ 2008-07-31 9:28 ` Steve Dickson
0 siblings, 0 replies; 10+ messages in thread
From: Steve Dickson @ 2008-07-31 9:28 UTC (permalink / raw)
To: Chuck Lever; +Cc: linux-nfs
Chuck Lever wrote:
> Old versions of glibc (< 2.4) have a getaddrinfo(3) implementation, but
> do not include public definitions of the AI_V4MAPPED, AI_ALL, and
> AI_ADDRCONFIG flags because it was believed that these flags were not
> standardized. However, these flags have standard definitions both in
> POSIX 1003 and in RFCs, and were thus included in later releases of
> glibc.
>
> To allow the mount.nfs command to build on systems with these older
> versions of glibc, add conditional definitions for these flags in
> utils/mount/network.c.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
Committed....
steved.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-07-31 9:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29 16:16 [PATCH] mount.nfs command: old glibc missing some flags Chuck Lever
2008-07-30 6:50 ` Gabor Z. Papp
2008-07-30 18:02 ` Chuck Lever
2008-07-30 19:00 ` Steve Dickson
2008-07-30 19:20 ` Gabor Z. Papp
2008-07-30 19:48 ` Steve Dickson
2008-07-30 20:37 ` Gabor Z. Papp
2008-07-30 23:18 ` Neil Brown
-- strict thread matches above, loose matches on Subject: below --
2008-07-30 23:58 Chuck Lever
[not found] ` <20080730235637.1447.42422.stgit-lQeC5l55kZ7wdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-07-31 9:28 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox