Three short subjects for nfs-utils
Subsystems (2)
cover Three short subjects for nfs-utils
Hi Steve-
Here are two minor bug fixes, and a mountd clean up that will help out with FedFS down the road. No hurry.
---
Chuck Lever (2):
statd: Remove vestigial "-w" option from man page synopsis mount.nfs: Don't leak socket in nfs_ca_sockname()
Trond Myklebust (1):
exports: add a configurable time-to-live for the kernel cache entries
support/include/exportfs.h | 1 + support/include/nfslib.h | 1 + support/nfs/exports.c | 1 + utils/mount/network.c | 28 +++++++++++++--------------- utils/mountd/cache.c | 15 ++++++++------- utils/statd/statd.man | 2 +- 6 files changed, 25 insertions(+), 23 deletions(-)
Signature · 1 line
Chuck Lever
PATCH 1/3 mount.nfs: Don't leak socket in nfs_ca_sockname()
Ensure the test socket is always closed before nfs_ca_sockname() returns. Otherwise it's orphaned.
---
utils/mount/network.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-)
utils/mount/network.c +13 -15
@@ -1095,7 +1095,7 @@ static int nfs_ca_sockname(const struct sockaddr *sap, const socklen_t salen, .sin6_family = AF_INET6, .sin6_addr = IN6ADDR_ANY_INIT, }; -int sock; +int sock, result =0 ; sock =socket (sap->sa_family,SOCK_DGRAM ,IPPROTO_UDP );if (sock <0 )
@@ -1103,28 +1103,26 @@ static int nfs_ca_sockname(const struct sockaddr *sap, const socklen_t salen,switch (sap->sa_family) {case AF_INET : -if (bind (sock,SAFE_SOCKADDR (&sin),sizeof (sin)) <0 ) { -close (sock); -return 0 ; - } +if (bind (sock,SAFE_SOCKADDR (&sin),sizeof (sin)) <0 ) + goto out;break ;case AF_INET6 : -if (bind (sock,SAFE_SOCKADDR (&sin6),sizeof (sin6)) <0 ) { -close (sock); -return 0 ; - } +if (bind (sock,SAFE_SOCKADDR (&sin6),sizeof (sin6)) <0 ) + goto out;break ;default : errno =EAFNOSUPPORT ; -return 0 ; + goto out; } -if (connect (sock, sap, salen) <0 ) { -close (sock); -return 0 ; - } +if (connect (sock, sap, salen) <0 ) + goto out; -return !getsockname (sock, buf, buflen); + result = !getsockname (sock, buf, buflen); + +out: +close (sock); +return result; }/*
PATCH 2/3 statd: Remove vestigial "-w" option from man page synopsis
In reply to Chuck LeverThe synopsis of rpc.statd in its man page lists "-w" as a valid option. There is currently no support in the source code for a "-w" option.
---
utils/statd/statd.man | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
utils/statd/statd.man +1 -1
@@ -12,7 +12,7 @@ .SH NAME rpc.statd \- NSM service daemon .SH SYNOPSIS -.BI "rpc.statd [-dh?FLNvVw] [-H " prog "] [-n " my-name "] [-o " outgoing-port "] [-p " listener-port "] [-P " path " ] +.BI "rpc.statd [-dh?FLNvV] [-H " prog "] [-n " my-name "] [-o " outgoing-port "] [-p " listener-port "] [-P " path " ] .SH DESCRIPTION File locks are not part of persistent file system state. Lock state is thus lost when a host reboots.
PATCH 3/3 exports: add a configurable time-to-live for the kernel cache entries
In reply to Chuck LeverFrom: Trond Myklebust <[email protected]>
The fedfs ldap server will specify a ttl for its entries.
This is a refactoring change only. There should be no change in behavior.
Original patch had updates to utils/mountd/junctions.c, which no longer exists. These are not included here.
Create a macro for the default cache TTL, which is used in several places besides the export cache.
Make e_ttl unsigned.
---
support/include/exportfs.h | 1 + support/include/nfslib.h | 1 + support/nfs/exports.c | 1 + utils/mountd/cache.c | 15 ++++++++------- 4 files changed, 11 insertions(+), 7 deletions(-)
support/include/exportfs.h +1 -0
@@ -100,6 +100,7 @@ typedef struct mexport { } nfs_export;#define HASH_TABLE_SIZE 1021 +#define DEFAULT_TTL (30 * 60) typedef struct _exp_hash_entry { nfs_export * p_first;
support/include/nfslib.h +1 -0
@@ -95,6 +95,7 @@ struct exportent {char * e_fslocdata;char * e_uuid;struct sec_entry e_secinfo[SECFLAVOR_COUNT +1 ]; +unsigned int e_ttl; };struct rmtabent {
support/nfs/exports.c +1 -0
@@ -107,6 +107,7 @@ static void init_exportent (struct exportent *ee, int fromkernel) ee->e_nsquids =0 ; ee->e_nsqgids =0 ; ee->e_uuid =NULL ; + ee->e_ttl =DEFAULT_TTL ; } struct exportent *
utils/mountd/cache.c +8 -7
@@ -114,7 +114,7 @@ static void auth_unix_ip(FILE *f)qword_print (f,"nfsd" );qword_print (f, ipaddr); -qword_printint (f,time (0 )+30 *60 ); +qword_printuint (f,time (0 ) +DEFAULT_TTL );if (use_ipaddr)qword_print (f, ipaddr);else if (client)
@@ -161,7 +161,7 @@ static void auth_unix_gid(FILE *f) } }qword_printuint (f, uid); -qword_printuint (f,time (0 )+30 *60 ); +qword_printuint (f,time (0 ) +DEFAULT_TTL );if (rv >=0 ) {qword_printuint (f, ngroups);for (i=0 ; i<ngroups; i++)
@@ -644,11 +644,11 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex {qword_print (f, domain);qword_print (f, path); -qword_printint (f,time (0 )+30 *60 );if (exp) {int different_fs =strcmp (path, exp->e_path) !=0 ;int flag_mask = different_fs ? ~NFSEXP_FSID : ~0 ; +qword_printuint (f,time (0 ) + exp->e_ttl);qword_printint (f, exp->e_flags & flag_mask);qword_printint (f, exp->e_anonuid);qword_printint (f, exp->e_anongid);
@@ -667,7 +667,8 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *exqword_print (f,"uuid" );qword_printhex (f, u,16 ); } - } + }else +qword_printuint (f,time (0 ) +DEFAULT_TTL );return qword_eol (f); }
@@ -874,8 +875,8 @@ int cache_process_req(fd_set *readfds)/* * Give IP->domain and domain+path->options to kernel -* % echo nfsd $IP $[now+30*60] $domain > /proc/net/rpc/auth.unix.ip/channel -* % echo $domain $path $[now+30*60] $options $anonuid $anongid $fsid > /proc/net/rpc/nfsd.export/channel +* % echo nfsd $IP $[now+DEFAULT_TTL] $domain > /proc/net/rpc/auth.unix.ip/channel +* % echo $domain $path $[now+DEFAULT_TTL] $options $anonuid $anongid $fsid > /proc/net/rpc/nfsd.export/channel */ static int cache_export_ent (char *domain,struct exportent *exp,char *path)
@@ -955,7 +956,7 @@ int cache_export(nfs_export *exp, char *path)qword_print (f,"nfsd" );qword_print (f,host_ntop (get_addrlist (exp->m_client,0 ), buf,sizeof (buf))); -qword_printint (f,time (0 )+30 *60 ); +qword_printuint (f,time (0 ) + exp->m_export.e_ttl);qword_print (f, exp->m_client->m_hostname); err =qword_eol (f);
Quoted 15 lines · Chuck Lever
Hi Steve-
Here are two minor bug fixes, and a mountd clean up that will help out with FedFS down the road. No hurry.
---
Chuck Lever (2):
statd: Remove vestigial "-w" option from man page synopsis mount.nfs: Don't leak socket innfs_ca_sockname()Trond Myklebust (1):
exports: add a configurable time-to-live for the kernel cache entries
Quoted 8 lines
support/include/exportfs.h | 1 + support/include/nfslib.h | 1 + support/nfs/exports.c | 1 + utils/mount/network.c | 28 +++++++++++++--------------- utils/mountd/cache.c | 15 ++++++++------- utils/statd/statd.man | 2 +- 6 files changed, 25 insertions(+), 23 deletions(-)
All three patches committed...
steved.