From: Greg Banks <gnb@melbourne.sgi.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [NFS] [PATCH 1/5] NLM failover - nlm_unlock
Date: Fri, 18 Aug 2006 18:23:37 +1000 [thread overview]
Message-ID: <1155889417.17651.436.camel@hole.melbourne.sgi.com> (raw)
In-Reply-To: <1155535055.3416.22.camel@localhost.localdomain>
G'day Wendy,
Your fsid-based approach does seem to make dropping locks
less fiddly than using the virtual server address. Some
minor nits...
On Mon, 2006-08-14 at 15:57, Wendy Cheng wrote:
> By writing exported filesytem id into /proc/fs/nfsd/nlm_unlock, this
> patch walks thru lockd's global nlm_files list to release all the locks
> associated with the particular id. It is used to enable NFS lock
> failover with active-active clustered servers.
> [...]
> static int
> -nlm_traverse_files(struct nlm_host *host, int action)
> +nlm_traverse_files(struct nlm_host *host, int *fsid_p, int action)
> [...]
> {
> struct nlm_file *file, **fp;
> - int i;
> + int i, rc, fsid, act=action;
>
> mutex_lock(&nlm_file_mutex);
> + if (fsid_p) fsid = *fsid_p;
I don't see any point initialising fsid like this, as you
throw away that value before ever using it. Initialising
to zero should be enough to stop the compiler complaining.
> + dprintk("lockd: drop lock file=0x%x fsid=%d\n",
> + (int) file, fsid);
`file' is a pointer, and will not be the same size as an int
on 64bit machines. This is why %p exists, see examples in
the existing NLM code.
> @@ -253,6 +307,8 @@ nlm_traverse_files(struct nlm_host *host
> /* No more references to this file. Let go of it. */
> if (!file->f_blocks && !file->f_locks
> && !file->f_shares && !file->f_count) {
> + dprintk("lockd: fo_unlock close file=0x%x\n",
> + (int) file);
Ditto.
> @@ -90,6 +103,7 @@ static ssize_t (*write_op[])(struct file
> [NFSD_Getfd] = write_getfd,
> [NFSD_Getfs] = write_getfs,
> [NFSD_Fh] = write_filehandle,
> + [NFSD_Nlm_unlock] = do_nlm_fo_unlock,
> [NFSD_Threads] = write_threads,
> [NFSD_Versions] = write_versions,
> #ifdef CONFIG_NFSD_V4
All the other entries in write_op[] have a consistent naming
scheme, being called write_foo().
> @@ -334,6 +348,32 @@ static ssize_t write_filehandle(struct f
> return mesg - buf;
> }
>
> +static ssize_t do_nlm_fo_unlock(struct file *file, char *buf, size_t size)
> +{
> + char *mesg = buf;
> + int fsid, rc;
> +
> + if (size <= 0) return -EINVAL;
> +
> + /* convert string into a valid fsid */
> + rc = get_int(&mesg, &fsid);
> + if (rc) {
> + dprintk("nfsd: do_nlm_ip_unlock invalid ip(%s)\n", buf);
> + return rc;
> + }
This dprintk seems to reflect the function's previous name
and semantics.
> +
> + /* call nlm to release the locks */
> + rc = nlmsvc_fo_unlock(&fsid);
I don't understand why you pass this parameter by reference?
It's not large and none of the functions called by nlmsvc_fo_unlock()
need to write to it.
> #ifdef CONFIG_NFSD_V4
> --- linux-0/include/linux/nfsd/debug.h 2006-07-14 14:32:29.000000000 -0400
> +++ linux-1/include/linux/nfsd/debug.h 2006-08-11 10:12:29.000000000 -0400
> @@ -32,6 +32,7 @@
> #define NFSDDBG_REPCACHE 0x0080
> #define NFSDDBG_XDR 0x0100
> #define NFSDDBG_LOCKD 0x0200
> +#define NFSDDBG_CLUSTER 0x0400
> #define NFSDDBG_ALL 0x7FFF
> #define NFSDDBG_NOCHANGE 0xFFFF
>
You don't seem to use this anywhere.
Greg.
--
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.
next prev parent reply other threads:[~2006-08-18 8:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-14 5:57 [Cluster-devel] [PATCH 1/5] NLM failover - nlm_unlock Wendy Cheng
2006-08-18 8:23 ` Greg Banks [this message]
2006-08-18 14:27 ` [Cluster-devel] Re: [NFS] " Wendy Cheng
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=1155889417.17651.436.camel@hole.melbourne.sgi.com \
--to=gnb@melbourne.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).