From: neilbrown Date: Mon, 4 Aug 2003 04:25:54 +0000 (+0000) Subject: /proc/fs/nfsd as an alternate to /proc/fs/nfsd X-Git-Tag: nfs-utils-1-0-5-post2^0 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=e09fbc8933961a0a774217ef32d73da373ddc670 /proc/fs/nfsd as an alternate to /proc/fs/nfsd --- diff --git a/ChangeLog b/ChangeLog index 9f1d85a..00e380e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-08-04 NeilBrown + * support/export/xtab.c, support/include/nfslib.h, + support/nfs/cacheio.c, support/nfs/nfssvc.c, + utils/exportfs/exportfs.c, utils/exportfs/exportfs.man, + utils/exportfs/nfsd.man, utils/mountd/cache.c: support + /proc/fs/nfsd/* as a perferred alternate to /proc/fs/nfs/* + (nfs-utils-1.0.5-post2) + 2003-08-04 NeilBrown * support/nfs/nfsexport.c: open channel file O_WRONLY when only writing. @@ -6,6 +14,7 @@ * utils/mountd/mountd.h: mountlist_{del,add} now take a host name rather than an nfs_export. * utils/mountd/rmtab.c: ditto. + (nfs-utils-1.5.0-post1) 2003-07-24 Chip Salzenberg diff --git a/support/export/xtab.c b/support/export/xtab.c index d9265a2..eb67b0d 100644 --- a/support/export/xtab.c +++ b/support/export/xtab.c @@ -65,6 +65,9 @@ xtab_mount_read(void) if ((fd=open(_PATH_PROC_EXPORTS, O_RDONLY))>=0) { close(fd); return xtab_read(_PATH_PROC_EXPORTS, 0); + } else if ((fd=open(_PATH_PROC_EXPORTS_ALT, O_RDONLY) >= 0)) { + close(fd); + return xtab_read(_PATH_PROC_EXPORTS_ALT, 0); } else return xtab_read(_PATH_XTAB, 2); } diff --git a/support/include/nfslib.h b/support/include/nfslib.h index c41f92e..e7e9f1d 100644 --- a/support/include/nfslib.h +++ b/support/include/nfslib.h @@ -43,6 +43,7 @@ #endif #ifndef _PATH_PROC_EXPORTS #define _PATH_PROC_EXPORTS "/proc/fs/nfs/exports" +#define _PATH_PROC_EXPORTS_ALT "/proc/fs/nfsd/exports" #endif enum cle_maptypes { diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c index ff5b028..20d195c 100644 --- a/support/nfs/cacheio.c +++ b/support/nfs/cacheio.c @@ -227,7 +227,8 @@ int check_new_cache(void) { struct stat stb; - return (stat("/proc/fs/nfs/filehandle", &stb) == 0); + return (stat("/proc/fs/nfs/filehandle", &stb) == 0) || + (stat("/proc/fs/nfsd/filehandle", &stb) == 0); } diff --git a/support/nfs/nfssvc.c b/support/nfs/nfssvc.c index dae16f7..67089be 100644 --- a/support/nfs/nfssvc.c +++ b/support/nfs/nfssvc.c @@ -19,7 +19,9 @@ nfssvc(int port, int nrservs) struct nfsctl_arg arg; int fd; - fd = open("/proc/fs/nfs/threads", O_WRONLY); + fd = open("/proc/fs/nfsd/threads", O_WRONLY); + if (fd < 0) + fd = open("/proc/fs/nfs/threads", O_WRONLY); if (fd >= 0) { /* 2.5+ kernel with nfsd filesystem mounted. * Just write the number in. diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index cbb0aa9..6f2a60d 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -97,7 +97,7 @@ main(int argc, char **argv) if (new_cache) cache_flush(1); else { - fprintf(stderr, "exportfs: -f: only available with new cache controls: mount /proc/fs/nfs first\n"); + fprintf(stderr, "exportfs: -f: only available with new cache controls: mount /proc/fs/nfsd first\n"); exit(1); } return 0; diff --git a/utils/exportfs/exportfs.man b/utils/exportfs/exportfs.man index 7d18509..9024caf 100644 --- a/utils/exportfs/exportfs.man +++ b/utils/exportfs/exportfs.man @@ -49,6 +49,8 @@ earlier versions of the Linux kernel, and a new mode which applies to 2.6 and later versions providing the .B nfsd virtual filesystem has been mounted at +.B /proc/fs/nfsd +or .BR /proc/fs/nfs . If this filesystem is not mounted in 2.6, the legacy mode is used. .P diff --git a/utils/exportfs/nfsd.man b/utils/exportfs/nfsd.man index b4806b4..d475eb1 100644 --- a/utils/exportfs/nfsd.man +++ b/utils/exportfs/nfsd.man @@ -8,7 +8,7 @@ .SH NAME nfsd \- special filesystem for controlling Linux NFS server .SH SYNPOSIS -.B "mount -t nfsd nfsd /proc/fs/nfs" +.B "mount -t nfsd nfsd /proc/fs/nfsd" .SH DESCRIPTION The .B nfsd @@ -35,6 +35,8 @@ and .I mountd programs (part of the nfs-utils package) expect to find this filesystem mounted at +.B /proc/fs/nfsd +or .BR /proc/fs/nfs . If it is not mounted, they will fall-back on 2.4 style functionality. This involves accessing the NFS server via a systemcall. This diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 2e35b17..96492b8 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -368,15 +368,18 @@ void cache_export(nfs_export *exp) * { * echo $domain $path $length * read filehandle <&0 - * } <> /proc/fs/nfs/filehandle + * } <> /proc/fs/nfsd/filehandle */ struct nfs_fh_len * cache_get_filehandle(nfs_export *exp, int len, char *p) { - FILE *f = fopen("/proc/fs/nfs/filehandle", "r+"); + FILE *f = fopen("/proc/fs/nfsd/filehandle", "r+"); char buf[200]; char *bp = buf; static struct nfs_fh_len fh; + + if (!f) + f = fopen("/proc/fs/nfs/filehandle", "r+"); if (!f) return NULL;