From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: trond.myklebust@fys.uio.no, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 5/6] NLM: Clean up nsm_monitor() call
Date: Wed, 3 Dec 2008 16:28:59 -0500 [thread overview]
Message-ID: <20081203212859.GR16846@fieldses.org> (raw)
In-Reply-To: <20081201185805.10600.23630.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
On Mon, Dec 01, 2008 at 01:58:05PM -0500, Chuck Lever wrote:
> Clean up: A few minor clean-ups for nsm_unmonitor():
Looks fine, but might prefer this slightly finer-grained:
>
> o Arrange dprintk and check of sm_monitored consistently with
> nsm_monitor().
>
> o nsm_unmonitor()'s only caller doesn't care about the return code,
> so eliminate it (thanks, Bruce).
>
> o The nsm_handle's reference count is bumped in nlm_lookup_host()
> so it should be decremented in nlm_destroy_host() to make it
> easier to see the balance of these two operations. For the
> moment we leave nsm_release() public.
That might be a candidate to split out as a separate patch.
> diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
> index 78d5f59..b76d9b2 100644
> --- a/fs/lockd/mon.c
> +++ b/fs/lockd/mon.c
> @@ -107,33 +107,30 @@ int nsm_monitor(const struct nlm_host *host)
> return status;
> }
>
> -/*
> - * Cease to monitor remote host
> +/**
> + * nsm_unmonitor - Unregister peer notification
> + * @nsm: pointer to nsm_handle of peer to stop monitoring
> + *
> + * If this peer is monitored, this function sends an upcall to
> + * tell the local rpc.statd not to send this peer a notification
> + * when we reboot.
> */
> -int
> -nsm_unmonitor(struct nlm_host *host)
> +void nsm_unmonitor(struct nsm_handle *nsm)
> {
> - struct nsm_handle *nsm = host->h_nsmhandle;
> - struct nsm_res res;
> - int status = 0;
> + struct nsm_res res;
>
> - if (nsm == NULL)
> - return 0;
Hm. Yeah, can't see how it could ever have been called with NULL--might
be worth a changelog comment, though.
--b.
> - host->h_nsmhandle = NULL;
> + dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name);
>
> - if (atomic_read(&nsm->sm_count) == 1
> - && nsm->sm_monitored && !nsm->sm_sticky) {
> - dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name);
> + if (!nsm->sm_monitored)
> + return;
>
> - status = nsm_mon_unmon(nsm, SM_UNMON, &res);
> - if (status < 0)
> + if (atomic_read(&nsm->sm_count) == 1 && !nsm->sm_sticky) {
> + if (nsm_mon_unmon(nsm, SM_UNMON, &res) < 0)
> printk(KERN_NOTICE "lockd: cannot unmonitor %s\n",
> - host->h_name);
> + nsm->sm_name);
> else
> nsm->sm_monitored = 0;
> }
> - nsm_release(nsm);
> - return status;
> }
>
> /*
> diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
> index 4ca6f39..e2fa968 100644
> --- a/include/linux/lockd/lockd.h
> +++ b/include/linux/lockd/lockd.h
> @@ -237,6 +237,7 @@ void nsm_release(struct nsm_handle *);
> * Host monitoring
> */
> int nsm_monitor(const struct nlm_host *host);
> +void nsm_unmonitor(struct nsm_handle *nsm);
>
> /*
> * This is used in garbage collection and resource reclaim
> diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
> index 546b610..896a5e3 100644
> --- a/include/linux/lockd/sm_inter.h
> +++ b/include/linux/lockd/sm_inter.h
> @@ -41,7 +41,6 @@ struct nsm_res {
> u32 state;
> };
>
> -int nsm_unmonitor(struct nlm_host *);
> extern int nsm_local_state;
>
> #endif /* LINUX_LOCKD_SM_INTER_H */
>
next prev parent reply other threads:[~2008-12-03 21:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 18:57 [PATCH 0/6] First set of patches for 2.6.29 Chuck Lever
[not found] ` <20081201185108.10600.21700.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-01 18:57 ` [PATCH 1/6] NLM: Remove address eye-catcher buffers from nlm_host Chuck Lever
[not found] ` <20081201185734.10600.88841.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-03 19:03 ` J. Bruce Fields
2008-12-03 19:10 ` Chuck Lever
2008-12-01 18:57 ` [PATCH 2/6] NLM: Support IPv6 scope IDs in nlm_display_address() Chuck Lever
[not found] ` <20081201185741.10600.7375.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-03 19:34 ` J. Bruce Fields
2008-12-03 19:46 ` J. Bruce Fields
2008-12-01 18:57 ` [PATCH 3/6] NSM: Support IPv6 version of mon_name Chuck Lever
[not found] ` <20081201185749.10600.38468.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-03 21:01 ` J. Bruce Fields
2008-12-03 21:19 ` Chuck Lever
2008-12-03 21:24 ` Chuck Lever
2008-12-01 18:57 ` [PATCH 4/6] NLM: Clean up nsm_monitor() call Chuck Lever
[not found] ` <20081201185757.10600.38854.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-03 21:08 ` J. Bruce Fields
2008-12-03 21:20 ` Chuck Lever
2008-12-01 18:58 ` [PATCH 5/6] " Chuck Lever
[not found] ` <20081201185805.10600.23630.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-03 21:28 ` J. Bruce Fields [this message]
2008-12-01 18:58 ` [PATCH 6/6] NSM: Serialize SM_MON and SM_UNMON upcalls Chuck Lever
[not found] ` <20081201185812.10600.92501.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-03 21:41 ` J. Bruce Fields
2008-12-04 0:38 ` Chuck Lever
2008-12-04 3:55 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081203212859.GR16846@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.