lockd: introduce nsm_handle
Subsystems (2)
PATCH 5/22 lockd: introduce nsm_handle
From: Olaf Kirch <[email protected]>
Subject: lockd: introduce nsm_handle
This patch introduces the nsm_handle, which is shared by all nlm_host objects referring to the same client.
With this patch applied, all nlm_hosts from the same address will share the same nsm_handle. A future patch will add sharing by name.
fs/lockd/clntlock.c | 1 fs/lockd/host.c | 121 ++++++++++++++++++++++++++++++++++++++++---- fs/lockd/mon.c | 14 +++-- include/linux/lockd/lockd.h | 17 +++++- 4 files changed, 134 insertions(+), 19 deletions(-)
include/linux/lockd/lockd.h +14 -3
@@ -40,14 +40,13 @@ struct nlm_host {struct nlm_host * h_next;/* linked list (hash table) */ struct sockaddr_in h_addr;/* peer address */ struct rpc_clnt * h_rpcclnt;/* RPC client to talk to peer */ -char h_name[20 ];/* remote hostname */ +char * h_name;/* remote hostname */ u32 h_version;/* interface version */ unsigned short h_proto;/* transport proto */ unsigned short h_reclaiming : 1, h_server : 1, /* server side, not client side */ h_inuse : 1, - h_killed : 1, - h_monitored : 1; + h_killed : 1;wait_queue_head_t h_gracewait;/* wait while reclaiming */ struct rw_semaphore h_rwsem;/* Reboot recovery lock */ u32 h_state;/* pseudo-state counter */
@@ -61,6 +60,16 @@ struct nlm_host {spinlock_t h_lock;struct list_head h_granted;/* Locks in GRANTED state */ struct list_head h_reclaim;/* Locks in RECLAIM state */ +struct nsm_handle * h_nsmhandle;/* NSM status handle */ +}; + +struct nsm_handle { +struct list_head sm_link; +atomic_t sm_count; +char * sm_name; +struct sockaddr_in sm_addr; +unsigned int sm_monitored :1 , + sm_sticky :1 ;/* don't unmonitor */ };/*
@@ -173,6 +182,8 @@ void nlm_release_host(struct nlm_hostvoid nlm_shutdown_hosts (void );extern struct nlm_host *nlm_find_client (void );extern void nlm_host_rebooted (const struct sockaddr_in *,const struct nlm_reboot *); +struct nsm_handle *nsm_find (const struct sockaddr_in *,const char *,int ); +void nsm_release (struct nsm_handle *);/*
fs/lockd/host.c +110 -11
169 lines not on this page · raw message
fs/lockd/mon.c +10 -4
@@ -70,11 +70,14 @@ nsm_mon_unmon(struct nlm_host *host, u32int nsm_monitor (struct nlm_host *host) { +struct nsm_handle *nsm = host->h_nsmhandle;struct nsm_res res;int status;dprintk ("lockd: nsm_monitor(%s)\n" , host->h_name); -if (host->h_monitored) +BUG_ON (nsm ==NULL ); + +if (nsm->sm_monitored)return 0 ; status =nsm_mon_unmon (host,SM_MON , &res);
@@ -82,7 +85,7 @@ nsm_monitor(struct nlm_host *host)if (status <0 || res.status !=0 )printk (KERN_NOTICE "lockd: cannot monitor %s\n" , host->h_name);else - host->h_monitored =1 ; + nsm->sm_monitored =1 ;return status; }
@@ -92,19 +95,22 @@ nsm_monitor(struct nlm_host *host)int nsm_unmonitor (struct nlm_host *host) { +struct nsm_handle *nsm = host->h_nsmhandle;struct nsm_res res;int status =0 ;dprintk ("lockd: nsm_unmonitor(%s)\n" , host->h_name); -if (!host->h_monitored) +if (nsm ==NULL )return 0 ; - host->h_monitored =0 ; + host->h_nsmhandle =NULL ;if (!host->h_killed) { status =nsm_mon_unmon (host,SM_UNMON , &res);if (status <0 )printk (KERN_NOTICE "lockd: cannot unmonitor %s\n" , host->h_name); + nsm->sm_monitored =0 ; } +nsm_release (nsm);return status; }
fs/lockd/clntlock.c +0 -1
@@ -150,7 +150,6 @@ u32 nlmclnt_grant(const struct sockaddr_static void nlmclnt_prepare_reclaim (struct nlm_host *host) {down_write (&host->h_rwsem); - host->h_monitored =0 ; host->h_state++; host->h_nextrebind =0 ;nlm_rebind_host (host);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs