Hide use of lockd's h_monitored flag
Subsystems (2)
PATCH 2/22 Hide use of lockd's h_monitored flag
From: Olaf Kirch <[email protected]>
Subject: Hide use of lockd's h_monitored flag
This patch moves all checks of the h_monitored flag into the nsm_monitor/unmonitor functions.
A subsequent patch will replace the mechanism by which we mark a host as being monitored.
fs/lockd/clntproc.c | 2 +- fs/lockd/host.c | 9 ++++++--- fs/lockd/mon.c | 19 ++++++++++++------- fs/lockd/svc4proc.c | 2 +- fs/lockd/svcproc.c | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-)
fs/lockd/clntproc.c +1 -1
@@ -499,7 +499,7 @@ nlmclnt_lock(struct nlm_rqst *req, strucunsigned char fl_flags = fl->fl_flags;int status = -ENOLCK ; -if (!host->h_monitored &&nsm_monitor (host) <0 ) { +if (nsm_monitor (host) <0 ) {printk (KERN_NOTICE "lockd: failed to monitor %s\n" , host->h_name); goto out;
fs/lockd/host.c +6 -3
@@ -327,9 +327,12 @@ nlm_gc_hosts(void) }dprintk ("lockd: delete host %s\n" , host->h_name); *q = host->h_next; -/* Don't unmonitor hosts that have been invalidated */ -if (host->h_monitored && !host->h_killed) -nsm_unmonitor (host); + +/* +* Unmonitor unless host was invalidated (i.e. lockd restarted) +*/ +nsm_unmonitor (host); +if ((clnt = host->h_rpcclnt) !=NULL ) {if (atomic_read (&clnt->cl_users)) { printk(KERN_WARNING
fs/lockd/mon.c +12 -7
@@ -74,6 +74,8 @@ nsm_monitor(struct nlm_host *host)int status;dprintk ("lockd: nsm_monitor(%s)\n" , host->h_name); +if (host->h_monitored) +return 0 ; status =nsm_mon_unmon (host,SM_MON , &res);
@@ -91,15 +93,18 @@ int nsm_unmonitor(struct nlm_host *host) {struct nsm_res res; -int status; +int status =0 ;dprintk ("lockd: nsm_unmonitor(%s)\n" , host->h_name); - - status =nsm_mon_unmon (host,SM_UNMON , &res); -if (status <0 ) -printk (KERN_NOTICE "lockd: cannot unmonitor %s\n" , host->h_name); -else - host->h_monitored =0 ; +if (!host->h_monitored) +return 0 ; + host->h_monitored =0 ; + +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); + }return status; }
fs/lockd/svc4proc.c +1 -1
@@ -39,7 +39,7 @@ nlm4svc_retrieve_args(struct svc_rqst *r/* Obtain host handle */ if (!(host =nlmsvc_lookup_host (rqstp)) - || (argp->monitor && !host->h_monitored &&nsm_monitor (host) <0 )) + || (argp->monitor &&nsm_monitor (host) <0 )) goto no_locks; *hostp = host;
fs/lockd/svcproc.c +1 -1
@@ -67,7 +67,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rq/* Obtain host handle */ if (!(host =nlmsvc_lookup_host (rqstp)) - || (argp->monitor && !host->h_monitored &&nsm_monitor (host) <0 )) + || (argp->monitor &&nsm_monitor (host) <0 )) goto no_locks; *hostp = 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
Quoted 7 lines · On Saturday August 5, [email protected] wrote:
From: Olaf Kirch <[email protected]>
Subject: Hide use of lockd'sh_monitoredflagThis patch moves all checks of the
h_monitoredflag into the nsm_monitor/unmonitor functions.
A subsequent patch will replace the mechanism by which we mark a host as being monitored.
Something confuses me about this patch too.
You are 'hiding' h_monitored, so I looked and found there was still a reference to it in clntlock.c - in nlmclnt_prepare_reclaim. So maybe it just isn't totally hidden, and this isn't a 'use' but an assignment.
However I looked forward to the patch were you get rid of h_monitored altogether, moving it into the new nsm_handle, and calling it sm_monitored, and this assignment then quietly goes away.
I cannot help feeling that you are hiding something here, but I cannot tell what...
NeilBrown
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs