* [Cluster-devel] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-29 18:11 ` Wendy Cheng
0 siblings, 0 replies; 18+ messages in thread
From: Wendy Cheng @ 2006-06-29 18:11 UTC (permalink / raw)
To: cluster-devel.redhat.com
The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
where NFS server ip address is stored. Upon writing IPv4 address in
standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
examine NLM's global nlm_files list and subsequently unlock the
associated file if server ip address matches.
Due to the size of rq_daddr (u32), we would not be able to support IPV6
for this round of changes. Another to-do item is to enable client:server
ip pairs to allow NFS V4 failover.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gfs_nlm_unlock.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20060629/0e2f4e2b/attachment.ksh>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-29 18:11 ` Wendy Cheng
0 siblings, 0 replies; 18+ messages in thread
From: Wendy Cheng @ 2006-06-29 18:11 UTC (permalink / raw)
To: nfs, cluster-devel; +Cc: Lon Hohberger
[-- Attachment #1: Type: text/plain, Size: 510 bytes --]
The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
where NFS server ip address is stored. Upon writing IPv4 address in
standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
examine NLM's global nlm_files list and subsequently unlock the
associated file if server ip address matches.
Due to the size of rq_daddr (u32), we would not be able to support IPV6
for this round of changes. Another to-do item is to enable client:server
ip pairs to allow NFS V4 failover.
[-- Attachment #2: gfs_nlm_unlock.patch --]
[-- Type: text/plain, Size: 8717 bytes --]
fs/lockd/svcsubs.c | 58 ++++++++++++++++++++++++++++++++++++++++----
fs/nfsd/nfsctl.c | 54 ++++++++++++++++++++++++++++++++++++++++
include/linux/lockd/bind.h | 5 +++
include/linux/lockd/lockd.h | 3 ++
net/sunrpc/svcsock.c | 5 +++
5 files changed, 120 insertions(+), 5 deletions(-)
--- linux-2.6.17/include/linux/lockd/lockd.h 2006-06-17 21:49:35.000000000 -0400
+++ linux-2.6.17-1/include/linux/lockd/lockd.h 2006-06-27 10:58:47.000000000 -0400
@@ -105,6 +105,7 @@ struct nlm_file {
unsigned int f_count; /* reference count */
struct semaphore f_sema; /* avoid concurrent access */
int f_hash; /* hash of f_handle */
+ __u32 f_iaddr; /* server ip for failover */
};
/*
@@ -133,6 +134,7 @@ struct nlm_block {
#define NLM_ACT_CHECK 0 /* check for locks */
#define NLM_ACT_MARK 1 /* mark & sweep */
#define NLM_ACT_UNLOCK 2 /* release all locks */
+#define NLM_ACT_FO_UNLOCK 3 /* failover release locks */
/*
* Global variables
@@ -196,6 +198,7 @@ void nlm_release_file(struct nlm_file
void nlmsvc_mark_resources(void);
void nlmsvc_free_host_resources(struct nlm_host *);
void nlmsvc_invalidate_all(void);
+int nlmsvc_fo_unlock(struct in_addr *);
static __inline__ struct inode *
nlmsvc_file_inode(struct nlm_file *file)
--- linux-2.6.17/net/sunrpc/svcsock.c 2006-06-17 21:49:35.000000000 -0400
+++ linux-2.6.17-1/net/sunrpc/svcsock.c 2006-06-27 10:58:47.000000000 -0400
@@ -454,6 +454,7 @@ svc_recvfrom(struct svc_rqst *rqstp, str
struct msghdr msg;
struct socket *sock;
int len, alen;
+ struct sockaddr_in daddr;
rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
sock = rqstp->rq_sock->sk_sock;
@@ -474,6 +475,10 @@ svc_recvfrom(struct svc_rqst *rqstp, str
alen = sizeof(rqstp->rq_addr);
sock->ops->getname(sock, (struct sockaddr *)&rqstp->rq_addr, &alen, 1);
+ /* add server ip for nlm lock failover */
+ sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
+ rqstp->rq_daddr = daddr.sin_addr.s_addr;
+
dprintk("svc: socket %p recvfrom(%p, %Zu) = %d\n",
rqstp->rq_sock, iov[0].iov_base, iov[0].iov_len, len);
--- linux-2.6.17/fs/lockd/svcsubs.c 2006-06-17 21:49:35.000000000 -0400
+++ linux-2.6.17-1/fs/lockd/svcsubs.c 2006-06-28 14:55:33.000000000 -0400
@@ -20,6 +20,8 @@
#include <linux/lockd/share.h>
#include <linux/lockd/sm_inter.h>
+#include <linux/module.h>
+
#define NLMDBG_FACILITY NLMDBG_SVCSUBS
@@ -124,6 +126,10 @@ nlm_lookup_file(struct svc_rqst *rqstp,
file->f_next = nlm_files[hash];
nlm_files[hash] = file;
+ /* fill in f_iaddr for nlm lock failover */
+ file->f_iaddr = rqstp->rq_daddr;
+ dprintk("lockd: file->f_iaddr = %u.%u.%u.%u\n", NIPQUAD(file->f_iaddr));
+
found:
dprintk("lockd: found file %p (count %d)\n", file, file->f_count);
*result = file;
@@ -235,18 +241,38 @@ nlm_inspect_file(struct nlm_host *host,
* Loop over all files in the file table.
*/
static int
-nlm_traverse_files(struct nlm_host *host, int action)
+nlm_traverse_files(struct nlm_host *host, struct in_addr *serv, int action)
{
struct nlm_file *file, **fp;
- int i;
+ int i, act=action;
mutex_lock(&nlm_file_mutex);
for (i = 0; i < FILE_NRHASH; i++) {
fp = nlm_files + i;
while ((file = *fp) != NULL) {
+
+ /*
+ * NLM lock failover:
+ * Upon NLM_ACT_FO_UNLOCK, compare the
+ * server in_addr (f_iaddr) with requested
+ * serv. If match is found, the lock will
+ * be released via NLM_ACT_UNLOCK.
+ */
+ if (unlikely(action == NLM_ACT_FO_UNLOCK)) {
+ dprintk("lockd: fo file check %u.%u.%u.%u\n",
+ NIPQUAD(serv->s_addr));
+ if (serv->s_addr != file->f_iaddr) {
+ fp = &file->f_next;
+ continue;
+ }
+ dprintk("lockd: fo found match file 0x%x\n",
+ (int) file);
+ act = NLM_ACT_UNLOCK;
+ }
+
/* Traverse locks, blocks and shares of this file
* and update file->f_locks count */
- if (nlm_inspect_file(host, file, action)) {
+ if (nlm_inspect_file(host, file, act)) {
mutex_unlock(&nlm_file_mutex);
return 1;
}
@@ -254,6 +280,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);
*fp = file->f_next;
nlmsvc_ops->fclose(file->f_file);
kfree(file);
@@ -301,7 +329,7 @@ nlmsvc_mark_resources(void)
{
dprintk("lockd: nlmsvc_mark_resources\n");
- nlm_traverse_files(NULL, NLM_ACT_MARK);
+ nlm_traverse_files(NULL, NULL, NLM_ACT_MARK);
}
/*
@@ -312,7 +340,7 @@ nlmsvc_free_host_resources(struct nlm_ho
{
dprintk("lockd: nlmsvc_free_host_resources\n");
- if (nlm_traverse_files(host, NLM_ACT_UNLOCK))
+ if (nlm_traverse_files(host, NULL, NLM_ACT_UNLOCK))
printk(KERN_WARNING
"lockd: couldn't remove all locks held by %s",
host->h_name);
@@ -332,3 +360,23 @@ nlmsvc_invalidate_all(void)
nlm_release_host(host);
}
}
+
+EXPORT_SYMBOL(nlmsvc_fo_unlock);
+
+/*
+ * release locks associated with an IP upon failover
+ */
+int
+nlmsvc_fo_unlock(struct in_addr *serv_ip)
+{
+ struct nlm_host clnt;
+
+ /* To do:
+ * prepare nlm_host for nfs V4 client
+ */
+ memset(&clnt, 0, sizeof(struct nlm_host));
+
+ /* drop the locks */
+ return (nlm_traverse_files(NULL, serv_ip, NLM_ACT_FO_UNLOCK));
+}
+
--- linux-2.6.17/include/linux/lockd/bind.h 2006-06-17 21:49:35.000000000 -0400
+++ linux-2.6.17-1/include/linux/lockd/bind.h 2006-06-27 10:58:51.000000000 -0400
@@ -33,4 +33,9 @@ extern int nlmclnt_proc(struct inode *,
extern int lockd_up(void);
extern void lockd_down(void);
+/*
+ * NLM failover
+ */
+extern int nlmsvc_fo_unlock(struct in_addr *);
+
#endif /* LINUX_LOCKD_BIND_H */
--- linux-2.6.17/fs/nfsd/nfsctl.c 2006-06-17 21:49:35.000000000 -0400
+++ linux-2.6.17-1/fs/nfsd/nfsctl.c 2006-06-27 23:37:05.000000000 -0400
@@ -34,6 +34,10 @@
#include <linux/nfsd/syscall.h>
#include <linux/nfsd/interface.h>
+/* nlm failover */
+#include <linux/in.h>
+#include <linux/lockd/bind.h>
+
#include <asm/uaccess.h>
unsigned int nfsd_versbits = ~0;
@@ -52,6 +56,7 @@ enum {
NFSD_Getfs,
NFSD_List,
NFSD_Fh,
+ NFSD_Nlm_unlock,
NFSD_Threads,
NFSD_Versions,
/*
@@ -82,6 +87,11 @@ static ssize_t write_leasetime(struct fi
static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
#endif
+/*
+ * NLM lock failover
+ */
+static ssize_t do_nlm_fo_unlock(struct file *file, char *buf, size_t size);
+
static ssize_t (*write_op[])(struct file *, char *, size_t) = {
[NFSD_Svc] = write_svc,
[NFSD_Add] = write_add,
@@ -91,6 +101,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
@@ -335,6 +346,48 @@ static ssize_t write_filehandle(struct f
return mesg - buf;
}
+extern __u32 in_aton(const char *str);
+
+int __get_nlm_host(char *buf, size_t size, struct in_addr *host_addr)
+{
+ /* sanity check */
+ if (size <= 0) return -EINVAL;
+
+ /* The ip is passed from nfsctl_transaction_write()
+ * where simple_transaction_get() "copy_from_user()"
+ * into buf. Convert the string into a valid ip addr.
+ */
+ host_addr->s_addr = in_aton(buf);
+ printk("nfsd: __get_nlm_host (%u.%u.%u.%u)\n",
+ NIPQUAD(host_addr->s_addr));
+ return 0;
+}
+
+static ssize_t do_nlm_fo_unlock(struct file *file, char *buf, size_t size)
+{
+ struct in_addr serv_addr;
+ int rc;
+
+ /* convert string into a valid ip */
+ rc = __get_nlm_host(buf, size, &serv_addr);
+ if (rc) {
+ printk("nfsd: do_nlm_ip_unlock invalid ip(%s)\n", buf);
+ return rc;
+ }
+
+ /* call nlm to release the locks */
+ rc = nlmsvc_fo_unlock(&serv_addr);
+ if (rc) {
+ printk("nfsd: nlmsvc_fo_unlock return rc=%d\n", rc);
+ return rc;
+ }
+
+ /* done */
+ sprintf(buf, "nlm ip unlock released for %u.%u.%u.%u\n",
+ NIPQUAD(serv_addr.s_addr));
+ return strlen(buf);
+}
+
extern int nfsd_nrthreads(void);
static ssize_t write_threads(struct file *file, char *buf, size_t size)
@@ -483,6 +536,7 @@ static int nfsd_fill_super(struct super_
[NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_List] = {"exports", &exports_operations, S_IRUGO},
[NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR},
+ [NFSD_Nlm_unlock] = {"nlm_unlock", &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
#ifdef CONFIG_NFSD_V4
[-- Attachment #3: Type: text/plain, Size: 299 bytes --]
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
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
2006-06-29 18:11 ` Wendy Cheng
@ 2006-06-29 19:11 ` Chuck Lever
-1 siblings, 0 replies; 18+ messages in thread
From: Chuck Lever @ 2006-06-29 19:11 UTC (permalink / raw)
To: Wendy Cheng; +Cc: cluster-devel, Lon Hohberger, nfs
On 6/29/06, Wendy Cheng <wcheng@redhat.com> wrote:
> The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
> where NFS server ip address is stored. Upon writing IPv4 address in
> standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
> examine NLM's global nlm_files list and subsequently unlock the
> associated file if server ip address matches.
>
> Due to the size of rq_daddr (u32), we would not be able to support IPV6
> for this round of changes. Another to-do item is to enable client:server
> ip pairs to allow NFS V4 failover.
FYI: I have a patch in my IPv6 patchset that increases the size of
this field specifically in order to hold an IPv6 address. See:
http://oss.oracle.com/~cel/linux-2.6/2.6.17/patches/52-svc-rq_daddr.diff
for the individual patch, and surrounding patches for more context.
--
"We who cut mere stones must always be envisioning cathedrals"
-- Quarry worker's creed
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-29 19:11 ` Chuck Lever
0 siblings, 0 replies; 18+ messages in thread
From: Chuck Lever @ 2006-06-29 19:11 UTC (permalink / raw)
To: cluster-devel.redhat.com
On 6/29/06, Wendy Cheng <wcheng@redhat.com> wrote:
> The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
> where NFS server ip address is stored. Upon writing IPv4 address in
> standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
> examine NLM's global nlm_files list and subsequently unlock the
> associated file if server ip address matches.
>
> Due to the size of rq_daddr (u32), we would not be able to support IPV6
> for this round of changes. Another to-do item is to enable client:server
> ip pairs to allow NFS V4 failover.
FYI: I have a patch in my IPv6 patchset that increases the size of
this field specifically in order to hold an IPv6 address. See:
http://oss.oracle.com/~cel/linux-2.6/2.6.17/patches/52-svc-rq_daddr.diff
for the individual patch, and surrounding patches for more context.
--
"We who cut mere stones must always be envisioning cathedrals"
-- Quarry worker's creed
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
2006-06-29 19:11 ` [Cluster-devel] Re: [NFS] " Chuck Lever
@ 2006-06-29 21:49 ` Wendy Cheng
-1 siblings, 0 replies; 18+ messages in thread
From: Wendy Cheng @ 2006-06-29 21:49 UTC (permalink / raw)
To: cluster-devel.redhat.com
Chuck Lever wrote:
>On 6/29/06, Wendy Cheng <wcheng@redhat.com> wrote:
>
>
>>The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
>>where NFS server ip address is stored. Upon writing IPv4 address in
>>standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
>>examine NLM's global nlm_files list and subsequently unlock the
>>associated file if server ip address matches.
>>
>>Due to the size of rq_daddr (u32), we would not be able to support IPV6
>>for this round of changes. Another to-do item is to enable client:server
>>ip pairs to allow NFS V4 failover.
>>
>>
>
>FYI: I have a patch in my IPv6 patchset that increases the size of
>this field specifically in order to hold an IPv6 address. See:
>
> http://oss.oracle.com/~cel/linux-2.6/2.6.17/patches/52-svc-rq_daddr.diff
>
>for the individual patch, and surrounding patches for more context.
>
>
>
ok, thanks ...
-- Wendy
--
S. Wendy Cheng
wcheng at redhat.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-29 21:49 ` Wendy Cheng
0 siblings, 0 replies; 18+ messages in thread
From: Wendy Cheng @ 2006-06-29 21:49 UTC (permalink / raw)
To: Chuck Lever; +Cc: cluster-devel, Lon Hohberger, nfs
Chuck Lever wrote:
>On 6/29/06, Wendy Cheng <wcheng@redhat.com> wrote:
>
>
>>The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
>>where NFS server ip address is stored. Upon writing IPv4 address in
>>standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
>>examine NLM's global nlm_files list and subsequently unlock the
>>associated file if server ip address matches.
>>
>>Due to the size of rq_daddr (u32), we would not be able to support IPV6
>>for this round of changes. Another to-do item is to enable client:server
>>ip pairs to allow NFS V4 failover.
>>
>>
>
>FYI: I have a patch in my IPv6 patchset that increases the size of
>this field specifically in order to hold an IPv6 address. See:
>
> http://oss.oracle.com/~cel/linux-2.6/2.6.17/patches/52-svc-rq_daddr.diff
>
>for the individual patch, and surrounding patches for more context.
>
>
>
ok, thanks ...
-- Wendy
--
S. Wendy Cheng
wcheng@redhat.com
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
2006-06-29 18:11 ` Wendy Cheng
@ 2006-06-29 23:06 ` Trond Myklebust
-1 siblings, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2006-06-29 23:06 UTC (permalink / raw)
To: Wendy Cheng; +Cc: cluster-devel, Lon Hohberger, nfs
On Thu, 2006-06-29 at 14:11 -0400, Wendy Cheng wrote:
> The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
> where NFS server ip address is stored. Upon writing IPv4 address in
> standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
> examine NLM's global nlm_files list and subsequently unlock the
> associated file if server ip address matches.
>
> Due to the size of rq_daddr (u32), we would not be able to support IPV6
> for this round of changes. Another to-do item is to enable client:server
> ip pairs to allow NFS V4 failover.
>
>
>
>
> plain text document attachment (gfs_nlm_unlock.patch)
> fs/lockd/svcsubs.c | 58 ++++++++++++++++++++++++++++++++++++++++----
> fs/nfsd/nfsctl.c | 54 ++++++++++++++++++++++++++++++++++++++++
> include/linux/lockd/bind.h | 5 +++
> include/linux/lockd/lockd.h | 3 ++
> net/sunrpc/svcsock.c | 5 +++
> 5 files changed, 120 insertions(+), 5 deletions(-)
>
> --- linux-2.6.17/include/linux/lockd/lockd.h 2006-06-17 21:49:35.000000000 -0400
> +++ linux-2.6.17-1/include/linux/lockd/lockd.h 2006-06-27 10:58:47.000000000 -0400
> @@ -105,6 +105,7 @@ struct nlm_file {
> unsigned int f_count; /* reference count */
> struct semaphore f_sema; /* avoid concurrent access */
> int f_hash; /* hash of f_handle */
> + __u32 f_iaddr; /* server ip for failover */
> };
>
> /*
> @@ -133,6 +134,7 @@ struct nlm_block {
> #define NLM_ACT_CHECK 0 /* check for locks */
> #define NLM_ACT_MARK 1 /* mark & sweep */
> #define NLM_ACT_UNLOCK 2 /* release all locks */
> +#define NLM_ACT_FO_UNLOCK 3 /* failover release locks */
>
> /*
> * Global variables
> @@ -196,6 +198,7 @@ void nlm_release_file(struct nlm_file
> void nlmsvc_mark_resources(void);
> void nlmsvc_free_host_resources(struct nlm_host *);
> void nlmsvc_invalidate_all(void);
> +int nlmsvc_fo_unlock(struct in_addr *);
>
> static __inline__ struct inode *
> nlmsvc_file_inode(struct nlm_file *file)
> --- linux-2.6.17/net/sunrpc/svcsock.c 2006-06-17 21:49:35.000000000 -0400
> +++ linux-2.6.17-1/net/sunrpc/svcsock.c 2006-06-27 10:58:47.000000000 -0400
> @@ -454,6 +454,7 @@ svc_recvfrom(struct svc_rqst *rqstp, str
> struct msghdr msg;
> struct socket *sock;
> int len, alen;
> + struct sockaddr_in daddr;
>
> rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
> sock = rqstp->rq_sock->sk_sock;
> @@ -474,6 +475,10 @@ svc_recvfrom(struct svc_rqst *rqstp, str
> alen = sizeof(rqstp->rq_addr);
> sock->ops->getname(sock, (struct sockaddr *)&rqstp->rq_addr, &alen, 1);
>
> + /* add server ip for nlm lock failover */
> + sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> + rqstp->rq_daddr = daddr.sin_addr.s_addr;
> +
Hmm.... Why would you want to do this on every receive when you could
just store the ip address in the struct svc_sock once and for all?
That said, how do you envisage this working in the cases where the
socket is bound to INADDR_ANY?
Cheers,
Trond
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-29 23:06 ` Trond Myklebust
0 siblings, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2006-06-29 23:06 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Thu, 2006-06-29 at 14:11 -0400, Wendy Cheng wrote:
> The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst
> where NFS server ip address is stored. Upon writing IPv4 address in
> standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will
> examine NLM's global nlm_files list and subsequently unlock the
> associated file if server ip address matches.
>
> Due to the size of rq_daddr (u32), we would not be able to support IPV6
> for this round of changes. Another to-do item is to enable client:server
> ip pairs to allow NFS V4 failover.
>
>
>
>
> plain text document attachment (gfs_nlm_unlock.patch)
> fs/lockd/svcsubs.c | 58 ++++++++++++++++++++++++++++++++++++++++----
> fs/nfsd/nfsctl.c | 54 ++++++++++++++++++++++++++++++++++++++++
> include/linux/lockd/bind.h | 5 +++
> include/linux/lockd/lockd.h | 3 ++
> net/sunrpc/svcsock.c | 5 +++
> 5 files changed, 120 insertions(+), 5 deletions(-)
>
> --- linux-2.6.17/include/linux/lockd/lockd.h 2006-06-17 21:49:35.000000000 -0400
> +++ linux-2.6.17-1/include/linux/lockd/lockd.h 2006-06-27 10:58:47.000000000 -0400
> @@ -105,6 +105,7 @@ struct nlm_file {
> unsigned int f_count; /* reference count */
> struct semaphore f_sema; /* avoid concurrent access */
> int f_hash; /* hash of f_handle */
> + __u32 f_iaddr; /* server ip for failover */
> };
>
> /*
> @@ -133,6 +134,7 @@ struct nlm_block {
> #define NLM_ACT_CHECK 0 /* check for locks */
> #define NLM_ACT_MARK 1 /* mark & sweep */
> #define NLM_ACT_UNLOCK 2 /* release all locks */
> +#define NLM_ACT_FO_UNLOCK 3 /* failover release locks */
>
> /*
> * Global variables
> @@ -196,6 +198,7 @@ void nlm_release_file(struct nlm_file
> void nlmsvc_mark_resources(void);
> void nlmsvc_free_host_resources(struct nlm_host *);
> void nlmsvc_invalidate_all(void);
> +int nlmsvc_fo_unlock(struct in_addr *);
>
> static __inline__ struct inode *
> nlmsvc_file_inode(struct nlm_file *file)
> --- linux-2.6.17/net/sunrpc/svcsock.c 2006-06-17 21:49:35.000000000 -0400
> +++ linux-2.6.17-1/net/sunrpc/svcsock.c 2006-06-27 10:58:47.000000000 -0400
> @@ -454,6 +454,7 @@ svc_recvfrom(struct svc_rqst *rqstp, str
> struct msghdr msg;
> struct socket *sock;
> int len, alen;
> + struct sockaddr_in daddr;
>
> rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
> sock = rqstp->rq_sock->sk_sock;
> @@ -474,6 +475,10 @@ svc_recvfrom(struct svc_rqst *rqstp, str
> alen = sizeof(rqstp->rq_addr);
> sock->ops->getname(sock, (struct sockaddr *)&rqstp->rq_addr, &alen, 1);
>
> + /* add server ip for nlm lock failover */
> + sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> + rqstp->rq_daddr = daddr.sin_addr.s_addr;
> +
Hmm.... Why would you want to do this on every receive when you could
just store the ip address in the struct svc_sock once and for all?
That said, how do you envisage this working in the cases where the
socket is bound to INADDR_ANY?
Cheers,
Trond
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
2006-06-29 23:06 ` [Cluster-devel] Re: [NFS] " Trond Myklebust
@ 2006-06-30 3:57 ` Wendy Cheng
-1 siblings, 0 replies; 18+ messages in thread
From: Wendy Cheng @ 2006-06-30 3:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Thu, 2006-06-29 at 19:06 -0400, Trond Myklebust wrote:
> >
> > + /* add server ip for nlm lock failover */
> > + sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> > + rqstp->rq_daddr = daddr.sin_addr.s_addr;
> > +
>
> Hmm.... Why would you want to do this on every receive when you could
> just store the ip address in the struct svc_sock once and for all?
ok, will do that - save latency. Thanks.
>
> That said, how do you envisage this working in the cases where the
> socket is bound to INADDR_ANY?
This is "our" (server's) address, not peer address - for this request to
arrive "here", it can't be INADDR_ANY. Can it ? Remember "rq_daddr" will
only be used during failover in a clustered NFS servers environment.
-- Wendy
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 3:57 ` Wendy Cheng
0 siblings, 0 replies; 18+ messages in thread
From: Wendy Cheng @ 2006-06-30 3:57 UTC (permalink / raw)
To: Trond Myklebust; +Cc: cluster-devel, Lon Hohberger, nfs
On Thu, 2006-06-29 at 19:06 -0400, Trond Myklebust wrote:
> >
> > + /* add server ip for nlm lock failover */
> > + sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> > + rqstp->rq_daddr = daddr.sin_addr.s_addr;
> > +
>
> Hmm.... Why would you want to do this on every receive when you could
> just store the ip address in the struct svc_sock once and for all?
ok, will do that - save latency. Thanks.
>
> That said, how do you envisage this working in the cases where the
> socket is bound to INADDR_ANY?
This is "our" (server's) address, not peer address - for this request to
arrive "here", it can't be INADDR_ANY. Can it ? Remember "rq_daddr" will
only be used during failover in a clustered NFS servers environment.
-- Wendy
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 4:15 ` Neil Brown
0 siblings, 0 replies; 18+ messages in thread
From: Neil Brown @ 2006-06-30 4:15 UTC (permalink / raw)
To: Wendy Cheng; +Cc: cluster-devel, Lon Hohberger, nfs, Trond Myklebust
On Thursday June 29, wcheng@redhat.com wrote:
> On Thu, 2006-06-29 at 19:06 -0400, Trond Myklebust wrote:
>
> > >
> > > + /* add server ip for nlm lock failover */
> > > + sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> > > + rqstp->rq_daddr = daddr.sin_addr.s_addr;
> > > +
> >
> > Hmm.... Why would you want to do this on every receive when you could
> > just store the ip address in the struct svc_sock once and for all?
>
> ok, will do that - save latency. Thanks.
>
> >
> > That said, how do you envisage this working in the cases where the
> > socket is bound to INADDR_ANY?
>
> This is "our" (server's) address, not peer address - for this request to
> arrive "here", it can't be INADDR_ANY. Can it ? Remember "rq_daddr" will
> only be used during failover in a clustered NFS servers environment.
The socket can only be bound to INADDR_ANY for UDP, and in that case
we already set rq_daddr correctly.
For a TCP socket, it will be connected, so the local an remote
endpoints will be well defined.
So the code as it stands should work fine.
But yes, it would be best to record the local and remote addresses in
svc_tcp_accept rather than called ->getname twice in svc_recvfrom.
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 4:15 ` Neil Brown
0 siblings, 0 replies; 18+ messages in thread
From: Neil Brown @ 2006-06-30 4:15 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Thursday June 29, wcheng at redhat.com wrote:
> On Thu, 2006-06-29 at 19:06 -0400, Trond Myklebust wrote:
>
> > >
> > > + /* add server ip for nlm lock failover */
> > > + sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> > > + rqstp->rq_daddr = daddr.sin_addr.s_addr;
> > > +
> >
> > Hmm.... Why would you want to do this on every receive when you could
> > just store the ip address in the struct svc_sock once and for all?
>
> ok, will do that - save latency. Thanks.
>
> >
> > That said, how do you envisage this working in the cases where the
> > socket is bound to INADDR_ANY?
>
> This is "our" (server's) address, not peer address - for this request to
> arrive "here", it can't be INADDR_ANY. Can it ? Remember "rq_daddr" will
> only be used during failover in a clustered NFS servers environment.
The socket can only be bound to INADDR_ANY for UDP, and in that case
we already set rq_daddr correctly.
For a TCP socket, it will be connected, so the local an remote
endpoints will be well defined.
So the code as it stands should work fine.
But yes, it would be best to record the local and remote addresses in
svc_tcp_accept rather than called ->getname twice in svc_recvfrom.
NeilBrown
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
2006-06-30 4:15 ` [Cluster-devel] Re: [NFS] " Neil Brown
@ 2006-06-30 4:38 ` Trond Myklebust
-1 siblings, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2006-06-30 4:38 UTC (permalink / raw)
To: Neil Brown; +Cc: cluster-devel, Lon Hohberger, nfs, Wendy Cheng
On Fri, 2006-06-30 at 14:15 +1000, Neil Brown wrote:
> The socket can only be bound to INADDR_ANY for UDP, and in that case
> we already set rq_daddr correctly.
As I understand it, Wendy is considering the case of a multi-homed
server. She wants to record the IP address on which we received the
datagram so that she knows which locks to invalidate in the case of a
migration of that particular IP address onto another server.
My point is that she won't get that information if the socket is bound
to INADDR_ANY, as would be the case for a UDP socket.
Cheers,
Trond
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 4:38 ` Trond Myklebust
0 siblings, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2006-06-30 4:38 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Fri, 2006-06-30 at 14:15 +1000, Neil Brown wrote:
> The socket can only be bound to INADDR_ANY for UDP, and in that case
> we already set rq_daddr correctly.
As I understand it, Wendy is considering the case of a multi-homed
server. She wants to record the IP address on which we received the
datagram so that she knows which locks to invalidate in the case of a
migration of that particular IP address onto another server.
My point is that she won't get that information if the socket is bound
to INADDR_ANY, as would be the case for a UDP socket.
Cheers,
Trond
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
2006-06-30 3:57 ` Wendy Cheng
@ 2006-06-30 4:39 ` Trond Myklebust
-1 siblings, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2006-06-30 4:39 UTC (permalink / raw)
To: Wendy Cheng; +Cc: cluster-devel, Lon Hohberger, nfs
On Thu, 2006-06-29 at 23:57 -0400, Wendy Cheng wrote:
> This is "our" (server's) address, not peer address - for this request to
> arrive "here", it can't be INADDR_ANY. Can it ?
Consider the case of a UDP socket.
Cheers,
Trond
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 4:39 ` Trond Myklebust
0 siblings, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2006-06-30 4:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Thu, 2006-06-29 at 23:57 -0400, Wendy Cheng wrote:
> This is "our" (server's) address, not peer address - for this request to
> arrive "here", it can't be INADDR_ANY. Can it ?
Consider the case of a UDP socket.
Cheers,
Trond
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 5:00 ` Neil Brown
0 siblings, 0 replies; 18+ messages in thread
From: Neil Brown @ 2006-06-30 4:59 UTC (permalink / raw)
To: Trond Myklebust; +Cc: cluster-devel, Lon Hohberger, nfs, Wendy Cheng
On Friday June 30, trond.myklebust@fys.uio.no wrote:
> On Fri, 2006-06-30 at 14:15 +1000, Neil Brown wrote:
>
> > The socket can only be bound to INADDR_ANY for UDP, and in that case
> > we already set rq_daddr correctly.
>
> As I understand it, Wendy is considering the case of a multi-homed
> server. She wants to record the IP address on which we received the
> datagram so that she knows which locks to invalidate in the case of a
> migration of that particular IP address onto another server.
>
> My point is that she won't get that information if the socket is bound
> to INADDR_ANY, as would be the case for a UDP socket.
Yes. But that code fragment covered the TCP case only.
The extra called to ->getname was placed in svc_recvfrom which is only
called from svc_tcp_recvfrom, not from svc_udp_recvfrom (Yes, I agree
there is room for confusion there).
svc_udp_recvfrom already has
rqstp->rq_addr.sin_addr.s_addr = skb->nh.iph->saddr;
rqstp->rq_daddr = skb->nh.iph->daddr;
so it sets rq_daddr correctly as each packet is received.
rq_daddr was never set for requests received via TCP because it was
never used for tcp (it was used only to set the source address for UDP
replies).
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release
@ 2006-06-30 5:00 ` Neil Brown
0 siblings, 0 replies; 18+ messages in thread
From: Neil Brown @ 2006-06-30 5:00 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Friday June 30, trond.myklebust at fys.uio.no wrote:
> On Fri, 2006-06-30 at 14:15 +1000, Neil Brown wrote:
>
> > The socket can only be bound to INADDR_ANY for UDP, and in that case
> > we already set rq_daddr correctly.
>
> As I understand it, Wendy is considering the case of a multi-homed
> server. She wants to record the IP address on which we received the
> datagram so that she knows which locks to invalidate in the case of a
> migration of that particular IP address onto another server.
>
> My point is that she won't get that information if the socket is bound
> to INADDR_ANY, as would be the case for a UDP socket.
Yes. But that code fragment covered the TCP case only.
The extra called to ->getname was placed in svc_recvfrom which is only
called from svc_tcp_recvfrom, not from svc_udp_recvfrom (Yes, I agree
there is room for confusion there).
svc_udp_recvfrom already has
rqstp->rq_addr.sin_addr.s_addr = skb->nh.iph->saddr;
rqstp->rq_daddr = skb->nh.iph->daddr;
so it sets rq_daddr correctly as each packet is received.
rq_daddr was never set for requests received via TCP because it was
never used for tcp (it was used only to set the source address for UDP
replies).
NeilBrown
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2006-06-30 5:00 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 18:11 [Cluster-devel] [RFC PATCH 1/3] NLM lock failover - lock release Wendy Cheng
2006-06-29 18:11 ` Wendy Cheng
2006-06-29 19:11 ` Chuck Lever
2006-06-29 19:11 ` [Cluster-devel] Re: [NFS] " Chuck Lever
2006-06-29 21:49 ` Wendy Cheng
2006-06-29 21:49 ` Wendy Cheng
2006-06-29 23:06 ` Trond Myklebust
2006-06-29 23:06 ` [Cluster-devel] Re: [NFS] " Trond Myklebust
2006-06-30 3:57 ` Wendy Cheng
2006-06-30 3:57 ` Wendy Cheng
2006-06-30 4:15 ` Neil Brown
2006-06-30 4:15 ` [Cluster-devel] Re: [NFS] " Neil Brown
2006-06-30 4:38 ` Trond Myklebust
2006-06-30 4:38 ` [Cluster-devel] Re: [NFS] " Trond Myklebust
2006-06-30 4:59 ` Neil Brown
2006-06-30 5:00 ` [Cluster-devel] Re: [NFS] " Neil Brown
2006-06-30 4:39 ` Trond Myklebust
2006-06-30 4:39 ` [Cluster-devel] Re: [NFS] " Trond Myklebust
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.