All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <4788665B.4020405@redhat.com>

diff --git a/a/1.txt b/N1/1.txt
index 9dcb49d..8dfc6ae 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -8,10 +8,3 @@ If agreed, please re-add your "ack-by" and "signed-off" lines
 respectively. Thanks ...
 
 -- Wendy
--------------- next part --------------
-A non-text attachment was scrubbed...
-Name: unlock_v2.patch
-Type: text/x-patch
-Size: 8535 bytes
-Desc: not available
-URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20080112/4b2b3d90/attachment.bin>
diff --git a/N1/2.hdr b/N1/2.hdr
new file mode 100644
index 0000000..0e99cb8
--- /dev/null
+++ b/N1/2.hdr
@@ -0,0 +1,5 @@
+Content-Type: text/x-patch;
+ name="unlock_v2.patch"
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline;
+ filename="unlock_v2.patch"
diff --git a/N1/2.txt b/N1/2.txt
new file mode 100644
index 0000000..16337b1
--- /dev/null
+++ b/N1/2.txt
@@ -0,0 +1,296 @@
+Two new NFSD procfs files are added:
+  /proc/fs/nfsd/unlock_ip
+  /proc/fs/nfsd/unlock_filesystem
+
+They are intended to allow admin or user mode script to release NLM locks
+based on either a path name or a server in-bound ip address (ipv4 for now)
+as;
+
+shell> echo 10.1.1.2 > /proc/fs/nfsd/unlock_ip
+shell> echo /mnt/sfs1 > /proc/fs/nfsd/unlock_filesystem
+
+Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
+Signed-off-by: Lon Hohberger  <lhh@redhat.com>
+
+ fs/lockd/svcsubs.c          |   68 ++++++++++++++++++++++++++++++++++++++------
+ fs/nfsd/nfsctl.c            |   62 ++++++++++++++++++++++++++++++++++++++++
+ include/linux/lockd/lockd.h |    7 ++++
+ 3 files changed, 129 insertions(+), 8 deletions(-)
+
+--- linux-o/fs/nfsd/nfsctl.c	2008-01-04 10:01:08.000000000 -0500
++++ linux/fs/nfsd/nfsctl.c	2008-01-11 19:08:02.000000000 -0500
+@@ -22,6 +22,7 @@
+ #include <linux/seq_file.h>
+ #include <linux/pagemap.h>
+ #include <linux/init.h>
++#include <linux/inet.h>
+ #include <linux/string.h>
+ #include <linux/smp_lock.h>
+ #include <linux/ctype.h>
+@@ -35,6 +36,7 @@
+ #include <linux/nfsd/cache.h>
+ #include <linux/nfsd/xdr.h>
+ #include <linux/nfsd/syscall.h>
++#include <linux/lockd/lockd.h>
+ 
+ #include <asm/uaccess.h>
+ 
+@@ -52,6 +54,8 @@ enum {
+ 	NFSD_Getfs,
+ 	NFSD_List,
+ 	NFSD_Fh,
++	NFSD_FO_UnlockIP,
++	NFSD_FO_UnlockFS,
+ 	NFSD_Threads,
+ 	NFSD_Pool_Threads,
+ 	NFSD_Versions,
+@@ -88,6 +92,9 @@ static ssize_t write_leasetime(struct fi
+ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
+ #endif
+ 
++static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size);
++static ssize_t failover_unlock_fs(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,
+@@ -97,6 +104,8 @@ static ssize_t (*write_op[])(struct file
+ 	[NFSD_Getfd] = write_getfd,
+ 	[NFSD_Getfs] = write_getfs,
+ 	[NFSD_Fh] = write_filehandle,
++	[NFSD_FO_UnlockIP] = failover_unlock_ip,
++	[NFSD_FO_UnlockFS] = failover_unlock_fs,
+ 	[NFSD_Threads] = write_threads,
+ 	[NFSD_Pool_Threads] = write_pool_threads,
+ 	[NFSD_Versions] = write_versions,
+@@ -288,6 +297,55 @@ static ssize_t write_getfd(struct file *
+ 	return err;
+ }
+ 
++static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size)
++{
++	__be32 server_ip;
++	char *fo_path;
++	char *mesg;
++
++	/* sanity check */
++	if (size <= 0)
++		return -EINVAL;
++
++	if (buf[size-1] == '\n')
++		buf[size-1] = 0;
++
++	fo_path = mesg = buf;
++	if (qword_get(&mesg, fo_path, size) < 0)
++		return -EINVAL;
++
++	server_ip = in_aton(fo_path);
++	return nlmsvc_failover_ip(server_ip);
++}
++
++static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size)
++{
++	struct nameidata nd;
++	char *fo_path;
++	char *mesg;
++	int error;
++
++	/* sanity check */
++	if (size <= 0)
++		return -EINVAL;
++
++	if (buf[size-1] == '\n')
++		buf[size-1] = 0;
++
++	fo_path = mesg = buf;
++	if (qword_get(&mesg, fo_path, size) < 0)
++		return -EINVAL;
++
++	error = path_lookup(fo_path, 0, &nd);
++	if (error)
++		return error;
++
++	error = nlmsvc_failover_path(&nd);
++
++	path_release(&nd);
++	return error;
++}
++
+ static ssize_t write_filehandle(struct file *file, char *buf, size_t size)
+ {
+ 	/* request is:
+@@ -646,6 +704,10 @@ static int nfsd_fill_super(struct super_
+ 		[NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR},
+ 		[NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
+ 		[NFSD_List] = {"exports", &exports_operations, S_IRUGO},
++		[NFSD_FO_UnlockIP] = {"unlock_ip",
++					&transaction_ops, S_IWUSR|S_IRUSR},
++		[NFSD_FO_UnlockFS] = {"unlock_filesystem",
++					&transaction_ops, S_IWUSR|S_IRUSR},
+ 		[NFSD_Fh] = {"filehandle", &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},
+--- linux-o/fs/lockd/svcsubs.c	2008-01-04 10:01:08.000000000 -0500
++++ linux/fs/lockd/svcsubs.c	2008-01-11 19:08:28.000000000 -0500
+@@ -18,6 +18,8 @@
+ #include <linux/lockd/lockd.h>
+ #include <linux/lockd/share.h>
+ #include <linux/lockd/sm_inter.h>
++#include <linux/module.h>
++#include <linux/mount.h>
+ 
+ #define NLMDBG_FACILITY		NLMDBG_SVCSUBS
+ 
+@@ -87,7 +89,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, 
+ 	unsigned int	hash;
+ 	__be32		nfserr;
+ 
+-	nlm_debug_print_fh("nlm_file_lookup", f);
++	nlm_debug_print_fh("nlm_lookup_file", f);
+ 
+ 	hash = file_hash(f);
+ 
+@@ -123,6 +125,9 @@ nlm_lookup_file(struct svc_rqst *rqstp, 
+ 
+ 	hlist_add_head(&file->f_list, &nlm_files[hash]);
+ 
++	/* fill in f_iaddr for nlm lock failover */
++	file->f_iaddr = rqstp->rq_daddr;
++
+ found:
+ 	dprintk("lockd: found file %p (count %d)\n", file, file->f_count);
+ 	*result = file;
+@@ -194,6 +199,12 @@ again:
+ 	return 0;
+ }
+ 
++static int
++nlmsvc_always_match(struct nlm_host *dummy1, struct nlm_host *dummy2)
++{
++	return 1;
++}
++
+ /*
+  * Inspect a single file
+  */
+@@ -230,27 +241,37 @@ nlm_file_inuse(struct nlm_file *file)
+  * Loop over all files in the file table.
+  */
+ static int
+-nlm_traverse_files(struct nlm_host *host, nlm_host_match_fn_t match)
++nlm_traverse_files(void *data, nlm_host_match_fn_t match,
++		int (*failover)(void *data, struct nlm_file *file))
+ {
+ 	struct hlist_node *pos, *next;
+ 	struct nlm_file	*file;
+-	int i, ret = 0;
++	int i, ret = 0, inspect_file;
+ 
+ 	mutex_lock(&nlm_file_mutex);
+ 	for (i = 0; i < FILE_NRHASH; i++) {
+ 		hlist_for_each_entry_safe(file, pos, next, &nlm_files[i], f_list) {
+ 			file->f_count++;
+ 			mutex_unlock(&nlm_file_mutex);
++			inspect_file = 1;
+ 
+ 			/* Traverse locks, blocks and shares of this file
+ 			 * and update file->f_locks count */
+-			if (nlm_inspect_file(host, file, match))
++
++			if (unlikely(failover)) {
++				if (!failover(data, file)) {
++					inspect_file = 0;
++					file->f_locks = nlm_file_inuse(file);
++				}
++			}
++
++			if (inspect_file && nlm_inspect_file(data, file, match))
+ 				ret = 1;
+ 
+ 			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
++			if (!file->f_locks && list_empty(&file->f_blocks)
+ 			 && !file->f_shares && !file->f_count) {
+ 				hlist_del(&file->f_list);
+ 				nlmsvc_ops->fclose(file->f_file);
+@@ -337,7 +358,7 @@ void
+ nlmsvc_mark_resources(void)
+ {
+ 	dprintk("lockd: nlmsvc_mark_resources\n");
+-	nlm_traverse_files(NULL, nlmsvc_mark_host);
++	nlm_traverse_files(NULL, nlmsvc_mark_host, NULL);
+ }
+ 
+ /*
+@@ -348,7 +369,7 @@ nlmsvc_free_host_resources(struct nlm_ho
+ {
+ 	dprintk("lockd: nlmsvc_free_host_resources\n");
+ 
+-	if (nlm_traverse_files(host, nlmsvc_same_host)) {
++	if (nlm_traverse_files(host, nlmsvc_same_host, NULL)) {
+ 		printk(KERN_WARNING
+ 			"lockd: couldn't remove all locks held by %s\n",
+ 			host->h_name);
+@@ -368,5 +389,36 @@ nlmsvc_invalidate_all(void)
+ 	 * turn, which is about as inefficient as it gets.
+ 	 * Now we just do it once in nlm_traverse_files.
+ 	 */
+-	nlm_traverse_files(NULL, nlmsvc_is_client);
++	nlm_traverse_files(NULL, nlmsvc_is_client, NULL);
++}
++
++static int
++nlmsvc_failover_file_ok_path(void *datap, struct nlm_file *file)
++{
++	struct nameidata *nd = datap;
++	return nd->mnt == file->f_file->f_path.mnt;
++}
++
++int
++nlmsvc_failover_path(struct nameidata *nd)
++{
++	return nlm_traverse_files(nd, nlmsvc_always_match,
++			nlmsvc_failover_file_ok_path);
++}
++EXPORT_SYMBOL_GPL(nlmsvc_failover_path);
++
++static int
++nlmsvc_failover_file_ok_ip(void *datap, struct nlm_file *file)
++{
++	__be32 *server_addr = datap;
++
++	return file->f_iaddr.addr.s_addr == *server_addr;
++}
++
++int
++nlmsvc_failover_ip(__be32 server_addr)
++{
++	return nlm_traverse_files(&server_addr, nlmsvc_always_match,
++			nlmsvc_failover_file_ok_ip);
+ }
++EXPORT_SYMBOL_GPL(nlmsvc_failover_ip);
+--- linux-o/include/linux/lockd/lockd.h	2008-01-04 10:01:08.000000000 -0500
++++ linux/include/linux/lockd/lockd.h	2008-01-11 18:24:45.000000000 -0500
+@@ -113,6 +113,7 @@ struct nlm_file {
+ 	unsigned int		f_locks;	/* guesstimate # of locks */
+ 	unsigned int		f_count;	/* reference count */
+ 	struct mutex		f_mutex;	/* avoid concurrent access */
++	union svc_addr_u	f_iaddr;	/* server ip for failover */
+ };
+ 
+ /*
+@@ -214,6 +215,12 @@ void		  nlmsvc_mark_resources(void);
+ void		  nlmsvc_free_host_resources(struct nlm_host *);
+ void		  nlmsvc_invalidate_all(void);
+ 
++/*
++ * Cluster failover support
++ */
++int           nlmsvc_failover_path(struct nameidata *nd);
++int           nlmsvc_failover_ip(__be32 server_addr);
++
+ static __inline__ struct inode *
+ nlmsvc_file_inode(struct nlm_file *file)
+ {
diff --git a/a/content_digest b/N1/content_digest
index 0dca0e0..35bdc02 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -5,10 +5,14 @@
  "ref\020080109180214.GA31071@infradead.org\0"
  "ref\020080110075959.GA9623@infradead.org\0"
  "From\0Wendy Cheng <wcheng@redhat.com>\0"
- "Subject\0[Cluster-devel] Re: [PATCH 1/2] NLM failover unlock commands\0"
+ "Subject\0Re: [PATCH 1/2] NLM failover unlock commands\0"
  "Date\0Sat, 12 Jan 2008 02:03:55 -0500\0"
- "To\0cluster-devel.redhat.com\0"
- "\00:1\0"
+ "To\0Christoph Hellwig <hch@infradead.org>"
+  NeilBrown <neilb@suse.de>
+ " J. Bruce Fields <bfields@fieldses.org>\0"
+ "Cc\0cluster-devel@redhat.com"
+ " NFS list <linux-nfs@vger.kernel.org>\0"
+ "\01:1\0"
  "b\0"
  "This is a combined patch that has:\n"
  "\n"
@@ -19,13 +23,305 @@
  "If agreed, please re-add your \"ack-by\" and \"signed-off\" lines \n"
  "respectively. Thanks ...\n"
  "\n"
- "-- Wendy\n"
- "-------------- next part --------------\n"
- "A non-text attachment was scrubbed...\n"
- "Name: unlock_v2.patch\n"
- "Type: text/x-patch\n"
- "Size: 8535 bytes\n"
- "Desc: not available\n"
- URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20080112/4b2b3d90/attachment.bin>
+ -- Wendy
+ "\01:2\0"
+ "fn\0unlock_v2.patch\0"
+ "b\0"
+ "Two new NFSD procfs files are added:\n"
+ "  /proc/fs/nfsd/unlock_ip\n"
+ "  /proc/fs/nfsd/unlock_filesystem\n"
+ "\n"
+ "They are intended to allow admin or user mode script to release NLM locks\n"
+ "based on either a path name or a server in-bound ip address (ipv4 for now)\n"
+ "as;\n"
+ "\n"
+ "shell> echo 10.1.1.2 > /proc/fs/nfsd/unlock_ip\n"
+ "shell> echo /mnt/sfs1 > /proc/fs/nfsd/unlock_filesystem\n"
+ "\n"
+ "Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>\n"
+ "Signed-off-by: Lon Hohberger  <lhh@redhat.com>\n"
+ "\n"
+ " fs/lockd/svcsubs.c          |   68 ++++++++++++++++++++++++++++++++++++++------\n"
+ " fs/nfsd/nfsctl.c            |   62 ++++++++++++++++++++++++++++++++++++++++\n"
+ " include/linux/lockd/lockd.h |    7 ++++\n"
+ " 3 files changed, 129 insertions(+), 8 deletions(-)\n"
+ "\n"
+ "--- linux-o/fs/nfsd/nfsctl.c\t2008-01-04 10:01:08.000000000 -0500\n"
+ "+++ linux/fs/nfsd/nfsctl.c\t2008-01-11 19:08:02.000000000 -0500\n"
+ "@@ -22,6 +22,7 @@\n"
+ " #include <linux/seq_file.h>\n"
+ " #include <linux/pagemap.h>\n"
+ " #include <linux/init.h>\n"
+ "+#include <linux/inet.h>\n"
+ " #include <linux/string.h>\n"
+ " #include <linux/smp_lock.h>\n"
+ " #include <linux/ctype.h>\n"
+ "@@ -35,6 +36,7 @@\n"
+ " #include <linux/nfsd/cache.h>\n"
+ " #include <linux/nfsd/xdr.h>\n"
+ " #include <linux/nfsd/syscall.h>\n"
+ "+#include <linux/lockd/lockd.h>\n"
+ " \n"
+ " #include <asm/uaccess.h>\n"
+ " \n"
+ "@@ -52,6 +54,8 @@ enum {\n"
+ " \tNFSD_Getfs,\n"
+ " \tNFSD_List,\n"
+ " \tNFSD_Fh,\n"
+ "+\tNFSD_FO_UnlockIP,\n"
+ "+\tNFSD_FO_UnlockFS,\n"
+ " \tNFSD_Threads,\n"
+ " \tNFSD_Pool_Threads,\n"
+ " \tNFSD_Versions,\n"
+ "@@ -88,6 +92,9 @@ static ssize_t write_leasetime(struct fi\n"
+ " static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);\n"
+ " #endif\n"
+ " \n"
+ "+static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size);\n"
+ "+static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size);\n"
+ "+\n"
+ " static ssize_t (*write_op[])(struct file *, char *, size_t) = {\n"
+ " \t[NFSD_Svc] = write_svc,\n"
+ " \t[NFSD_Add] = write_add,\n"
+ "@@ -97,6 +104,8 @@ static ssize_t (*write_op[])(struct file\n"
+ " \t[NFSD_Getfd] = write_getfd,\n"
+ " \t[NFSD_Getfs] = write_getfs,\n"
+ " \t[NFSD_Fh] = write_filehandle,\n"
+ "+\t[NFSD_FO_UnlockIP] = failover_unlock_ip,\n"
+ "+\t[NFSD_FO_UnlockFS] = failover_unlock_fs,\n"
+ " \t[NFSD_Threads] = write_threads,\n"
+ " \t[NFSD_Pool_Threads] = write_pool_threads,\n"
+ " \t[NFSD_Versions] = write_versions,\n"
+ "@@ -288,6 +297,55 @@ static ssize_t write_getfd(struct file *\n"
+ " \treturn err;\n"
+ " }\n"
+ " \n"
+ "+static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size)\n"
+ "+{\n"
+ "+\t__be32 server_ip;\n"
+ "+\tchar *fo_path;\n"
+ "+\tchar *mesg;\n"
+ "+\n"
+ "+\t/* sanity check */\n"
+ "+\tif (size <= 0)\n"
+ "+\t\treturn -EINVAL;\n"
+ "+\n"
+ "+\tif (buf[size-1] == '\\n')\n"
+ "+\t\tbuf[size-1] = 0;\n"
+ "+\n"
+ "+\tfo_path = mesg = buf;\n"
+ "+\tif (qword_get(&mesg, fo_path, size) < 0)\n"
+ "+\t\treturn -EINVAL;\n"
+ "+\n"
+ "+\tserver_ip = in_aton(fo_path);\n"
+ "+\treturn nlmsvc_failover_ip(server_ip);\n"
+ "+}\n"
+ "+\n"
+ "+static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size)\n"
+ "+{\n"
+ "+\tstruct nameidata nd;\n"
+ "+\tchar *fo_path;\n"
+ "+\tchar *mesg;\n"
+ "+\tint error;\n"
+ "+\n"
+ "+\t/* sanity check */\n"
+ "+\tif (size <= 0)\n"
+ "+\t\treturn -EINVAL;\n"
+ "+\n"
+ "+\tif (buf[size-1] == '\\n')\n"
+ "+\t\tbuf[size-1] = 0;\n"
+ "+\n"
+ "+\tfo_path = mesg = buf;\n"
+ "+\tif (qword_get(&mesg, fo_path, size) < 0)\n"
+ "+\t\treturn -EINVAL;\n"
+ "+\n"
+ "+\terror = path_lookup(fo_path, 0, &nd);\n"
+ "+\tif (error)\n"
+ "+\t\treturn error;\n"
+ "+\n"
+ "+\terror = nlmsvc_failover_path(&nd);\n"
+ "+\n"
+ "+\tpath_release(&nd);\n"
+ "+\treturn error;\n"
+ "+}\n"
+ "+\n"
+ " static ssize_t write_filehandle(struct file *file, char *buf, size_t size)\n"
+ " {\n"
+ " \t/* request is:\n"
+ "@@ -646,6 +704,10 @@ static int nfsd_fill_super(struct super_\n"
+ " \t\t[NFSD_Getfd] = {\".getfd\", &transaction_ops, S_IWUSR|S_IRUSR},\n"
+ " \t\t[NFSD_Getfs] = {\".getfs\", &transaction_ops, S_IWUSR|S_IRUSR},\n"
+ " \t\t[NFSD_List] = {\"exports\", &exports_operations, S_IRUGO},\n"
+ "+\t\t[NFSD_FO_UnlockIP] = {\"unlock_ip\",\n"
+ "+\t\t\t\t\t&transaction_ops, S_IWUSR|S_IRUSR},\n"
+ "+\t\t[NFSD_FO_UnlockFS] = {\"unlock_filesystem\",\n"
+ "+\t\t\t\t\t&transaction_ops, S_IWUSR|S_IRUSR},\n"
+ " \t\t[NFSD_Fh] = {\"filehandle\", &transaction_ops, S_IWUSR|S_IRUSR},\n"
+ " \t\t[NFSD_Threads] = {\"threads\", &transaction_ops, S_IWUSR|S_IRUSR},\n"
+ " \t\t[NFSD_Pool_Threads] = {\"pool_threads\", &transaction_ops, S_IWUSR|S_IRUSR},\n"
+ "--- linux-o/fs/lockd/svcsubs.c\t2008-01-04 10:01:08.000000000 -0500\n"
+ "+++ linux/fs/lockd/svcsubs.c\t2008-01-11 19:08:28.000000000 -0500\n"
+ "@@ -18,6 +18,8 @@\n"
+ " #include <linux/lockd/lockd.h>\n"
+ " #include <linux/lockd/share.h>\n"
+ " #include <linux/lockd/sm_inter.h>\n"
+ "+#include <linux/module.h>\n"
+ "+#include <linux/mount.h>\n"
+ " \n"
+ " #define NLMDBG_FACILITY\t\tNLMDBG_SVCSUBS\n"
+ " \n"
+ "@@ -87,7 +89,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, \n"
+ " \tunsigned int\thash;\n"
+ " \t__be32\t\tnfserr;\n"
+ " \n"
+ "-\tnlm_debug_print_fh(\"nlm_file_lookup\", f);\n"
+ "+\tnlm_debug_print_fh(\"nlm_lookup_file\", f);\n"
+ " \n"
+ " \thash = file_hash(f);\n"
+ " \n"
+ "@@ -123,6 +125,9 @@ nlm_lookup_file(struct svc_rqst *rqstp, \n"
+ " \n"
+ " \thlist_add_head(&file->f_list, &nlm_files[hash]);\n"
+ " \n"
+ "+\t/* fill in f_iaddr for nlm lock failover */\n"
+ "+\tfile->f_iaddr = rqstp->rq_daddr;\n"
+ "+\n"
+ " found:\n"
+ " \tdprintk(\"lockd: found file %p (count %d)\\n\", file, file->f_count);\n"
+ " \t*result = file;\n"
+ "@@ -194,6 +199,12 @@ again:\n"
+ " \treturn 0;\n"
+ " }\n"
+ " \n"
+ "+static int\n"
+ "+nlmsvc_always_match(struct nlm_host *dummy1, struct nlm_host *dummy2)\n"
+ "+{\n"
+ "+\treturn 1;\n"
+ "+}\n"
+ "+\n"
+ " /*\n"
+ "  * Inspect a single file\n"
+ "  */\n"
+ "@@ -230,27 +241,37 @@ nlm_file_inuse(struct nlm_file *file)\n"
+ "  * Loop over all files in the file table.\n"
+ "  */\n"
+ " static int\n"
+ "-nlm_traverse_files(struct nlm_host *host, nlm_host_match_fn_t match)\n"
+ "+nlm_traverse_files(void *data, nlm_host_match_fn_t match,\n"
+ "+\t\tint (*failover)(void *data, struct nlm_file *file))\n"
+ " {\n"
+ " \tstruct hlist_node *pos, *next;\n"
+ " \tstruct nlm_file\t*file;\n"
+ "-\tint i, ret = 0;\n"
+ "+\tint i, ret = 0, inspect_file;\n"
+ " \n"
+ " \tmutex_lock(&nlm_file_mutex);\n"
+ " \tfor (i = 0; i < FILE_NRHASH; i++) {\n"
+ " \t\thlist_for_each_entry_safe(file, pos, next, &nlm_files[i], f_list) {\n"
+ " \t\t\tfile->f_count++;\n"
+ " \t\t\tmutex_unlock(&nlm_file_mutex);\n"
+ "+\t\t\tinspect_file = 1;\n"
+ " \n"
+ " \t\t\t/* Traverse locks, blocks and shares of this file\n"
+ " \t\t\t * and update file->f_locks count */\n"
+ "-\t\t\tif (nlm_inspect_file(host, file, match))\n"
+ "+\n"
+ "+\t\t\tif (unlikely(failover)) {\n"
+ "+\t\t\t\tif (!failover(data, file)) {\n"
+ "+\t\t\t\t\tinspect_file = 0;\n"
+ "+\t\t\t\t\tfile->f_locks = nlm_file_inuse(file);\n"
+ "+\t\t\t\t}\n"
+ "+\t\t\t}\n"
+ "+\n"
+ "+\t\t\tif (inspect_file && nlm_inspect_file(data, file, match))\n"
+ " \t\t\t\tret = 1;\n"
+ " \n"
+ " \t\t\tmutex_lock(&nlm_file_mutex);\n"
+ " \t\t\tfile->f_count--;\n"
+ " \t\t\t/* No more references to this file. Let go of it. */\n"
+ "-\t\t\tif (list_empty(&file->f_blocks) && !file->f_locks\n"
+ "+\t\t\tif (!file->f_locks && list_empty(&file->f_blocks)\n"
+ " \t\t\t && !file->f_shares && !file->f_count) {\n"
+ " \t\t\t\thlist_del(&file->f_list);\n"
+ " \t\t\t\tnlmsvc_ops->fclose(file->f_file);\n"
+ "@@ -337,7 +358,7 @@ void\n"
+ " nlmsvc_mark_resources(void)\n"
+ " {\n"
+ " \tdprintk(\"lockd: nlmsvc_mark_resources\\n\");\n"
+ "-\tnlm_traverse_files(NULL, nlmsvc_mark_host);\n"
+ "+\tnlm_traverse_files(NULL, nlmsvc_mark_host, NULL);\n"
+ " }\n"
+ " \n"
+ " /*\n"
+ "@@ -348,7 +369,7 @@ nlmsvc_free_host_resources(struct nlm_ho\n"
+ " {\n"
+ " \tdprintk(\"lockd: nlmsvc_free_host_resources\\n\");\n"
+ " \n"
+ "-\tif (nlm_traverse_files(host, nlmsvc_same_host)) {\n"
+ "+\tif (nlm_traverse_files(host, nlmsvc_same_host, NULL)) {\n"
+ " \t\tprintk(KERN_WARNING\n"
+ " \t\t\t\"lockd: couldn't remove all locks held by %s\\n\",\n"
+ " \t\t\thost->h_name);\n"
+ "@@ -368,5 +389,36 @@ nlmsvc_invalidate_all(void)\n"
+ " \t * turn, which is about as inefficient as it gets.\n"
+ " \t * Now we just do it once in nlm_traverse_files.\n"
+ " \t */\n"
+ "-\tnlm_traverse_files(NULL, nlmsvc_is_client);\n"
+ "+\tnlm_traverse_files(NULL, nlmsvc_is_client, NULL);\n"
+ "+}\n"
+ "+\n"
+ "+static int\n"
+ "+nlmsvc_failover_file_ok_path(void *datap, struct nlm_file *file)\n"
+ "+{\n"
+ "+\tstruct nameidata *nd = datap;\n"
+ "+\treturn nd->mnt == file->f_file->f_path.mnt;\n"
+ "+}\n"
+ "+\n"
+ "+int\n"
+ "+nlmsvc_failover_path(struct nameidata *nd)\n"
+ "+{\n"
+ "+\treturn nlm_traverse_files(nd, nlmsvc_always_match,\n"
+ "+\t\t\tnlmsvc_failover_file_ok_path);\n"
+ "+}\n"
+ "+EXPORT_SYMBOL_GPL(nlmsvc_failover_path);\n"
+ "+\n"
+ "+static int\n"
+ "+nlmsvc_failover_file_ok_ip(void *datap, struct nlm_file *file)\n"
+ "+{\n"
+ "+\t__be32 *server_addr = datap;\n"
+ "+\n"
+ "+\treturn file->f_iaddr.addr.s_addr == *server_addr;\n"
+ "+}\n"
+ "+\n"
+ "+int\n"
+ "+nlmsvc_failover_ip(__be32 server_addr)\n"
+ "+{\n"
+ "+\treturn nlm_traverse_files(&server_addr, nlmsvc_always_match,\n"
+ "+\t\t\tnlmsvc_failover_file_ok_ip);\n"
+ " }\n"
+ "+EXPORT_SYMBOL_GPL(nlmsvc_failover_ip);\n"
+ "--- linux-o/include/linux/lockd/lockd.h\t2008-01-04 10:01:08.000000000 -0500\n"
+ "+++ linux/include/linux/lockd/lockd.h\t2008-01-11 18:24:45.000000000 -0500\n"
+ "@@ -113,6 +113,7 @@ struct nlm_file {\n"
+ " \tunsigned int\t\tf_locks;\t/* guesstimate # of locks */\n"
+ " \tunsigned int\t\tf_count;\t/* reference count */\n"
+ " \tstruct mutex\t\tf_mutex;\t/* avoid concurrent access */\n"
+ "+\tunion svc_addr_u\tf_iaddr;\t/* server ip for failover */\n"
+ " };\n"
+ " \n"
+ " /*\n"
+ "@@ -214,6 +215,12 @@ void\t\t  nlmsvc_mark_resources(void);\n"
+ " void\t\t  nlmsvc_free_host_resources(struct nlm_host *);\n"
+ " void\t\t  nlmsvc_invalidate_all(void);\n"
+ " \n"
+ "+/*\n"
+ "+ * Cluster failover support\n"
+ "+ */\n"
+ "+int           nlmsvc_failover_path(struct nameidata *nd);\n"
+ "+int           nlmsvc_failover_ip(__be32 server_addr);\n"
+ "+\n"
+ " static __inline__ struct inode *\n"
+ " nlmsvc_file_inode(struct nlm_file *file)\n"
+  {
 
-81c6deff99608cd73f76dc26c576d5dbc3f3909a5bf0939182317ff97e6a5ef9
+bcd3f89c19791330d6d056b0f097b5fc50a30af11af645f2f8fd3030cacc0034

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.