All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 1/4 Revised] NLM failover - nlm_unlock
@ 2006-09-14  4:44 ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-14  4:44 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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.

Relevant steps:
1) Exports filesystem with "fsid" option as:
   /etc/exports entry> /mnt/ext3/exports *(fsid=1234,sync,rw)
2) Drops locks based on fsid by:
   shell> echo 1234 > /proc/fs/nfsd/nlm_unlock

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/svcsubs.c          |   79 
+++++++++++++++++++++++++++++++++++++++++---
 fs/nfsd/nfsctl.c            |   42 +++++++++++++++++++++++
 include/linux/lockd/bind.h  |    5 ++
 include/linux/lockd/lockd.h |    2 +
 include/linux/nfsd/debug.h  |    1
 5 files changed, 124 insertions(+), 5 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfs_nlm_unlock.patch
Type: text/x-patch
Size: 7662 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20060914/f136d21c/attachment.bin>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/4 Revised] NLM failover - nlm_unlock
@ 2006-09-14  4:44 ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-14  4:44 UTC (permalink / raw)
  To: nfs, cluster-devel; +Cc: lhh

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

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.

Relevant steps:
1) Exports filesystem with "fsid" option as:
   /etc/exports entry> /mnt/ext3/exports *(fsid=1234,sync,rw)
2) Drops locks based on fsid by:
   shell> echo 1234 > /proc/fs/nfsd/nlm_unlock

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/svcsubs.c          |   79 
+++++++++++++++++++++++++++++++++++++++++---
 fs/nfsd/nfsctl.c            |   42 +++++++++++++++++++++++
 include/linux/lockd/bind.h  |    5 ++
 include/linux/lockd/lockd.h |    2 +
 include/linux/nfsd/debug.h  |    1
 5 files changed, 124 insertions(+), 5 deletions(-)


[-- Attachment #2: gfs_nlm_unlock.patch --]
[-- Type: text/x-patch, Size: 7662 bytes --]

--- linux-0/include/linux/lockd/lockd.h	2006-09-03 21:06:18.000000000 -0400
+++ linux-1/include/linux/lockd/lockd.h	2006-09-03 21:51:41.000000000 -0400
@@ -132,6 +132,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
@@ -195,6 +196,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(int *fsid);
 
 static __inline__ struct inode *
 nlmsvc_file_inode(struct nlm_file *file)
--- linux-0/fs/lockd/svcsubs.c	2006-09-03 21:06:17.000000000 -0400
+++ linux-1/fs/lockd/svcsubs.c	2006-09-13 13:48:01.000000000 -0400
@@ -19,6 +19,8 @@
 #include <linux/lockd/share.h>
 #include <linux/lockd/sm_inter.h>
 
+#include <linux/module.h>
+
 #define NLMDBG_FACILITY		NLMDBG_SVCSUBS
 
 
@@ -214,6 +216,37 @@ again:
 }
 
 /*
+ * Get fsid from nfs_fh:
+ * return 1 if *fsid contains a valid value.
+ */
+static inline int
+nlm_fo_get_fsid(struct nfs_fh *fh, int *fsid)
+{
+	struct nfs_fhbase_new *fh_base = (struct nfs_fhbase_new *) fh->data;
+ 	int data_left = fh->size/4;
+ 
+ 	nlm_debug_print_fh("nlm_fo_find_fsid", fh);
+ 
+ 	/* From fb_version to fb_auth - at least two u32 */
+ 	if (data_left < 2)		
+ 		return 0;
+  
+ 	/* For various types, check out 
+ 	 * inlcude/linux/nfsd/nfsfsh.h
+ 	 */
+ 	if ((fh_base->fb_version != 1) ||  
+ 		(fh_base->fb_auth_type != 0) ||
+ 		(fh_base->fb_fsid_type != 1))
+ 		return 0;
+ 
+ 	/* The fb_auth is 0 bytes long - imply fb_auth[0] has
+ 	 * fsid value.
+ 	 */
+ 	*fsid = (int) fh_base->fb_auth[0];
+ 	return 1;
+}
+
+/*
  * Operate on a single file
  */
 static inline int
@@ -234,21 +267,42 @@ 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, int *fsidp, int action)
 {
 	struct nlm_file	*file, **fp;
-	int i, ret = 0;
+	int i, ret = 0, found, fsid_in=0, fsid, act=action;
 
 	mutex_lock(&nlm_file_mutex);
+	if (unlikely(action == NLM_ACT_FO_UNLOCK)) {
+		BUG_ON(fsidp == NULL);
+		fsid_in = *fsidp;
+	}
 	for (i = 0; i < FILE_NRHASH; i++) {
 		fp = nlm_files + i;
 		while ((file = *fp) != NULL) {
 			file->f_count++;
 			mutex_unlock(&nlm_file_mutex);
 
+			/*
+ 		 	 * NLM lock failover:
+ 		 	 *      Upon NLM_ACT_FO_UNLOCK, obtain fsid from
+ 		 	 *      f_handle. If match is found, the lock will 
+ 			 *	be released via NLM_ACT_UNLOCK.
+ 		 	 */
+ 			if (unlikely(action == NLM_ACT_FO_UNLOCK)) {
+ 				found = nlm_fo_get_fsid(&file->f_handle, &fsid);
+ 				if (!found || (fsid != fsid_in)) {
+ 					fp = &file->f_next;
+ 					continue;
+ 				}
+ 				dprintk("lockd: drop lock file=%p fsid=%d\n", 
+ 					 file, fsid);
+ 				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))
 				ret = 1;
 
 			mutex_lock(&nlm_file_mutex);
@@ -256,6 +310,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=%p\n", 
+					 file);
 				*fp = file->f_next;
 				nlmsvc_ops->fclose(file->f_file);
 				kfree(file);
@@ -303,7 +359,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);
 }
 
 /*
@@ -314,7 +370,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);
@@ -334,3 +390,16 @@ nlmsvc_invalidate_all(void)
 		nlm_release_host(host);
 	}
 }
+
+EXPORT_SYMBOL(nlmsvc_fo_unlock);
+
+/*
+ * release locks associated with an export fsid upon failover
+ */
+int
+nlmsvc_fo_unlock(int *fsid)
+{
+	/* drop the locks */
+	return (nlm_traverse_files(NULL, fsid, NLM_ACT_FO_UNLOCK)); 
+}
+
--- linux-0/include/linux/lockd/bind.h	2006-09-03 21:06:18.000000000 -0400
+++ linux-1/include/linux/lockd/bind.h	2006-09-03 21:51:41.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(int *fsid);
+
 #endif /* LINUX_LOCKD_BIND_H */
--- linux-0/fs/nfsd/nfsctl.c	2006-09-03 21:06:17.000000000 -0400
+++ linux-1/fs/nfsd/nfsctl.c	2006-09-03 21:51:40.000000000 -0400
@@ -33,6 +33,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;
@@ -51,6 +55,7 @@ enum {
 	NFSD_Getfs,
 	NFSD_List,
 	NFSD_Fh,
+	NFSD_NlmUnlock,
 	NFSD_Threads,
 	NFSD_Versions,
 	/*
@@ -81,6 +86,14 @@ static ssize_t write_leasetime(struct fi
 static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
 #endif
 
+/*
+ * NLM lock failover
+ */
+
+#define NFSDDBG_FACILITY	NFSDDBG_CLUSTER
+
+static ssize_t write_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,
@@ -90,6 +103,7 @@ static ssize_t (*write_op[])(struct file
 	[NFSD_Getfd] = write_getfd,
 	[NFSD_Getfs] = write_getfs,
 	[NFSD_Fh] = write_filehandle,
+	[NFSD_NlmUnlock] = write_fo_unlock,
 	[NFSD_Threads] = write_threads,
 	[NFSD_Versions] = write_versions,
 #ifdef CONFIG_NFSD_V4
@@ -334,6 +348,33 @@ static ssize_t write_filehandle(struct f
 	return mesg - buf;	
 }
 
+static ssize_t write_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: write_fo_unlock invalid fsid(%s)\n", buf);
+		return rc;
+	}
+
+	/* call nlm to release the locks - fsid is passed by reference 
+	 * to allow other routine uses NULL pointer. */
+	rc = nlmsvc_fo_unlock(&fsid);
+	if (rc) {
+		dprintk("nfsd: nlmsvc_fo_unlock return rc=%d\n", rc);
+		return rc;
+	}
+
+	/* done */
+	sprintf(buf, "nlm_fo fsid=%d released locks\n", fsid);
+	return strlen(buf);
+}
+
 extern int nfsd_nrthreads(void);
 
 static ssize_t write_threads(struct file *file, char *buf, size_t size)
@@ -482,6 +523,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_NlmUnlock] = {"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
--- linux-0/include/linux/nfsd/debug.h	2006-09-03 21:06:18.000000000 -0400
+++ linux-1/include/linux/nfsd/debug.h	2006-09-03 21:51:41.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
 

[-- Attachment #3: Type: text/plain, Size: 373 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] 30+ messages in thread

* [Cluster-devel] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2006-09-14  4:48 ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-14  4:48 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This change enables per NFS-export entry lockd grace period. The 
implementation is based on a double linked list fo_fsid_list that 
contains entries of fsid info. It is expected this would not be a 
frequent event. The fo_fsid_list is short and the entries expire within 
a maximum of 50 seconds.  The grace period setting follows the existing 
NLM grace period handling logic and is triggered via echoing the NFS 
export filesystem id into nfsd procfs entry as:

shell> echo 1234 > /proc/fs/nfsd/nlm_set_igrace

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/svc.c              |    8 +
 fs/lockd/svc4proc.c         |   28 +++++-
 fs/lockd/svcproc.c          |   29 +++++--
 fs/lockd/svcsubs.c          |  180 
++++++++++++++++++++++++++++++++++++++++++++
 fs/nfsd/nfsctl.c            |   32 +++++++
 include/linux/lockd/bind.h  |    3
 include/linux/lockd/lockd.h |   14 +++
 7 files changed, 279 insertions(+), 15 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfs_nlm_igrace.patch
Type: text/x-patch
Size: 15444 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20060914/3cf5f3ed/attachment.bin>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2006-09-14  4:48 ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-14  4:48 UTC (permalink / raw)
  To: nfs, cluster-devel; +Cc: lhh

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

This change enables per NFS-export entry lockd grace period. The 
implementation is based on a double linked list fo_fsid_list that 
contains entries of fsid info. It is expected this would not be a 
frequent event. The fo_fsid_list is short and the entries expire within 
a maximum of 50 seconds.  The grace period setting follows the existing 
NLM grace period handling logic and is triggered via echoing the NFS 
export filesystem id into nfsd procfs entry as:

shell> echo 1234 > /proc/fs/nfsd/nlm_set_igrace

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/svc.c              |    8 +
 fs/lockd/svc4proc.c         |   28 +++++-
 fs/lockd/svcproc.c          |   29 +++++--
 fs/lockd/svcsubs.c          |  180 
++++++++++++++++++++++++++++++++++++++++++++
 fs/nfsd/nfsctl.c            |   32 +++++++
 include/linux/lockd/bind.h  |    3
 include/linux/lockd/lockd.h |   14 +++
 7 files changed, 279 insertions(+), 15 deletions(-)


[-- Attachment #2: gfs_nlm_igrace.patch --]
[-- Type: text/x-patch, Size: 15444 bytes --]

--- linux-1/include/linux/lockd/lockd.h	2006-09-03 21:51:41.000000000 -0400
+++ linux-2/include/linux/lockd/lockd.h	2006-09-13 22:48:00.000000000 -0400
@@ -107,6 +107,17 @@ struct nlm_file {
 	int		       	f_hash;		/* hash of f_handle */
 };
 
+#define NLM_FO_MAX_FSID_GP	127
+
+/* Server fsid linked list for NLM lock failover */
+struct fo_fsid {
+	struct list_head	g_list;		/* linked list */
+	unsigned long		g_expire;	/* when this grace period
+						 * will expire */
+	int			g_fsid;		/* exported fsid */
+	int			g_flag;		/* printk flag */
+};
+
 /*
  * This is a server block (i.e. a lock requested by some client which
  * couldn't be granted because of a conflicting lock).
@@ -187,6 +198,8 @@ void		  nlmsvc_traverse_blocks(struct nl
 					int action);
 void	  nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32);
 
+unsigned long set_grace_period(void); /*required by svcsubs.c and svc.c 
+					to support nlm failover */
 /*
  * File handling for the server personality
  */
@@ -197,6 +210,7 @@ void		  nlmsvc_mark_resources(void);
 void		  nlmsvc_free_host_resources(struct nlm_host *);
 void		  nlmsvc_invalidate_all(void);
 int 		  nlmsvc_fo_unlock(int *fsid);
+int 		  nlmsvc_fo_check(struct nfs_fh *fh);
 
 static __inline__ struct inode *
 nlmsvc_file_inode(struct nlm_file *file)
--- linux-1/fs/lockd/svcsubs.c	2006-09-13 13:48:01.000000000 -0400
+++ linux-2/fs/lockd/svcsubs.c	2006-09-13 22:50:51.000000000 -0400
@@ -32,6 +32,13 @@
 static struct nlm_file *	nlm_files[FILE_NRHASH];
 static DEFINE_MUTEX(nlm_file_mutex);
 
+/* 
+ * Global control structure for lock failover 
+ */
+static spinlock_t nlm_fo_lock=SPIN_LOCK_UNLOCKED;
+static int fo_fsid_cnt=0;
+LIST_HEAD(fo_fsid_list);
+
 #ifdef NFSD_DEBUG
 static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
 {
@@ -403,3 +410,176 @@ nlmsvc_fo_unlock(int *fsid)
 	return (nlm_traverse_files(NULL, fsid, NLM_ACT_FO_UNLOCK)); 
 }
 
+EXPORT_SYMBOL(nlmsvc_fo_setgrace);
+
+/*
+ * Add fsid into global fo_fsid_list (single linked list).
+ *
+ * Note that if this routine is repeatedly called with the very 
+ * same fsid, we could end up with multiple fsid in the global 
+ * fo_fsid_list. Instead of searching thru the list to purge old
+ * entries (to make the code un-necessarily complicated), we 
+ * will just leave the old entries there because the list is
+ * searched in top-down order (newer entry first). As soon as one 
+ * is found, the search stops. This implies the older entries will 
+ * not be used and always expire before new entry.    
+ *
+ * As an admin interface, the list is expected to be short and 
+ * entries are purged (expired) quickly.
+ *
+ * Also, please don't ask why using opencoded list manipulation, 
+ * instead of <linux/list.h>, unless you can point to me where
+ * in that file have existing macro and/or functions that can do
+ * single linked list. 
+ */
+int
+nlmsvc_fo_setgrace(int fsid)
+{
+	struct list_head *p, *tlist;
+	struct fo_fsid *per_fsid, *entry;
+	int done=0;
+
+	/* allocate the entry */
+	per_fsid = kmalloc(sizeof(struct fo_fsid), GFP_KERNEL);
+	if (per_fsid == NULL) {
+		printk("lockd: nlmsvc_fo_setgrace kmalloc fails\n");
+		return(-ENOMEM);
+	}
+
+	/* debug printk */
+	dprintk("lockd: nlmsvc_fo_setgrace fsid=%d jiffies=%lu\n", 
+		fsid, jiffies);
+
+	/* fill in info */
+	per_fsid->g_expire = set_grace_period();
+	per_fsid->g_fsid   = fsid;
+	per_fsid->g_flag   = 0;
+
+	spin_lock(&nlm_fo_lock);
+
+	if (list_empty(&fo_fsid_list)) {
+		list_add(&per_fsid->g_list, &fo_fsid_list);
+		fo_fsid_cnt = 1;
+		done = 1;
+		goto nlmsvc_fo_setgrace_out;
+	} else if (fo_fsid_cnt > NLM_FO_MAX_FSID_GP) {
+                kfree(per_fsid);
+                printk("lockd: fo_setgrace max cnt reached fsid=%d not added\n",                        fsid);
+                goto nlmsvc_fo_setgrace_out;
+        }
+
+	list_for_each_safe(p, tlist, &fo_fsid_list) {
+		entry = list_entry(p, struct fo_fsid, g_list);
+		if (!done) {
+			/* add the new fsid into the list */
+			if (entry->g_expire <= per_fsid->g_expire) {
+				list_add(&per_fsid->g_list, &entry->g_list);
+				fo_fsid_cnt++;
+				done = 1;
+			}
+		}
+		if (done && (entry->g_fsid == fsid)) {
+			/* multiple fsid(s) */
+			BUG_ON(entry->g_expire > per_fsid->g_expire); 
+			list_del(p); 
+			fo_fsid_cnt--;
+			kfree(entry);
+		} else if (time_before(entry->g_expire, jiffies)) {
+			/* garbage collection */
+			printk("nlmsvc fo_fsid = %d expires\n", entry->g_fsid);
+			list_del(p);
+			fo_fsid_cnt--;
+			kfree(entry);
+		} 
+	}
+	
+nlmsvc_fo_setgrace_out:
+
+	spin_unlock(&nlm_fo_lock);
+
+	/* debug */
+	if (done)
+		printk("nlmsvc fo setgrace: fsid=%d, jiffies=%lu, expire=%lu\n",
+			per_fsid->g_fsid, jiffies, per_fsid->g_expire);
+	else
+		printk("nlmsvc_fo_setgrace: adding fsid=%d fails\n", fsid);
+
+	return 0;
+}
+
+/* 
+ * Reset global fo_fsid_list list 
+ */
+void 
+nlmsvc_fo_reset_servs()
+{
+	struct fo_fsid *e_purge;
+	struct list_head *p, *tlist;
+
+	spin_lock(&nlm_fo_lock);
+
+	/* nothing to do */
+	if (list_empty(&fo_fsid_list)) {
+		spin_unlock(&nlm_fo_lock);
+		return;
+	}
+
+	dprintk("lockd: nlmsvc_fo_reset fo_fsid_list\n");
+
+	/* purge the entries */
+	list_for_each_safe(p, tlist, &fo_fsid_list) {
+		e_purge = list_entry(p, struct fo_fsid, g_list);
+		list_del(p);
+		kfree(e_purge);
+	}
+	fo_fsid_cnt = 0;
+
+	spin_unlock(&nlm_fo_lock);
+}
+
+/*
+ * Check whether the fsid is in the failover list: fo_fsid_list.
+ *	return TRUE (1) if fsid in nlm_serv.
+ */
+int
+nlmsvc_fo_check(struct nfs_fh *fh)
+{
+	struct fo_fsid *e_this;
+	struct list_head *p, *tlist;
+	int rc=0, this_fsid;
+
+	/* see if this fh has fsid */
+	if (!nlm_fo_get_fsid(fh, &this_fsid)) {
+		return 0;
+	}
+
+	spin_lock(&nlm_fo_lock);
+
+	/* no failover entry */
+	if (list_empty(&fo_fsid_list))  
+		goto nlmsvc_fo_check_out;
+
+	/* check to see whether this_fsid is in fo_fsid_list list */
+	list_for_each_safe(p, tlist, &fo_fsid_list) {
+		e_this = list_entry(p, struct fo_fsid, g_list);
+		if (time_before(e_this->g_expire, jiffies)) {
+			printk("lockd: fsid=%d grace period expires\n",
+				e_this->g_fsid);
+			list_del(p);
+			fo_fsid_cnt--;
+			kfree(e_this);
+		} else if (e_this->g_fsid == this_fsid) {
+			if (!e_this->g_flag) {
+				e_this->g_flag = 1;
+				printk("lockd: fsid=%d in grace period\n",
+					e_this->g_fsid);
+			}
+			rc = 1;
+		}
+	}
+
+nlmsvc_fo_check_out:
+	spin_unlock(&nlm_fo_lock);
+	return rc;
+}
+
--- linux-1/include/linux/lockd/bind.h	2006-09-03 21:51:41.000000000 -0400
+++ linux-2/include/linux/lockd/bind.h	2006-09-11 16:52:34.000000000 -0400
@@ -37,5 +37,8 @@ extern void	lockd_down(void);
  * NLM failover
  */
 extern int     nlmsvc_fo_unlock(int *fsid);
+extern int     nlmsvc_fo_setgrace(int fsid);
+extern void    nlmsvc_fo_reset_servs(void);
+
 
 #endif /* LINUX_LOCKD_BIND_H */
--- linux-1/fs/nfsd/nfsctl.c	2006-09-03 21:51:40.000000000 -0400
+++ linux-2/fs/nfsd/nfsctl.c	2006-09-11 16:52:25.000000000 -0400
@@ -56,6 +56,7 @@ enum {
 	NFSD_List,
 	NFSD_Fh,
 	NFSD_NlmUnlock,
+	NFSD_NlmIgrace,
 	NFSD_Threads,
 	NFSD_Versions,
 	/*
@@ -93,6 +94,7 @@ static ssize_t write_recoverydir(struct 
 #define NFSDDBG_FACILITY	NFSDDBG_CLUSTER
 
 static ssize_t write_fo_unlock(struct file *file, char *buf, size_t size);
+static ssize_t write_fo_grace(struct file *file, char *buf, size_t size);
 
 static ssize_t (*write_op[])(struct file *, char *, size_t) = {
 	[NFSD_Svc] = write_svc,
@@ -104,6 +106,7 @@ static ssize_t (*write_op[])(struct file
 	[NFSD_Getfs] = write_getfs,
 	[NFSD_Fh] = write_filehandle,
 	[NFSD_NlmUnlock] = write_fo_unlock,
+	[NFSD_NlmIgrace] = write_fo_grace,
 	[NFSD_Threads] = write_threads,
 	[NFSD_Versions] = write_versions,
 #ifdef CONFIG_NFSD_V4
@@ -375,6 +378,34 @@ static ssize_t write_fo_unlock(struct fi
 	return strlen(buf);
 }
 
+static ssize_t write_fo_grace(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("do_nlm_fsid_grace: invalid fsid (%s)\n", buf);
+		return rc;
+	}
+ 
+	/* call nlm to set the grace period */
+	rc = nlmsvc_fo_setgrace(fsid);
+	if (rc) {
+		dprintk("nlmsvc_fo_setgrace return rc=%d\n", rc);
+		return rc;
+	}
+ 
+	dprintk("nlm set fsid=%d grace period\n", fsid);
+ 
+	/* done */
+	sprintf(buf, "nlm set per fsid=%d grace period\n", fsid);
+	return strlen(buf);
+}
+
 extern int nfsd_nrthreads(void);
 
 static ssize_t write_threads(struct file *file, char *buf, size_t size)
@@ -524,6 +555,7 @@ static int nfsd_fill_super(struct super_
 		[NFSD_List] = {"exports", &exports_operations, S_IRUGO},
 		[NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_NlmUnlock] = {"nlm_unlock", &transaction_ops, S_IWUSR|S_IRUSR},
+		[NFSD_NlmIgrace] = {"nlm_set_igrace", &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
--- linux-1/fs/lockd/svc4proc.c	2006-09-13 13:49:35.000000000 -0400
+++ linux-2/fs/lockd/svc4proc.c	2006-09-13 14:03:39.000000000 -0400
@@ -18,9 +18,22 @@
 #include <linux/lockd/share.h>
 #include <linux/lockd/sm_inter.h>
 
-
 #define NLMDBG_FACILITY		NLMDBG_CLIENT
 
+extern struct list_head fo_fsid_list;
+
+/* 
+ * Check for per filesystem failover grace period 
+ */
+static inline int
+nlm4svc_fo_grace_period(struct nlm_args *argp) 
+{
+	if (unlikely(!list_empty(&fo_fsid_list)))
+		return(nlmsvc_fo_check(&argp->lock.fh));
+
+	return 0;
+}
+
 /*
  * Obtain client and file from arguments
  */
@@ -89,7 +102,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp
 	resp->cookie = argp->cookie;
 
 	/* Don't accept test requests during grace period */
-	if (nlmsvc_grace_period) {
+	if ((nlmsvc_grace_period) || (nlm4svc_fo_grace_period(argp))) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -119,7 +132,8 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if ((nlmsvc_grace_period || (nlm4svc_fo_grace_period(argp))) 
+			&& !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -162,7 +176,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqs
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if ((nlmsvc_grace_period || (nlm4svc_fo_grace_period(argp)))) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -195,7 +209,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqs
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_grace_period || (nlm4svc_fo_grace_period(argp))) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -330,7 +344,7 @@ nlm4svc_proc_share(struct svc_rqst *rqst
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if ((nlmsvc_grace_period ||(nlm4svc_fo_grace_period(argp))) && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -363,7 +377,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rq
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_grace_period || (nlm4svc_fo_grace_period(argp))) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
--- linux-1/fs/lockd/svcproc.c	2006-09-03 21:51:39.000000000 -0400
+++ linux-2/fs/lockd/svcproc.c	2006-09-13 13:51:59.000000000 -0400
@@ -50,6 +50,21 @@ cast_to_nlm(u32 status, u32 vers)
 #endif
 
 /*
+ * Check for per filesystem failover grace period 
+ */
+
+extern struct list_head fo_fsid_list;
+
+int inline
+nlmsvc_fo_grace_period(struct nlm_args *argp)
+{
+	if (unlikely(!list_empty(&fo_fsid_list)))
+		return(nlmsvc_fo_check(&argp->lock.fh));
+
+	return 0;
+}
+
+/*
  * Obtain client and file from arguments
  */
 static u32
@@ -115,7 +130,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp,
 	resp->cookie = argp->cookie;
 
 	/* Don't accept test requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_grace_period || (nlmsvc_fo_grace_period(argp))) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -146,7 +161,8 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp,
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if ((nlmsvc_grace_period || (nlmsvc_fo_grace_period(argp))) 
+			&& !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -189,7 +205,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqst
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_grace_period || nlmsvc_fo_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -222,7 +238,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqst
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_grace_period || nlmsvc_fo_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -359,7 +375,8 @@ nlmsvc_proc_share(struct svc_rqst *rqstp
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if ((nlmsvc_grace_period || (nlmsvc_fo_grace_period(argp))) 
+			&& !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -392,7 +409,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqs
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_grace_period || nlmsvc_fo_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
--- linux-1/fs/lockd/svc.c	2006-09-03 21:51:39.000000000 -0400
+++ linux-2/fs/lockd/svc.c	2006-09-11 16:51:58.000000000 -0400
@@ -71,7 +71,7 @@ static const int		nlm_port_min = 0, nlm_
 
 static struct ctl_table_header * nlm_sysctl_table;
 
-static unsigned long set_grace_period(void)
+unsigned long set_grace_period(void)
 {
 	unsigned long grace_period;
 
@@ -81,7 +81,6 @@ static unsigned long set_grace_period(vo
 				/ nlm_timeout) * nlm_timeout * HZ;
 	else
 		grace_period = nlm_timeout * 5 * HZ;
-	nlmsvc_grace_period = 1;
 	return grace_period + jiffies;
 }
 
@@ -129,6 +128,8 @@ lockd(struct svc_rqst *rqstp)
 	nlmsvc_timeout = nlm_timeout * HZ;
 
 	grace_period_expire = set_grace_period();
+	nlmsvc_grace_period = 1;
+	(void) nlmsvc_fo_reset_servs();
 
 	/*
 	 * The main request loop. We don't terminate until the last
@@ -143,6 +144,8 @@ lockd(struct svc_rqst *rqstp)
 			if (nlmsvc_ops) {
 				nlmsvc_invalidate_all();
 				grace_period_expire = set_grace_period();
+				nlmsvc_grace_period = 1;
+				(void) nlmsvc_fo_reset_servs();
 			}
 		}
 
@@ -189,6 +192,7 @@ lockd(struct svc_rqst *rqstp)
 			nlmsvc_invalidate_all();
 		nlm_shutdown_hosts();
 		nlmsvc_pid = 0;
+		(void) nlmsvc_fo_reset_servs();
 	} else
 		printk(KERN_DEBUG
 			"lockd: new process, skipping host shutdown\n");

[-- Attachment #3: Type: text/plain, Size: 373 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] 30+ messages in thread

* [Cluster-devel] [PATCH 3/4 Revised] NLM failover - statd changes
@ 2006-09-14  4:50 ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-14  4:50 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This kernel patch should be paired with nfs-utils user mode changes (in 
patch 4-4 based on nfs-utils-1.0.8-rc4) that is optional. If changes 
made in patch 4-4 is not presented in nfs-utils, the rpc.statd will 
ignore whatever this kernel patch does.

The changes record the ip interface that accepts the lock requests and 
passes the correct "my_name" (in standard IPV4 dot notation) to user 
mode statd (instead of system_utsname.nodename). This enables rpc.statd 
to add the correct taken-over IPv4 address into the 3rd parameter of 
ha_callout program. Current nfs-utils always resets "my_name" into 
loopback address (127.0.0.1), regardless the statement made in rpc.statd 
man page. Check out "man rpc.statd" for details.

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/host.c                |    4 ++--
 fs/lockd/mon.c                 |   21 +++++++++++++++++----
 fs/lockd/svc4proc.c            |    8 +++++++-
 fs/lockd/svcproc.c             |    2 +-
 include/linux/lockd/lockd.h    |    5 +++--
 include/linux/lockd/sm_inter.h |    1 +
 include/linux/sunrpc/svc.h     |    5 +++--
 net/sunrpc/svcsock.c           |    5 +++++
 8 files changed, 39 insertions(+), 12 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfs_statd.patch
Type: text/x-patch
Size: 6714 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20060914/282cca28/attachment.bin>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 3/4 Revised] NLM failover - statd changes
@ 2006-09-14  4:50 ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-14  4:50 UTC (permalink / raw)
  To: nfs, cluster-devel; +Cc: lhh

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

This kernel patch should be paired with nfs-utils user mode changes (in 
patch 4-4 based on nfs-utils-1.0.8-rc4) that is optional. If changes 
made in patch 4-4 is not presented in nfs-utils, the rpc.statd will 
ignore whatever this kernel patch does.

The changes record the ip interface that accepts the lock requests and 
passes the correct "my_name" (in standard IPV4 dot notation) to user 
mode statd (instead of system_utsname.nodename). This enables rpc.statd 
to add the correct taken-over IPv4 address into the 3rd parameter of 
ha_callout program. Current nfs-utils always resets "my_name" into 
loopback address (127.0.0.1), regardless the statement made in rpc.statd 
man page. Check out "man rpc.statd" for details.

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/host.c                |    4 ++--
 fs/lockd/mon.c                 |   21 +++++++++++++++++----
 fs/lockd/svc4proc.c            |    8 +++++++-
 fs/lockd/svcproc.c             |    2 +-
 include/linux/lockd/lockd.h    |    5 +++--
 include/linux/lockd/sm_inter.h |    1 +
 include/linux/sunrpc/svc.h     |    5 +++--
 net/sunrpc/svcsock.c           |    5 +++++
 8 files changed, 39 insertions(+), 12 deletions(-)



[-- Attachment #2: gfs_statd.patch --]
[-- Type: text/x-patch, Size: 6714 bytes --]

--- linux-2/include/linux/sunrpc/svc.h	2006-09-11 16:52:34.000000000 -0400
+++ linux-3/include/linux/sunrpc/svc.h	2006-09-13 14:07:32.000000000 -0400
@@ -102,6 +102,7 @@ static inline void svc_putu32(struct kve
 	iov->iov_len += sizeof(u32);
 }
 
+typedef __u32  svc_addr_t;
 	
 /*
  * The context of a single thread, including the request currently being
@@ -138,8 +139,8 @@ struct svc_rqst {
 	unsigned short
 				rq_secure  : 1;	/* secure port */
 
-
-	__u32			rq_daddr;	/* dest addr of request - reply from here */
+	svc_addr_t		rq_daddr;	/* dest addr of request 
+						   - reply from here */
 
 	void *			rq_argp;	/* decoded arguments */
 	void *			rq_resp;	/* xdr'd results */
--- linux-2/include/linux/lockd/lockd.h	2006-09-13 22:48:00.000000000 -0400
+++ linux-3/include/linux/lockd/lockd.h	2006-09-13 22:51:41.000000000 -0400
@@ -39,12 +39,13 @@
 struct nlm_host {
 	struct nlm_host *	h_next;		/* linked list (hash table) */
 	struct sockaddr_in	h_addr;		/* peer address */
+	svc_addr_t		h_server;	/* server ip for NLM failover */
 	struct rpc_clnt	*	h_rpcclnt;	/* RPC client to talk to peer */
 	char			h_name[20];	/* 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_notused    : 1, 
 				h_inuse      : 1,
 				h_killed     : 1,
 				h_monitored  : 1;
@@ -175,7 +176,7 @@ int		  nlmclnt_reclaim(struct nlm_host *
  */
 struct nlm_host * nlmclnt_lookup_host(struct sockaddr_in *, int, int);
 struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *);
-struct nlm_host * nlm_lookup_host(int server, struct sockaddr_in *, int, int);
+struct nlm_host * nlm_lookup_host(svc_addr_t server, struct sockaddr_in *, int, int);
 struct rpc_clnt * nlm_bind_host(struct nlm_host *);
 void		  nlm_rebind_host(struct nlm_host *);
 struct nlm_host * nlm_get_host(struct nlm_host *);
--- linux-2/include/linux/lockd/sm_inter.h	2006-09-11 16:52:34.000000000 -0400
+++ linux-3/include/linux/lockd/sm_inter.h	2006-09-13 14:07:32.000000000 -0400
@@ -25,6 +25,7 @@
  */
 struct nsm_args {
 	u32		addr;		/* remote address */
+	u32		serv;		/* server ip address */
 	u32		prog;		/* RPC callback info */
 	u32		vers;
 	u32		proc;
--- linux-2/net/sunrpc/svcsock.c	2006-09-11 16:50:47.000000000 -0400
+++ linux-3/net/sunrpc/svcsock.c	2006-09-13 14:05:40.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/fs/lockd/svc4proc.c	2006-09-13 14:03:39.000000000 -0400
+++ linux-3/fs/lockd/svc4proc.c	2006-09-13 14:16:54.000000000 -0400
@@ -138,6 +138,12 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp
 		return rpc_success;
 	}
 
+#if 0
+	if (argp->reclaim) {
+		printk("nlm4svc_proc_lock lock reclaim received\n");
+	}
+#endif
+
 	/* Obtain client and file */
 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
 		return rpc_success;
@@ -462,7 +468,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *
 	} else {
 		/* If we run on an NFS server, delete all locks held by the client */
 
-		if ((host = nlm_lookup_host(1, &saddr, prot, vers)) != NULL) {
+		if ((host = nlm_lookup_host(rqstp->rq_daddr, &saddr, prot, vers)) != NULL) {
 			nlmsvc_free_host_resources(host);
 			nlm_release_host(host);
 		}
--- linux-2/fs/lockd/svcproc.c	2006-09-13 13:51:59.000000000 -0400
+++ linux-3/fs/lockd/svcproc.c	2006-09-13 14:06:58.000000000 -0400
@@ -491,7 +491,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *r
 		}
 	} else {
 		/* If we run on an NFS server, delete all locks held by the client */
-		if ((host = nlm_lookup_host(1, &saddr, prot, vers)) != NULL) {
+		if ((host = nlm_lookup_host(rqstp->rq_daddr, &saddr, prot, vers)) != NULL) {
 			nlmsvc_free_host_resources(host);
 			nlm_release_host(host);
 		}
--- linux-2/fs/lockd/mon.c	2006-09-11 16:51:58.000000000 -0400
+++ linux-3/fs/lockd/mon.c	2006-09-13 14:06:59.000000000 -0400
@@ -47,7 +47,8 @@ nsm_mon_unmon(struct nlm_host *host, u32
 	}
 
 	args.addr = host->h_addr.sin_addr.s_addr;
-	args.proto= (host->h_proto<<1) | host->h_server;
+	args.serv = host->h_server;
+	args.proto= (host->h_proto<<1) | (host->h_server ? 1:0);
 	args.prog = NLM_PROGRAM;
 	args.vers = host->h_version;
 	args.proc = NLMPROC_NSM_NOTIFY;
@@ -135,6 +136,13 @@ out_err:
 	return clnt;
 }
 
+/* We want "buffer" in xdr_encode_common() to hold
+ * either the system_utsname.nodename string (__NEW_UTS_LEN+1)
+ * or IPv4 dot notation (16 bytes+1) for now.
+ */ 
+
+#define	XDR_ENCODE_BUF_LEN __NEW_UTS_LEN+1	
+
 /*
  * XDR functions for NSM.
  */
@@ -142,7 +150,7 @@ out_err:
 static u32 *
 xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
 {
-	char	buffer[20];
+	char	buffer[XDR_ENCODE_BUF_LEN];
 
 	/*
 	 * Use the dotted-quad IP address of the remote host as
@@ -151,8 +159,13 @@ xdr_encode_common(struct rpc_rqst *rqstp
 	 * so this works alright.
 	 */
 	sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr));
-	if (!(p = xdr_encode_string(p, buffer))
-	 || !(p = xdr_encode_string(p, system_utsname.nodename)))
+	if (!(p = xdr_encode_string(p, buffer)))
+		return ERR_PTR(-EIO);
+	if (argp->serv)
+		sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->serv));
+	else
+		sprintf(buffer, "%s", system_utsname.nodename);
+	if (!(p = xdr_encode_string(p, buffer)))
 		return ERR_PTR(-EIO);
 	*p++ = htonl(argp->prog);
 	*p++ = htonl(argp->vers);
--- linux-2/fs/lockd/host.c	2006-09-11 16:51:58.000000000 -0400
+++ linux-3/fs/lockd/host.c	2006-09-13 14:06:59.000000000 -0400
@@ -51,7 +51,7 @@ nlmclnt_lookup_host(struct sockaddr_in *
 struct nlm_host *
 nlmsvc_lookup_host(struct svc_rqst *rqstp)
 {
-	return nlm_lookup_host(1, &rqstp->rq_addr,
+	return nlm_lookup_host(rqstp->rq_daddr, &rqstp->rq_addr,
 			       rqstp->rq_prot, rqstp->rq_vers);
 }
 
@@ -59,7 +59,7 @@ nlmsvc_lookup_host(struct svc_rqst *rqst
  * Common host lookup routine for server & client
  */
 struct nlm_host *
-nlm_lookup_host(int server, struct sockaddr_in *sin,
+nlm_lookup_host(svc_addr_t server, struct sockaddr_in *sin,
 					int proto, int version)
 {
 	struct nlm_host	*host, **hp;

[-- Attachment #3: Type: text/plain, Size: 373 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] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 1/4 Revised] NLM failover - nlm_unlock
  2006-09-14  4:44 ` Wendy Cheng
@ 2006-09-26  0:39     ` Neil Brown
  -1 siblings, 0 replies; 30+ messages in thread
From: Neil Brown @ 2006-09-26  0:39 UTC (permalink / raw)
  To: cluster-devel.redhat.com


Firstly, sorry for the delay in responding to these.


On Thursday September 14, wcheng at redhat.com 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.
> 
> Relevant steps:
> 1) Exports filesystem with "fsid" option as:
>    /etc/exports entry> /mnt/ext3/exports *(fsid=1234,sync,rw)
> 2) Drops locks based on fsid by:
>    shell> echo 1234 > /proc/fs/nfsd/nlm_unlock

I actually felt a bit more comfortable with the server-ip based
approach, how I cannot really fault the fsid based approach, and it
does seem to have some advantages, so I guess we go with it.

>  /*
> + * Get fsid from nfs_fh:
> + * return 1 if *fsid contains a valid value.
> + */
> +static inline int
> +nlm_fo_get_fsid(struct nfs_fh *fh, int *fsid)
> +{
> +	struct nfs_fhbase_new *fh_base = (struct nfs_fhbase_new *) fh->data;
> + 	int data_left = fh->size/4;
> + 
> + 	nlm_debug_print_fh("nlm_fo_find_fsid", fh);
> + 
> + 	/* From fb_version to fb_auth - at least two u32 */
> + 	if (data_left < 2)		
> + 		return 0;
> +  
> + 	/* For various types, check out 
> + 	 * inlcude/linux/nfsd/nfsfsh.h
> + 	 */
> + 	if ((fh_base->fb_version != 1) ||  
> + 		(fh_base->fb_auth_type != 0) ||
> + 		(fh_base->fb_fsid_type != 1))
> + 		return 0;
> + 
> + 	/* The fb_auth is 0 bytes long - imply fb_auth[0] has
> + 	 * fsid value.
> + 	 */
> + 	*fsid = (int) fh_base->fb_auth[0];
> + 	return 1;
> +}

It would be really nice if this could be in the nfsd code rather than
in the lockd code.  Maybe if the nlm_fopen call passed back the fsid?

> +
> +/*
>   * Operate on a single file
>   */
>  static inline int
> @@ -234,21 +267,42 @@ 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, int *fsidp, int action)
>  {
>  	struct nlm_file	*file, **fp;
> -	int i, ret = 0;
> +	int i, ret = 0, found, fsid_in=0, fsid, act=action;

Unfortunately all of this will have to change due to Olaf's recent
changes in lockd.  Should be quite do-able, just needs to be
different.

> +/*
> + * release locks associated with an export fsid upon failover
> + */
> +int
> +nlmsvc_fo_unlock(int *fsid)
> +{
> +	/* drop the locks */
> +	return (nlm_traverse_files(NULL, fsid, NLM_ACT_FO_UNLOCK)); 
> +}
> +

I really don't think fsid should be an 'int *', just an int.
Other callers of nlm_traverse_files can just pass an fsid of 0 - they
don't need to be able to pass NULL.


NeilBrown



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4 Revised] NLM failover - nlm_unlock
@ 2006-09-26  0:39     ` Neil Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Brown @ 2006-09-26  0:39 UTC (permalink / raw)
  To: wcheng; +Cc: cluster-devel, lhh, nfs


Firstly, sorry for the delay in responding to these.


On Thursday September 14, wcheng@redhat.com 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.
> 
> Relevant steps:
> 1) Exports filesystem with "fsid" option as:
>    /etc/exports entry> /mnt/ext3/exports *(fsid=1234,sync,rw)
> 2) Drops locks based on fsid by:
>    shell> echo 1234 > /proc/fs/nfsd/nlm_unlock

I actually felt a bit more comfortable with the server-ip based
approach, how I cannot really fault the fsid based approach, and it
does seem to have some advantages, so I guess we go with it.

>  /*
> + * Get fsid from nfs_fh:
> + * return 1 if *fsid contains a valid value.
> + */
> +static inline int
> +nlm_fo_get_fsid(struct nfs_fh *fh, int *fsid)
> +{
> +	struct nfs_fhbase_new *fh_base = (struct nfs_fhbase_new *) fh->data;
> + 	int data_left = fh->size/4;
> + 
> + 	nlm_debug_print_fh("nlm_fo_find_fsid", fh);
> + 
> + 	/* From fb_version to fb_auth - at least two u32 */
> + 	if (data_left < 2)		
> + 		return 0;
> +  
> + 	/* For various types, check out 
> + 	 * inlcude/linux/nfsd/nfsfsh.h
> + 	 */
> + 	if ((fh_base->fb_version != 1) ||  
> + 		(fh_base->fb_auth_type != 0) ||
> + 		(fh_base->fb_fsid_type != 1))
> + 		return 0;
> + 
> + 	/* The fb_auth is 0 bytes long - imply fb_auth[0] has
> + 	 * fsid value.
> + 	 */
> + 	*fsid = (int) fh_base->fb_auth[0];
> + 	return 1;
> +}

It would be really nice if this could be in the nfsd code rather than
in the lockd code.  Maybe if the nlm_fopen call passed back the fsid?

> +
> +/*
>   * Operate on a single file
>   */
>  static inline int
> @@ -234,21 +267,42 @@ 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, int *fsidp, int action)
>  {
>  	struct nlm_file	*file, **fp;
> -	int i, ret = 0;
> +	int i, ret = 0, found, fsid_in=0, fsid, act=action;

Unfortunately all of this will have to change due to Olaf's recent
changes in lockd.  Should be quite do-able, just needs to be
different.

> +/*
> + * release locks associated with an export fsid upon failover
> + */
> +int
> +nlmsvc_fo_unlock(int *fsid)
> +{
> +	/* drop the locks */
> +	return (nlm_traverse_files(NULL, fsid, NLM_ACT_FO_UNLOCK)); 
> +}
> +

I really don't think fsid should be an 'int *', just an int.
Other callers of nlm_traverse_files can just pass an fsid of 0 - they
don't need to be able to pass NULL.


NeilBrown

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
  2006-09-14  4:48 ` Wendy Cheng
@ 2006-09-26  0:46     ` Neil Brown
  -1 siblings, 0 replies; 30+ messages in thread
From: Neil Brown @ 2006-09-26  0:46 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Thursday September 14, wcheng at redhat.com wrote:
> This change enables per NFS-export entry lockd grace period. The 
> implementation is based on a double linked list fo_fsid_list that 
> contains entries of fsid info. It is expected this would not be a 
> frequent event. The fo_fsid_list is short and the entries expire within 
> a maximum of 50 seconds.  The grace period setting follows the existing 
> NLM grace period handling logic and is triggered via echoing the NFS 
> export filesystem id into nfsd procfs entry as:
> 
> shell> echo 1234 > /proc/fs/nfsd/nlm_set_igrace

What is the 'i' for?
How about  /proc/fs/nfsd/nlm_set_grace_for_fsid ??

> --- linux-1/include/linux/lockd/lockd.h	2006-09-03 21:51:41.000000000 -0400
> +++ linux-2/include/linux/lockd/lockd.h	2006-09-13 22:48:00.000000000 -0400
> @@ -107,6 +107,17 @@ struct nlm_file {
>  	int		       	f_hash;		/* hash of f_handle */
>  };
>  
> +#define NLM_FO_MAX_FSID_GP	127

Why do you need this limit?

> + *
> + * Also, please don't ask why using opencoded list manipulation, 
> + * instead of <linux/list.h>, unless you can point to me where
> + * in that file have existing macro and/or functions that can do
> + * single linked list. 

I don't think this comment is appropriate any more.  You are using
list.h lists, not open coding them.


> +	/* check to see whether this_fsid is in fo_fsid_list list */
> +	list_for_each_safe(p, tlist, &fo_fsid_list) {
> +		e_this = list_entry(p, struct fo_fsid, g_list);
> +		if (time_before(e_this->g_expire, jiffies)) {
> +			printk("lockd: fsid=%d grace period expires\n",
> +				e_this->g_fsid);
> +			list_del(p);
> +			fo_fsid_cnt--;
> +			kfree(e_this);
> +		} else if (e_this->g_fsid == this_fsid) {
> +			if (!e_this->g_flag) {
> +				e_this->g_flag = 1;
> +				printk("lockd: fsid=%d in grace period\n",
> +					e_this->g_fsid);
> +			}
> +			rc = 1;

I assume this 'g_flag' was just for debugging.  Can it be take out
now?
Also, I though you should break out of the loop once you set rc = 1.

>   * Obtain client and file from arguments
>   */
> @@ -89,7 +102,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp
>  	resp->cookie = argp->cookie;
>  
>  	/* Don't accept test requests during grace period */
> -	if (nlmsvc_grace_period) {
> +	if ((nlmsvc_grace_period) || (nlm4svc_fo_grace_period(argp))) {
>  		resp->status = nlm_lck_denied_grace_period;
>  		return rpc_success;
>  	}

I think this (and the rest) would look cleaner if you put the
'nlmsvc_grace_period' test into the nlm4svc_fo_grace_period function.

NeilBrown



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2006-09-26  0:46     ` Neil Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Brown @ 2006-09-26  0:46 UTC (permalink / raw)
  To: wcheng; +Cc: cluster-devel, lhh, nfs

On Thursday September 14, wcheng@redhat.com wrote:
> This change enables per NFS-export entry lockd grace period. The 
> implementation is based on a double linked list fo_fsid_list that 
> contains entries of fsid info. It is expected this would not be a 
> frequent event. The fo_fsid_list is short and the entries expire within 
> a maximum of 50 seconds.  The grace period setting follows the existing 
> NLM grace period handling logic and is triggered via echoing the NFS 
> export filesystem id into nfsd procfs entry as:
> 
> shell> echo 1234 > /proc/fs/nfsd/nlm_set_igrace

What is the 'i' for?
How about  /proc/fs/nfsd/nlm_set_grace_for_fsid ??

> --- linux-1/include/linux/lockd/lockd.h	2006-09-03 21:51:41.000000000 -0400
> +++ linux-2/include/linux/lockd/lockd.h	2006-09-13 22:48:00.000000000 -0400
> @@ -107,6 +107,17 @@ struct nlm_file {
>  	int		       	f_hash;		/* hash of f_handle */
>  };
>  
> +#define NLM_FO_MAX_FSID_GP	127

Why do you need this limit?

> + *
> + * Also, please don't ask why using opencoded list manipulation, 
> + * instead of <linux/list.h>, unless you can point to me where
> + * in that file have existing macro and/or functions that can do
> + * single linked list. 

I don't think this comment is appropriate any more.  You are using
list.h lists, not open coding them.


> +	/* check to see whether this_fsid is in fo_fsid_list list */
> +	list_for_each_safe(p, tlist, &fo_fsid_list) {
> +		e_this = list_entry(p, struct fo_fsid, g_list);
> +		if (time_before(e_this->g_expire, jiffies)) {
> +			printk("lockd: fsid=%d grace period expires\n",
> +				e_this->g_fsid);
> +			list_del(p);
> +			fo_fsid_cnt--;
> +			kfree(e_this);
> +		} else if (e_this->g_fsid == this_fsid) {
> +			if (!e_this->g_flag) {
> +				e_this->g_flag = 1;
> +				printk("lockd: fsid=%d in grace period\n",
> +					e_this->g_fsid);
> +			}
> +			rc = 1;

I assume this 'g_flag' was just for debugging.  Can it be take out
now?
Also, I though you should break out of the loop once you set rc = 1.

>   * Obtain client and file from arguments
>   */
> @@ -89,7 +102,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp
>  	resp->cookie = argp->cookie;
>  
>  	/* Don't accept test requests during grace period */
> -	if (nlmsvc_grace_period) {
> +	if ((nlmsvc_grace_period) || (nlm4svc_fo_grace_period(argp))) {
>  		resp->status = nlm_lck_denied_grace_period;
>  		return rpc_success;
>  	}

I think this (and the rest) would look cleaner if you put the
'nlmsvc_grace_period' test into the nlm4svc_fo_grace_period function.

NeilBrown

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 3/4 Revised] NLM failover - statd changes
  2006-09-14  4:50 ` Wendy Cheng
@ 2006-09-26  0:54     ` Neil Brown
  -1 siblings, 0 replies; 30+ messages in thread
From: Neil Brown @ 2006-09-26  0:54 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Thursday September 14, wcheng at redhat.com wrote:
> This kernel patch should be paired with nfs-utils user mode changes (in 
> patch 4-4 based on nfs-utils-1.0.8-rc4) that is optional. If changes 
> made in patch 4-4 is not presented in nfs-utils, the rpc.statd will 
> ignore whatever this kernel patch does.
> 
> The changes record the ip interface that accepts the lock requests and 
> passes the correct "my_name" (in standard IPV4 dot notation) to user 
> mode statd (instead of system_utsname.nodename). This enables rpc.statd 
> to add the correct taken-over IPv4 address into the 3rd parameter of 
> ha_callout program. Current nfs-utils always resets "my_name" into 
> loopback address (127.0.0.1), regardless the statement made in rpc.statd 
> man page. Check out "man rpc.statd" for details.
> 
> Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
> Signed-off-by: Lon Hohberger  <lhh@redhat.com>
> 
>  fs/lockd/host.c                |    4 ++--
>  fs/lockd/mon.c                 |   21 +++++++++++++++++----
>  fs/lockd/svc4proc.c            |    8 +++++++-
>  fs/lockd/svcproc.c             |    2 +-
>  include/linux/lockd/lockd.h    |    5 +++--
>  include/linux/lockd/sm_inter.h |    1 +
>  include/linux/sunrpc/svc.h     |    5 +++--
>  net/sunrpc/svcsock.c           |    5 +++++
>  8 files changed, 39 insertions(+), 12 deletions(-)
> 
> 
> --- linux-2/include/linux/sunrpc/svc.h	2006-09-11 16:52:34.000000000 -0400
> +++ linux-3/include/linux/sunrpc/svc.h	2006-09-13 14:07:32.000000000 -0400
> @@ -102,6 +102,7 @@ static inline void svc_putu32(struct kve
>  	iov->iov_len += sizeof(u32);
>  }
>  
> +typedef __u32  svc_addr_t;
>  	
>  /*
>   * The context of a single thread, including the request currently being
> @@ -138,8 +139,8 @@ struct svc_rqst {
>  	unsigned short
>  				rq_secure  : 1;	/* secure port */
>  
> -
> -	__u32			rq_daddr;	/* dest addr of request - reply from here */
> +	svc_addr_t		rq_daddr;	/* dest addr of request 
> +						   - reply from here */
>  
>  	void *			rq_argp;	/* decoded arguments */
>  	void *			rq_resp;	/* xdr'd results */
> --- linux-2/include/linux/lockd/lockd.h	2006-09-13 22:48:00.000000000 -0400
> +++ linux-3/include/linux/lockd/lockd.h	2006-09-13 22:51:41.000000000 -0400
> @@ -39,12 +39,13 @@
>  struct nlm_host {
>  	struct nlm_host *	h_next;		/* linked list (hash table) */
>  	struct sockaddr_in	h_addr;		/* peer address */
> +	svc_addr_t		h_server;	/* server ip for NLM failover */

Comment should say 'or 0 for client'.

>  	struct rpc_clnt	*	h_rpcclnt;	/* RPC client to talk to peer */
>  	char			h_name[20];	/* 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_notused    : 1, 

Just discard this, no need to rename it to 'h_notused'.

>  
> +#if 0
> +	if (argp->reclaim) {
> +		printk("nlm4svc_proc_lock lock reclaim received\n");
> +	}
> +#endif

Can this be removed?


So: mostly looks OK, but will need quite a bit of reworking do to
recent changes in lockd code.  So if you can get me a version that
applies to latest -mm, I'll take it from there.

Thanks,
NeilBrown



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4 Revised] NLM failover - statd changes
@ 2006-09-26  0:54     ` Neil Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Neil Brown @ 2006-09-26  0:54 UTC (permalink / raw)
  To: wcheng; +Cc: cluster-devel, lhh, nfs

On Thursday September 14, wcheng@redhat.com wrote:
> This kernel patch should be paired with nfs-utils user mode changes (in 
> patch 4-4 based on nfs-utils-1.0.8-rc4) that is optional. If changes 
> made in patch 4-4 is not presented in nfs-utils, the rpc.statd will 
> ignore whatever this kernel patch does.
> 
> The changes record the ip interface that accepts the lock requests and 
> passes the correct "my_name" (in standard IPV4 dot notation) to user 
> mode statd (instead of system_utsname.nodename). This enables rpc.statd 
> to add the correct taken-over IPv4 address into the 3rd parameter of 
> ha_callout program. Current nfs-utils always resets "my_name" into 
> loopback address (127.0.0.1), regardless the statement made in rpc.statd 
> man page. Check out "man rpc.statd" for details.
> 
> Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
> Signed-off-by: Lon Hohberger  <lhh@redhat.com>
> 
>  fs/lockd/host.c                |    4 ++--
>  fs/lockd/mon.c                 |   21 +++++++++++++++++----
>  fs/lockd/svc4proc.c            |    8 +++++++-
>  fs/lockd/svcproc.c             |    2 +-
>  include/linux/lockd/lockd.h    |    5 +++--
>  include/linux/lockd/sm_inter.h |    1 +
>  include/linux/sunrpc/svc.h     |    5 +++--
>  net/sunrpc/svcsock.c           |    5 +++++
>  8 files changed, 39 insertions(+), 12 deletions(-)
> 
> 
> --- linux-2/include/linux/sunrpc/svc.h	2006-09-11 16:52:34.000000000 -0400
> +++ linux-3/include/linux/sunrpc/svc.h	2006-09-13 14:07:32.000000000 -0400
> @@ -102,6 +102,7 @@ static inline void svc_putu32(struct kve
>  	iov->iov_len += sizeof(u32);
>  }
>  
> +typedef __u32  svc_addr_t;
>  	
>  /*
>   * The context of a single thread, including the request currently being
> @@ -138,8 +139,8 @@ struct svc_rqst {
>  	unsigned short
>  				rq_secure  : 1;	/* secure port */
>  
> -
> -	__u32			rq_daddr;	/* dest addr of request - reply from here */
> +	svc_addr_t		rq_daddr;	/* dest addr of request 
> +						   - reply from here */
>  
>  	void *			rq_argp;	/* decoded arguments */
>  	void *			rq_resp;	/* xdr'd results */
> --- linux-2/include/linux/lockd/lockd.h	2006-09-13 22:48:00.000000000 -0400
> +++ linux-3/include/linux/lockd/lockd.h	2006-09-13 22:51:41.000000000 -0400
> @@ -39,12 +39,13 @@
>  struct nlm_host {
>  	struct nlm_host *	h_next;		/* linked list (hash table) */
>  	struct sockaddr_in	h_addr;		/* peer address */
> +	svc_addr_t		h_server;	/* server ip for NLM failover */

Comment should say 'or 0 for client'.

>  	struct rpc_clnt	*	h_rpcclnt;	/* RPC client to talk to peer */
>  	char			h_name[20];	/* 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_notused    : 1, 

Just discard this, no need to rename it to 'h_notused'.

>  
> +#if 0
> +	if (argp->reclaim) {
> +		printk("nlm4svc_proc_lock lock reclaim received\n");
> +	}
> +#endif

Can this be removed?


So: mostly looks OK, but will need quite a bit of reworking do to
recent changes in lockd code.  So if you can get me a version that
applies to latest -mm, I'll take it from there.

Thanks,
NeilBrown

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 3/4 Revised] NLM failover - statd changes
  2006-09-26  0:54     ` Neil Brown
@ 2006-09-26 13:42       ` Wendy Cheng
  -1 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-26 13:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Neil Brown wrote:

>So: mostly looks OK, but will need quite a bit of reworking do to
>recent changes in lockd code.  So if you can get me a version that
>applies to latest -mm, I'll take it from there.
>
>  
>
Thanks ! I'm tied with another issue at this moment but will get this 
done (and tested) sometime next week.

-- Wendy



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4 Revised] NLM failover - statd changes
@ 2006-09-26 13:42       ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2006-09-26 13:42 UTC (permalink / raw)
  To: Neil Brown; +Cc: cluster-devel, lhh, nfs

Neil Brown wrote:

>So: mostly looks OK, but will need quite a bit of reworking do to
>recent changes in lockd code.  So if you can get me a version that
>applies to latest -mm, I'll take it from there.
>
>  
>
Thanks ! I'm tied with another issue at this moment but will get this 
done (and tested) sometime next week.

-- Wendy

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 1/4 Revised] NLM failover - nlm_unlock
  2006-09-26  0:39     ` Neil Brown
@ 2007-03-23 22:55       ` Wendy Cheng
  -1 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-23 22:55 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Neil Brown wrote:
> On Thursday September 14, wcheng at redhat.com 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.
>>
>> Relevant steps:
>> 1) Exports filesystem with "fsid" option as:
>>    /etc/exports entry> /mnt/ext3/exports *(fsid=1234,sync,rw)
>> 2) Drops locks based on fsid by:
>>    shell> echo 1234 > /proc/fs/nfsd/nlm_unlock
>>     
>
> I actually felt a bit more comfortable with the server-ip based
> approach, how I cannot really fault the fsid based approach, and it
> does seem to have some advantages, so I guess we go with it.
>   
Neil,

I replaced the checking inside nlm_traverse_files with nlm_file_inuse() 
as we discussed in:
http://sourceforge.net/mailarchive/forum.php?thread_id=31885384&forum_id=4930

If a separate patch is a better idea, feel free to yank it out. The code 
is based on 2.6.21.rc4 kernel and can be used independently (without 
other NLM failover patches). We submit it earlier (others still being 
worked on) to avoid the tedious rebase efforts. There are also  customer 
requests from our distribution to ask for this function in a single 
server (no cluster) environment.

-- Wendy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nlm_unlock.patch
Type: text/x-patch
Size: 8956 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20070323/c90f29b2/attachment.bin>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4 Revised] NLM failover - nlm_unlock
@ 2007-03-23 22:55       ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-23 22:55 UTC (permalink / raw)
  To: Neil Brown; +Cc: cluster-devel, lhh, nfs

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

Neil Brown wrote:
> On Thursday September 14, wcheng@redhat.com 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.
>>
>> Relevant steps:
>> 1) Exports filesystem with "fsid" option as:
>>    /etc/exports entry> /mnt/ext3/exports *(fsid=1234,sync,rw)
>> 2) Drops locks based on fsid by:
>>    shell> echo 1234 > /proc/fs/nfsd/nlm_unlock
>>     
>
> I actually felt a bit more comfortable with the server-ip based
> approach, how I cannot really fault the fsid based approach, and it
> does seem to have some advantages, so I guess we go with it.
>   
Neil,

I replaced the checking inside nlm_traverse_files with nlm_file_inuse() 
as we discussed in:
http://sourceforge.net/mailarchive/forum.php?thread_id=31885384&forum_id=4930

If a separate patch is a better idea, feel free to yank it out. The code 
is based on 2.6.21.rc4 kernel and can be used independently (without 
other NLM failover patches). We submit it earlier (others still being 
worked on) to avoid the tedious rebase efforts. There are also  customer 
requests from our distribution to ask for this function in a single 
server (no cluster) environment.

-- Wendy


[-- Attachment #2: nlm_unlock.patch --]
[-- Type: text/x-patch, Size: 8956 bytes --]

 Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
 Signed-off-by: Lon Hohberger  <lhh@redhat.com>
 
 fs/lockd/svcsubs.c          |   64 ++++++++++++++++++++++++++++++++++++++++++--
 fs/nfsd/nfsctl.c            |   28 +++++++++++++++++++
 include/linux/lockd/bind.h  |    1
 include/linux/lockd/lockd.h |    4 ++
 include/linux/nfsd/nfsfh.h  |   29 +++++++++++++++++++
 5 files changed, 124 insertions(+), 2 deletions(-)

--- gfs2-nmw/include/linux/nfsd/nfsfh.h	2007-03-19 14:18:53.000000000 -0400
+++ linux/include/linux/nfsd/nfsfh.h	2007-03-20 15:45:29.000000000 -0400
@@ -254,6 +254,35 @@ static inline int key_len(int type)
 	}
 }
 
+/* 
+ * Used by lockd to get FSID_NUM fsid from nfs_fh, logic based on fh_verify
+ *      return 0 if not found
+ *             1 if *fsid contain a valid fsid
+ */	
+static inline int get_fsid(struct nfs_fh *fh, unsigned int *fsid)
+{
+	struct nfs_fhbase_new *fh_base = (struct nfs_fhbase_new *) fh->data;
+	int data_left = fh->size/4;
+
+	/* From fb_version to fb_auth - at least two u32 */
+	if (data_left < 2)		
+		return 0;
+
+	/* For various types, check out 
+	 * inlcude/linux/nfsd/nfsfsh.h
+	 */
+	if ((fh_base->fb_version != 1) ||  
+		(fh_base->fb_auth_type != 0) ||
+		(fh_base->fb_fsid_type != FSID_NUM))
+		return 0;
+ 
+	/* The fb_auth is 0 bytes long - imply fb_auth[0] has
+	 * fsid value.
+	 */
+	*fsid = (int) fh_base->fb_auth[0];
+	return 1;
+}
+
 /*
  * Shorthand for dprintk()'s
  */
--- gfs2-nmw/include/linux/lockd/lockd.h	2007-03-19 14:18:42.000000000 -0400
+++ linux/include/linux/lockd/lockd.h	2007-03-21 15:01:57.000000000 -0400
@@ -202,6 +202,8 @@ 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_same_fsid(struct nlm_host *, struct nlm_host *);
+int		  nlmsvc_fo_unlock(int *fsid);
 
 static __inline__ struct inode *
 nlmsvc_file_inode(struct nlm_file *file)
--- gfs2-nmw/fs/lockd/svcsubs.c	2007-03-19 14:17:52.000000000 -0400
+++ linux/fs/lockd/svcsubs.c	2007-03-23 17:46:10.000000000 -0400
@@ -18,6 +18,7 @@
 #include <linux/lockd/lockd.h>
 #include <linux/lockd/share.h>
 #include <linux/lockd/sm_inter.h>
+#include <linux/module.h>	/* EXPORT_SYMBOL */
 
 #define NLMDBG_FACILITY		NLMDBG_SVCSUBS
 
@@ -179,6 +180,7 @@ again:
 		if (match(lockhost, host)) {
 			struct file_lock lock = *fl;
 
+			dprintk("nlm_traverse_locks: match-delete the lock\n");
 			lock.fl_type  = F_UNLCK;
 			lock.fl_start = 0;
 			lock.fl_end   = OFFSET_MAX;
@@ -194,12 +196,41 @@ again:
 	return 0;
 }
 
+static inline int
+nlm_fo_fsid_match(struct nlm_host *host, struct nlm_file *file)
+{
+	struct nfs_fh *fh = &file->f_handle;
+	unsigned int fsid_found, fsid_passed = *((unsigned int *)host);
+ 
+	nlm_debug_print_fh("nlm_fo_check_fsid", fh);
+
+	/* yank fsid out of file handle */
+	if (get_fsid(fh, &fsid_found) && (fsid_found == fsid_passed))
+		return 1;
+
+	/* no match */
+	return 0;
+}
+
 /*
  * Inspect a single file
  */
 static inline int
 nlm_inspect_file(struct nlm_host *host, struct nlm_file *file, nlm_host_match_fn_t match)
 {
+	/* Cluster failover has timing constraints. There is a slight
+	 * performance hit if nlm_fo_check_fsid()is implemented as a match 
+	 * fn (since it will be invoked multiple times later). Instead, we
+	 * we add fsid-matching logic into the following clause.
+	 * If fsid matches, nlmsvc_same_fsid will always return true.
+	 */
+	dprintk("nlm_inspect_files: file=%p\n", file);
+	if (unlikely(match == nlmsvc_same_fsid)) {
+		if (!nlm_fo_fsid_match(host, file))
+			return 0;
+		dprintk("nlm_fo fsid matches\n");
+	}
+
 	nlmsvc_traverse_blocks(host, file, match);
 	nlmsvc_traverse_shares(host, file, match);
 	return nlm_traverse_locks(host, file, match);
@@ -250,8 +281,7 @@ nlm_traverse_files(struct nlm_host *host
 			mutex_lock(&nlm_file_mutex);
 			file->f_count--;
 			/* No more references to this file. Let go of it. */
-			if (list_empty(&file->f_blocks) && !file->f_locks
-			 && !file->f_shares && !file->f_count) {
+			if (!nlm_file_inuse(file)) {
 				hlist_del(&file->f_list);
 				nlmsvc_ops->fclose(file->f_file);
 				kfree(file);
@@ -301,7 +331,14 @@ nlm_release_file(struct nlm_file *file)
  * nlmsvc_is_client:
  *	returns 1 iff the host is a client.
  *	Used by nlmsvc_invalidate_all
+ *
+ * nlmsvc_same_fsid:
+ *	always returns 1 if invoked. The real job is done by
+ *	nlm_fo_check_fsid(). It should release all resources 
+ *	bound to a specific nfs export, identified by exported 
+ *	fsid.
  */
+
 static int
 nlmsvc_mark_host(struct nlm_host *host, struct nlm_host *dummy)
 {
@@ -330,6 +367,15 @@ nlmsvc_is_client(struct nlm_host *host, 
 		return 0;
 }
 
+/* To fit the logic into current lockd code structure, we add a 
+ * little wrapper function here. The real matching task should be
+ * carried out by nlm_fo_check_fsid().
+ */
+int nlmsvc_same_fsid(struct nlm_host *dummy1, struct nlm_host *dummy2)
+{
+	return 1;
+}
+
 /*
  * Mark all hosts that still hold resources
  */
@@ -370,3 +416,17 @@ nlmsvc_invalidate_all(void)
 	 */
 	nlm_traverse_files(NULL, nlmsvc_is_client);
 }
+
+EXPORT_SYMBOL(nlmsvc_fo_unlock);
+
+/*
+ * Release locks associated with an export fsid upon failover
+ * 	invoked via nfsd nfsctl call (write_fo_unlock).
+ */
+int
+nlmsvc_fo_unlock(int *fsid)
+{
+	return (nlm_traverse_files((struct nlm_host*)fsid, nlmsvc_same_fsid));
+}
+
+
--- gfs2-nmw/fs/nfsd/nfsctl.c	2007-03-19 14:18:04.000000000 -0400
+++ linux/fs/nfsd/nfsctl.c	2007-03-23 18:24:47.000000000 -0400
@@ -36,6 +36,7 @@
 #include <linux/nfsd/xdr.h>
 #include <linux/nfsd/syscall.h>
 #include <linux/nfsd/interface.h>
+#include <linux/lockd/bind.h>
 
 #include <asm/uaccess.h>
 
@@ -53,6 +54,7 @@ enum {
 	NFSD_Getfs,
 	NFSD_List,
 	NFSD_Fh,
+	NFSD_NlmUnlock,
 	NFSD_Threads,
 	NFSD_Pool_Threads,
 	NFSD_Versions,
@@ -79,6 +81,7 @@ static ssize_t write_unexport(struct fil
 static ssize_t write_getfd(struct file *file, char *buf, size_t size);
 static ssize_t write_getfs(struct file *file, char *buf, size_t size);
 static ssize_t write_filehandle(struct file *file, char *buf, size_t size);
+static ssize_t write_fo_unlock(struct file *file, char *buf, size_t size);
 static ssize_t write_threads(struct file *file, char *buf, size_t size);
 static ssize_t write_pool_threads(struct file *file, char *buf, size_t size);
 static ssize_t write_versions(struct file *file, char *buf, size_t size);
@@ -98,6 +101,7 @@ static ssize_t (*write_op[])(struct file
 	[NFSD_Getfd] = write_getfd,
 	[NFSD_Getfs] = write_getfs,
 	[NFSD_Fh] = write_filehandle,
+	[NFSD_NlmUnlock] = write_fo_unlock,
 	[NFSD_Threads] = write_threads,
 	[NFSD_Pool_Threads] = write_pool_threads,
 	[NFSD_Versions] = write_versions,
@@ -345,6 +349,29 @@ static ssize_t write_filehandle(struct f
 	return mesg - buf;	
 }
 
+static ssize_t write_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) 
+		return rc;
+
+	/* call nlm to release the locks - fsid is passed by reference 
+	 * to allow other routine uses NULL pointer. */
+	rc = nlmsvc_fo_unlock(&fsid);
+	if (rc) 
+		return rc;
+
+	/* done */
+	sprintf(buf, "nlm_fo fsid=%d released locks\n", fsid);
+	return strlen(buf);
+}
+
 extern int nfsd_nrthreads(void);
 
 static ssize_t write_threads(struct file *file, char *buf, size_t size)
@@ -648,6 +675,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_NlmUnlock] = {"nlm_unlock", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
--- gfs2-nmw/include/linux/lockd/bind.h	2007-03-19 14:18:42.000000000 -0400
+++ linux/include/linux/lockd/bind.h	2007-03-21 14:54:07.000000000 -0400
@@ -37,5 +37,6 @@ extern struct nlmsvc_binding *	nlmsvc_op
 extern int	nlmclnt_proc(struct inode *, int, struct file_lock *);
 extern int	lockd_up(int proto);
 extern void	lockd_down(void);
+extern int	nlmsvc_fo_unlock(int *fsid);
 
 #endif /* LINUX_LOCKD_BIND_H */
--- gfs2-nmw/include/linux/lockd/lockd.h	2007-03-19 14:18:42.000000000 -0400
+++ linux/include/linux/lockd/lockd.h	2007-03-21 15:01:57.000000000 -0400
@@ -202,6 +202,8 @@ 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_same_fsid(struct nlm_host *, struct nlm_host *);
+int		  nlmsvc_fo_unlock(int *fsid);
 
 static __inline__ struct inode *
 nlmsvc_file_inode(struct nlm_file *file)

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

-------------------------------------------------------------------------
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

[-- 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] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
  2006-09-26  0:46     ` Neil Brown
@ 2007-03-26 22:21       ` Wendy Cheng
  -1 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-26 22:21 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Revised patch based on 2.6.21-rc4.

The change enables per NFS-export entry lockd grace period. A linked 
list, fo_fsid_list, contains entries of fsid info. This list is expected 
to be short and entries expire within a maximum of 50 seconds. It 
follows the existing NLM grace period handling logic and is triggered 
via echoing the NFS export filesystem id (fsid) into nfsd procfs entry as:

shell> echo 1234 > /proc/fs/nfsd/nlm_set_grace_for_fsid

-- Wendy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nlm_grace.patch
Type: text/x-patch
Size: 15229 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20070326/8b4c1701/attachment.bin>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2007-03-26 22:21       ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-26 22:21 UTC (permalink / raw)
  To: Neil Brown; +Cc: cluster-devel, lhh, nfs

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

Revised patch based on 2.6.21-rc4.

The change enables per NFS-export entry lockd grace period. A linked 
list, fo_fsid_list, contains entries of fsid info. This list is expected 
to be short and entries expire within a maximum of 50 seconds. It 
follows the existing NLM grace period handling logic and is triggered 
via echoing the NFS export filesystem id (fsid) into nfsd procfs entry as:

shell> echo 1234 > /proc/fs/nfsd/nlm_set_grace_for_fsid

-- Wendy


[-- Attachment #2: nlm_grace.patch --]
[-- Type: text/x-patch, Size: 15229 bytes --]

 Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
 Signed-off-by: Lon Hohberger  <lhh@redhat.com>

 fs/lockd/svc.c              |    8 +-
 fs/lockd/svc4proc.c         |   15 ++-
 fs/lockd/svcproc.c          |   12 +--
 fs/lockd/svcsubs.c          |  169 ++++++++++++++++++++++++++++++++++++++++++++
 fs/nfsd/nfsctl.c            |   27 +++++++
 include/linux/lockd/bind.h  |    2
 include/linux/lockd/lockd.h |   30 +++++++
 7 files changed, 248 insertions(+), 15 deletions(-)

--- linux-nlm-1/include/linux/lockd/lockd.h	2007-03-26 10:29:44.000000000 -0400
+++ linux/include/linux/lockd/lockd.h	2007-03-26 17:37:39.000000000 -0400
@@ -114,6 +114,16 @@ struct nlm_file {
 	struct mutex		f_mutex;	/* avoid concurrent access */
 };
 
+#define NLM_FO_MAX_FSID_GP	127
+
+/* Server fsid linked list for NLM lock failover */
+struct fo_fsid {
+	struct list_head	g_list;		/* linked list */
+	unsigned long		g_expire;	/* when this grace period
+						 * will expire */
+	int			g_fsid;		/* exported fsid */
+};
+
 /*
  * This is a server block (i.e. a lock requested by some client which
  * couldn't be granted because of a conflicting lock).
@@ -193,6 +203,8 @@ void		  nlmsvc_traverse_blocks(struct nl
 					nlm_host_match_fn_t match);
 void		  nlmsvc_grant_reply(struct nlm_cookie *, __be32);
 
+unsigned long set_grace_period(void); /*required by svcsubs.c and svc.c 
+					to support nlm failover */
 /*
  * File handling for the server personality
  */
@@ -204,6 +216,7 @@ void		  nlmsvc_free_host_resources(struc
 void		  nlmsvc_invalidate_all(void);
 int		  nlmsvc_same_fsid(struct nlm_host *, struct nlm_host *);
 int		  nlmsvc_fo_unlock(int *fsid);
+int		  nlmsvc_fo_check(struct nfs_fh *fh);
 
 static __inline__ struct inode *
 nlmsvc_file_inode(struct nlm_file *file)
@@ -234,6 +247,23 @@ nlm_compare_locks(const struct file_lock
 	     &&(fl1->fl_type  == fl2->fl_type || fl2->fl_type == F_UNLCK);
 }
 
+extern struct list_head fo_fsid_list;
+
+/*Check for grace period: return TRUE or FALSE */
+static inline int
+nlmsvc_check_grace_period(struct nlm_args *argp)
+{
+	/* check for system wide grace period */
+	if (nlmsvc_grace_period)
+		return 1;
+
+	/* check for per exported fsid grace period */
+        if (unlikely(!list_empty(&fo_fsid_list)))
+                return(nlmsvc_fo_check(&argp->lock.fh));
+
+        return 0;
+}
+
 extern struct lock_manager_operations nlmsvc_lock_operations;
 
 #endif /* __KERNEL__ */
--- linux-nlm-1/include/linux/lockd/bind.h	2007-03-26 10:29:44.000000000 -0400
+++ linux/include/linux/lockd/bind.h	2007-03-26 11:11:14.000000000 -0400
@@ -38,5 +38,7 @@ extern int	nlmclnt_proc(struct inode *, 
 extern int	lockd_up(int proto);
 extern void	lockd_down(void);
 extern int	nlmsvc_fo_unlock(int *fsid);
+extern int	nlmsvc_fo_setgrace(int fsid);
+extern void	nlmsvc_fo_reset_servs(void);
 
 #endif /* LINUX_LOCKD_BIND_H */
--- linux-nlm-1/fs/nfsd/nfsctl.c	2007-03-26 10:23:36.000000000 -0400
+++ linux/fs/nfsd/nfsctl.c	2007-03-26 15:40:12.000000000 -0400
@@ -55,6 +55,7 @@ enum {
 	NFSD_List,
 	NFSD_Fh,
 	NFSD_NlmUnlock,
+	NFSD_NlmGrace,
 	NFSD_Threads,
 	NFSD_Pool_Threads,
 	NFSD_Versions,
@@ -91,6 +92,8 @@ static ssize_t write_maxblksize(struct f
 static ssize_t write_leasetime(struct file *file, char *buf, size_t size);
 static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
 #endif
+static ssize_t write_fo_unlock(struct file *file, char *buf, size_t size);
+static ssize_t write_fo_grace(struct file *file, char *buf, size_t size);
 
 static ssize_t (*write_op[])(struct file *, char *, size_t) = {
 	[NFSD_Svc] = write_svc,
@@ -102,6 +105,7 @@ static ssize_t (*write_op[])(struct file
 	[NFSD_Getfs] = write_getfs,
 	[NFSD_Fh] = write_filehandle,
 	[NFSD_NlmUnlock] = write_fo_unlock,
+	[NFSD_NlmGrace] = write_fo_grace,
 	[NFSD_Threads] = write_threads,
 	[NFSD_Pool_Threads] = write_pool_threads,
 	[NFSD_Versions] = write_versions,
@@ -372,6 +376,28 @@ static ssize_t write_fo_unlock(struct fi
 	return strlen(buf);
 }
 
+static ssize_t write_fo_grace(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) 
+		return rc;
+ 
+	/* call nlm to set the grace period */
+	rc = nlmsvc_fo_setgrace(fsid);
+	if (rc) 
+		return rc;
+ 
+	/* done */
+	sprintf(buf, "nlm set per fsid=%d grace period\n", fsid);
+	return strlen(buf);
+}
+
 extern int nfsd_nrthreads(void);
 
 static ssize_t write_threads(struct file *file, char *buf, size_t size)
@@ -676,6 +702,7 @@ static int nfsd_fill_super(struct super_
 		[NFSD_List] = {"exports", &exports_operations, S_IRUGO},
 		[NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_NlmUnlock] = {"nlm_unlock", &transaction_ops, S_IWUSR|S_IRUSR},
+		[NFSD_NlmGrace] = {"nlm_set_grace_for_fsid", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
--- linux-nlm-1/fs/lockd/svcsubs.c	2007-03-26 10:23:22.000000000 -0400
+++ linux/fs/lockd/svcsubs.c	2007-03-26 16:01:54.000000000 -0400
@@ -31,6 +31,13 @@
 static struct hlist_head	nlm_files[FILE_NRHASH];
 static DEFINE_MUTEX(nlm_file_mutex);
 
+/* 
+ * Global control structure for lock failover 
+ */
+static spinlock_t nlm_fo_lock=SPIN_LOCK_UNLOCKED;
+static int fo_fsid_cnt=0;
+LIST_HEAD(fo_fsid_list);
+
 #ifdef NFSD_DEBUG
 static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
 {
@@ -430,3 +437,165 @@ nlmsvc_fo_unlock(int *fsid)
 }
 
 
+EXPORT_SYMBOL(nlmsvc_fo_setgrace);
+
+/*
+ * Add fsid into global fo_fsid_list.
+ *
+ * If this routine is repeatedly called with the same fsid, instead 
+ * of searching thru the list to purge old entries (to make the code 
+ * un-necessarily complicated), we will keep the old entries. Since
+ * the list is later searched in top-down order (newer entry first), 
+ * as soon as one is found, the search stops. This implies the older 
+ * entries will not be used and always expire before new entry.    
+ *
+ * As an admin interface, the list is expected to be short and 
+ * entries are purged (expired) quickly.
+ */
+int
+nlmsvc_fo_setgrace(int fsid)
+{
+	struct list_head *p, *tlist;
+	struct fo_fsid *per_fsid, *entry;
+	int done=0;
+
+	/* allocate the entry */
+	per_fsid = kmalloc(sizeof(struct fo_fsid), GFP_KERNEL);
+	if (per_fsid == NULL) {
+		printk("lockd: nlmsvc_fo_setgrace kmalloc fails\n");
+		return(-ENOMEM);
+	}
+
+	/* debug printk */
+	dprintk("lockd: nlmsvc_fo_setgrace fsid=%d jiffies=%lu\n", 
+		fsid, jiffies);
+
+	/* fill in info */
+	per_fsid->g_expire = set_grace_period();
+	per_fsid->g_fsid   = fsid;
+
+	spin_lock(&nlm_fo_lock);
+
+	if (list_empty(&fo_fsid_list)) {
+		list_add(&per_fsid->g_list, &fo_fsid_list);
+		fo_fsid_cnt = 1;
+		done = 1;
+		goto nlmsvc_fo_setgrace_out;
+	} else if (fo_fsid_cnt > NLM_FO_MAX_FSID_GP) {
+                kfree(per_fsid);
+                printk("lockd: fo_setgrace max cnt reached fsid=%d not added\n",                        fsid);
+                goto nlmsvc_fo_setgrace_out;
+        }
+
+	list_for_each_safe(p, tlist, &fo_fsid_list) {
+		entry = list_entry(p, struct fo_fsid, g_list);
+		if (!done) {
+			/* add the new fsid into the list */
+			if (entry->g_expire <= per_fsid->g_expire) {
+				list_add(&per_fsid->g_list, &entry->g_list);
+				fo_fsid_cnt++;
+				done = 1;
+			}
+		}
+		if (done && (entry->g_fsid == fsid)) {
+			/* multiple fsid(s) */
+			BUG_ON(entry->g_expire > per_fsid->g_expire); 
+			list_del(p); 
+			fo_fsid_cnt--;
+			kfree(entry);
+		} else if (time_before(entry->g_expire, jiffies)) {
+			/* garbage collection */
+			dprintk("nlmsvc fo_fsid = %d expires\n", entry->g_fsid);
+			list_del(p);
+			fo_fsid_cnt--;
+			kfree(entry);
+		} 
+	}
+	
+nlmsvc_fo_setgrace_out:
+
+	spin_unlock(&nlm_fo_lock);
+
+	/* debug */
+	if (done)
+		dprintk("nlmsvc fo setgrace: fsid=%d, jiffies=%lu, expire=%lu\n",
+			per_fsid->g_fsid, jiffies, per_fsid->g_expire);
+	else
+		dprintk("nlmsvc_fo_setgrace: adding fsid=%d fails\n", fsid);
+
+	return 0;
+}
+
+/* 
+ * Reset global fo_fsid_list list 
+ */
+void 
+nlmsvc_fo_reset_servs()
+{
+	struct fo_fsid *e_purge;
+	struct list_head *p, *tlist;
+
+	spin_lock(&nlm_fo_lock);
+
+	/* nothing to do */
+	if (list_empty(&fo_fsid_list)) {
+		spin_unlock(&nlm_fo_lock);
+		return;
+	}
+
+	dprintk("lockd: nlmsvc_fo_reset fo_fsid_list\n");
+
+	/* purge the entries */
+	list_for_each_safe(p, tlist, &fo_fsid_list) {
+		e_purge = list_entry(p, struct fo_fsid, g_list);
+		list_del(p);
+		kfree(e_purge);
+	}
+	fo_fsid_cnt = 0;
+
+	spin_unlock(&nlm_fo_lock);
+}
+
+/*
+ * Check whether the fsid is in the failover list: fo_fsid_list.
+ *	return TRUE (1) if fsid in nlm_serv.
+ */
+int
+nlmsvc_fo_check(struct nfs_fh *fh)
+{
+	struct fo_fsid *e_this;
+	struct list_head *p, *tlist;
+	int rc=0, this_fsid;
+
+	/* see if this fh has fsid */
+	if (!get_fsid(fh, &this_fsid)) {
+		return 0;
+	}
+
+	spin_lock(&nlm_fo_lock);
+
+	/* no failover entry */
+	if (list_empty(&fo_fsid_list))  
+		goto nlmsvc_fo_check_out;
+
+	/* check to see whether this_fsid is in fo_fsid_list list */
+	list_for_each_safe(p, tlist, &fo_fsid_list) {
+		e_this = list_entry(p, struct fo_fsid, g_list);
+		if (time_before(e_this->g_expire, jiffies)) {
+			printk("lockd: fsid=%d grace period expires\n",
+				e_this->g_fsid);
+			list_del(p);
+			fo_fsid_cnt--;
+			kfree(e_this);
+		} else if (e_this->g_fsid == this_fsid) {
+			printk("lockd: fsid=%d in grace period\n",
+				e_this->g_fsid);
+			rc = 1;
+		}
+	}
+
+nlmsvc_fo_check_out:
+	spin_unlock(&nlm_fo_lock);
+	return rc;
+}
+
--- linux-nlm-1/fs/lockd/svc4proc.c	2007-03-26 10:23:22.000000000 -0400
+++ linux/fs/lockd/svc4proc.c	2007-03-26 17:34:27.000000000 -0400
@@ -18,9 +18,10 @@
 #include <linux/lockd/share.h>
 #include <linux/lockd/sm_inter.h>
 
-
 #define NLMDBG_FACILITY		NLMDBG_CLIENT
 
+extern struct list_head fo_fsid_list;
+
 /*
  * Obtain client and file from arguments
  */
@@ -89,7 +90,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp
 	resp->cookie = argp->cookie;
 
 	/* Don't accept test requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -119,7 +120,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if (nlmsvc_check_grace_period(argp) && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -162,7 +163,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqs
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -195,7 +196,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqs
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -332,7 +333,7 @@ nlm4svc_proc_share(struct svc_rqst *rqst
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if (nlmsvc_check_grace_period(argp) && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -365,7 +366,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rq
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
--- linux-nlm-1/fs/lockd/svcproc.c	2007-03-26 10:23:23.000000000 -0400
+++ linux/fs/lockd/svcproc.c	2007-03-26 17:37:30.000000000 -0400
@@ -117,7 +117,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp,
 	resp->cookie = argp->cookie;
 
 	/* Don't accept test requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -148,7 +148,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp,
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if (nlmsvc_check_grace_period(argp) && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -191,7 +191,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqst
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -224,7 +224,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqst
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -363,7 +363,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp
 	resp->cookie = argp->cookie;
 
 	/* Don't accept new lock requests during grace period */
-	if (nlmsvc_grace_period && !argp->reclaim) {
+	if (nlmsvc_check_grace_period(argp) && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
@@ -396,7 +396,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqs
 	resp->cookie = argp->cookie;
 
 	/* Don't accept requests during grace period */
-	if (nlmsvc_grace_period) {
+	if (nlmsvc_check_grace_period(argp)) {
 		resp->status = nlm_lck_denied_grace_period;
 		return rpc_success;
 	}
--- linux-nlm-1/fs/lockd/svc.c	2007-03-26 10:23:22.000000000 -0400
+++ linux/fs/lockd/svc.c	2007-03-26 11:16:27.000000000 -0400
@@ -75,7 +75,7 @@ static const int		nlm_port_min = 0, nlm_
 
 static struct ctl_table_header * nlm_sysctl_table;
 
-static unsigned long set_grace_period(void)
+unsigned long set_grace_period(void)
 {
 	unsigned long grace_period;
 
@@ -85,7 +85,6 @@ static unsigned long set_grace_period(vo
 				/ nlm_timeout) * nlm_timeout * HZ;
 	else
 		grace_period = nlm_timeout * 5 * HZ;
-	nlmsvc_grace_period = 1;
 	return grace_period + jiffies;
 }
 
@@ -133,6 +132,8 @@ lockd(struct svc_rqst *rqstp)
 	nlmsvc_timeout = nlm_timeout * HZ;
 
 	grace_period_expire = set_grace_period();
+	nlmsvc_grace_period = 1;
+	(void) nlmsvc_fo_reset_servs();
 
 	/*
 	 * The main request loop. We don't terminate until the last
@@ -148,6 +149,8 @@ lockd(struct svc_rqst *rqstp)
 			if (nlmsvc_ops) {
 				nlmsvc_invalidate_all();
 				grace_period_expire = set_grace_period();
+				nlmsvc_grace_period = 1;
+				(void) nlmsvc_fo_reset_servs();
 			}
 		}
 
@@ -194,6 +197,7 @@ lockd(struct svc_rqst *rqstp)
 		nlm_shutdown_hosts();
 		nlmsvc_pid = 0;
 		nlmsvc_serv = NULL;
+		(void) nlmsvc_fo_reset_servs();
 	} else
 		printk(KERN_DEBUG
 			"lockd: new process, skipping host shutdown\n");

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

-------------------------------------------------------------------------
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

[-- 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] 30+ messages in thread

* [Cluster-devel] [PATCH 3/4 Revised] NLM failover - statd changes
  2006-09-14  4:50 ` Wendy Cheng
@ 2007-03-27 22:46   ` Wendy Cheng
  -1 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-27 22:46 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Just did a browsing on 2.6.21.rc4 statd code (also with few quick test 
runs to confirm). Look like this patch is no longer needed. I 
tentatively withdraw this patch. Will continue the test this week. A 
summary will be sent after all the testings are completed.

-- Wendy



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Cluster-devel] [PATCH 3/4 Revised] NLM failover - statd changes
@ 2007-03-27 22:46   ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-27 22:46 UTC (permalink / raw)
  To: Neil Brown; +Cc: cluster-devel, nfs

Just did a browsing on 2.6.21.rc4 statd code (also with few quick test 
runs to confirm). Look like this patch is no longer needed. I 
tentatively withdraw this patch. Will continue the test this week. A 
summary will be sent after all the testings are completed.

-- Wendy

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
  2007-03-26 22:21       ` Wendy Cheng
@ 2007-03-28  2:45         ` J. Bruce Fields
  -1 siblings, 0 replies; 30+ messages in thread
From: J. Bruce Fields @ 2007-03-28  2:45 UTC (permalink / raw)
  To: Wendy Cheng; +Cc: Neil Brown, cluster-devel, lhh, nfs

On Mon, Mar 26, 2007 at 06:21:01PM -0400, Wendy Cheng wrote:
> Revised patch based on 2.6.21-rc4.

Were there supposed to be 4 patches?  If so, where can I find the full
series?

--b.

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2007-03-28  2:45         ` J. Bruce Fields
  0 siblings, 0 replies; 30+ messages in thread
From: J. Bruce Fields @ 2007-03-28  2:45 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Mon, Mar 26, 2007 at 06:21:01PM -0400, Wendy Cheng wrote:
> Revised patch based on 2.6.21-rc4.

Were there supposed to be 4 patches?  If so, where can I find the full
series?

--b.



^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
  2007-03-28  2:45         ` [Cluster-devel] Re: [NFS] " J. Bruce Fields
@ 2007-03-28  5:32           ` Wendy Cheng
  -1 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-28  5:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

J. Bruce Fields wrote:

>On Mon, Mar 26, 2007 at 06:21:01PM -0400, Wendy Cheng wrote:
>  
>
>>Revised patch based on 2.6.21-rc4.
>>    
>>
>
>Were there supposed to be 4 patches?  If so, where can I find the full
>series?
>
>--b.
>  
>

These are revised patches based on the discussion we had last September 
(shame on me to put this off for so long).

General description:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00034.html
Patch 4-1 is based on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00035.html
new patch at:
https://www.redhat.com/archives/cluster-devel/2007-March/msg00218.html
Patch 4-2 is based on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00036.html
new patch at:
https://www.redhat.com/archives/cluster-devel/2007-March/msg00231.html
patch 4-3 original patch on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00037.html
For 2.6.21 kernel, this patch is no longer needed.
Patch 4.4 is nfs-utils (user mode) original patch on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00038.html
New patch: to be followed.

-- Wendy



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2007-03-28  5:32           ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-28  5:32 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: cluster-devel, nfs

J. Bruce Fields wrote:

>On Mon, Mar 26, 2007 at 06:21:01PM -0400, Wendy Cheng wrote:
>  
>
>>Revised patch based on 2.6.21-rc4.
>>    
>>
>
>Were there supposed to be 4 patches?  If so, where can I find the full
>series?
>
>--b.
>  
>

These are revised patches based on the discussion we had last September 
(shame on me to put this off for so long).

General description:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00034.html
Patch 4-1 is based on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00035.html
new patch at:
https://www.redhat.com/archives/cluster-devel/2007-March/msg00218.html
Patch 4-2 is based on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00036.html
new patch at:
https://www.redhat.com/archives/cluster-devel/2007-March/msg00231.html
patch 4-3 original patch on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00037.html
For 2.6.21 kernel, this patch is no longer needed.
Patch 4.4 is nfs-utils (user mode) original patch on:
https://www.redhat.com/archives/cluster-devel/2006-September/msg00038.html
New patch: to be followed.

-- Wendy

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
  2007-03-28  5:32           ` Wendy Cheng
@ 2007-03-28 23:28             ` J. Bruce Fields
  -1 siblings, 0 replies; 30+ messages in thread
From: J. Bruce Fields @ 2007-03-28 23:28 UTC (permalink / raw)
  To: Wendy Cheng; +Cc: cluster-devel, nfs

On Wed, Mar 28, 2007 at 12:32:40AM -0500, Wendy Cheng wrote:
> These are revised patches based on the discussion we had last September 

OK.  Would you remind just resending the revised versions of all of them
whenever they're ready?

It's just that applying patches off a web email archive is a bit of a
pain (there's all this &amp; stuff to deal with, and who knows what it
does to the whitespace), while we all have piles of scripts to deal with
plain emailed patches....

Looks like interesting stuff.

--b.

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2007-03-28 23:28             ` J. Bruce Fields
  0 siblings, 0 replies; 30+ messages in thread
From: J. Bruce Fields @ 2007-03-28 23:28 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Wed, Mar 28, 2007 at 12:32:40AM -0500, Wendy Cheng wrote:
> These are revised patches based on the discussion we had last September 

OK.  Would you remind just resending the revised versions of all of them
whenever they're ready?

It's just that applying patches off a web email archive is a bit of a
pain (there's all this &amp; stuff to deal with, and who knows what it
does to the whitespace), while we all have piles of scripts to deal with
plain emailed patches....

Looks like interesting stuff.

--b.



^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
  2007-03-28 23:28             ` [Cluster-devel] Re: [NFS] " J. Bruce Fields
@ 2007-03-29  5:31               ` Wendy Cheng
  -1 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-29  5:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

J. Bruce Fields wrote:

>On Wed, Mar 28, 2007 at 12:32:40AM -0500, Wendy Cheng wrote:
>  
>
>>These are revised patches based on the discussion we had last September 
>>    
>>
>
>OK.  Would you remind just resending the revised versions of all of them
>whenever they're ready?
>
>It's just that applying patches off a web email archive is a bit of a
>pain (there's all this &amp; stuff to deal with, and who knows what it
>does to the whitespace), while we all have piles of scripts to deal with
>plain emailed patches....
>
>Looks like interesting stuff.
>
>--b.
>  
>
Will do. We have one more patch (user space statd) to finish up - need 
to look into what has been changed in Neil's new nfs-util release. I 
could be his first tester (a scary thought :))..

-- Wendy



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4 Revised] NLM failover - nlm_set_igrace
@ 2007-03-29  5:31               ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-29  5:31 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: cluster-devel, nfs

J. Bruce Fields wrote:

>On Wed, Mar 28, 2007 at 12:32:40AM -0500, Wendy Cheng wrote:
>  
>
>>These are revised patches based on the discussion we had last September 
>>    
>>
>
>OK.  Would you remind just resending the revised versions of all of them
>whenever they're ready?
>
>It's just that applying patches off a web email archive is a bit of a
>pain (there's all this &amp; stuff to deal with, and who knows what it
>does to the whitespace), while we all have piles of scripts to deal with
>plain emailed patches....
>
>Looks like interesting stuff.
>
>--b.
>  
>
Will do. We have one more patch (user space statd) to finish up - need 
to look into what has been changed in Neil's new nfs-util release. I 
could be his first tester (a scary thought :))..

-- Wendy

-------------------------------------------------------------------------
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  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] [PATCH 3/4 Revised] NLM failover - statd changes
  2007-03-27 22:46   ` Wendy Cheng
  (?)
@ 2007-03-30  7:20   ` Wendy Cheng
  2007-03-30  7:25     ` Wendy Cheng
  -1 siblings, 1 reply; 30+ messages in thread
From: Wendy Cheng @ 2007-03-30  7:20 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Wendy Cheng wrote:

> Just did a browsing on 2.6.21.rc4 statd code (also with few quick test 
> runs to confirm). Look like this patch is no longer needed. I 
> tentatively withdraw this patch. Will continue the test this week. A 
> summary will be sent after all the testings are completed.
>

Neil,

I was wrong. Unlike other patches that can be individually tested, this 
patch has to combine with all other changes (including user mode statd 
patch) so my code reading deceived me. I'm mostly done but just found a 
new bug few minutes ago (that I never notice before). It is pretty late 
for me now so I'll continue tomorrow. G'night !

-- Wendy



^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Cluster-devel] [PATCH 3/4 Revised] NLM failover - statd changes
  2007-03-30  7:20   ` Wendy Cheng
@ 2007-03-30  7:25     ` Wendy Cheng
  0 siblings, 0 replies; 30+ messages in thread
From: Wendy Cheng @ 2007-03-30  7:25 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Wendy Cheng wrote:

> Wendy Cheng wrote:
>
>> Just did a browsing on 2.6.21.rc4 statd code (also with few quick 
>> test runs to confirm). Look like this patch is no longer needed. I 
>> tentatively withdraw this patch. Will continue the test this week. A 
>> summary will be sent after all the testings are completed.
>>
>
> Neil,
>
> I was wrong. Unlike other patches that can be individually tested, 
> this patch has to combine with all other changes (including user mode 
> statd patch) so my code reading deceived me. I'm mostly done but just 
> found a new bug few minutes ago (that I never notice before). It is 
> pretty late for me now so I'll continue tomorrow.
>
Sorry to bug the list for this - it was intended to be a private mail 
but somehow cluster-devel got included... Wendy



^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2007-03-30  7:25 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-14  4:44 [Cluster-devel] [PATCH 1/4 Revised] NLM failover - nlm_unlock Wendy Cheng
2006-09-14  4:44 ` Wendy Cheng
     [not found] ` <message from Wendy Cheng on Thursday September 14>
2006-09-26  0:39   ` [Cluster-devel] Re: [NFS] " Neil Brown
2006-09-26  0:39     ` Neil Brown
2007-03-23 22:55     ` [Cluster-devel] Re: [NFS] " Wendy Cheng
2007-03-23 22:55       ` Wendy Cheng
2006-09-26  0:46   ` [Cluster-devel] Re: [NFS] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace Neil Brown
2006-09-26  0:46     ` Neil Brown
2007-03-26 22:21     ` [Cluster-devel] Re: [NFS] " Wendy Cheng
2007-03-26 22:21       ` Wendy Cheng
2007-03-28  2:45       ` J. Bruce Fields
2007-03-28  2:45         ` [Cluster-devel] Re: [NFS] " J. Bruce Fields
2007-03-28  5:32         ` Wendy Cheng
2007-03-28  5:32           ` Wendy Cheng
2007-03-28 23:28           ` J. Bruce Fields
2007-03-28 23:28             ` [Cluster-devel] Re: [NFS] " J. Bruce Fields
2007-03-29  5:31             ` Wendy Cheng
2007-03-29  5:31               ` Wendy Cheng
2006-09-26  0:54   ` [Cluster-devel] Re: [NFS] [PATCH 3/4 Revised] NLM failover - statd changes Neil Brown
2006-09-26  0:54     ` Neil Brown
2006-09-26 13:42     ` [Cluster-devel] Re: [NFS] " Wendy Cheng
2006-09-26 13:42       ` Wendy Cheng
  -- strict thread matches above, loose matches on Subject: below --
2006-09-14  4:48 [Cluster-devel] [PATCH 2/4 Revised] NLM failover - nlm_set_igrace Wendy Cheng
2006-09-14  4:48 ` Wendy Cheng
2006-09-14  4:50 [Cluster-devel] [PATCH 3/4 Revised] NLM failover - statd changes Wendy Cheng
2006-09-14  4:50 ` Wendy Cheng
2007-03-27 22:46 ` [Cluster-devel] " Wendy Cheng
2007-03-27 22:46   ` Wendy Cheng
2007-03-30  7:20   ` Wendy Cheng
2007-03-30  7:25     ` Wendy Cheng

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.