All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wendy Cheng <wcheng@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/3] NLM add resume procfs file
Date: Fri, 25 Jan 2008 00:15:05 -0500	[thread overview]
Message-ID: <47997059.704@redhat.com> (raw)

Add a new nfsd procfs file "resume_ip" to enable per-ip base lockd grace 
period:

Example Usage:
root-shell> echo 10.1.1.64 > /proc/fs/nfsd/resume_ip

Only support IPV4 address for this patch submission.

-- Wendy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: resume_001.patch
Type: text/x-patch
Size: 4357 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20080125/9266b25f/attachment.bin>

WARNING: multiple messages have this Message-ID (diff)
From: Wendy Cheng <wcheng@redhat.com>
To: NFS list <linux-nfs@vger.kernel.org>, cluster-devel@redhat.com
Subject: [PATCH 1/3] NLM add resume procfs file
Date: Fri, 25 Jan 2008 00:15:05 -0500	[thread overview]
Message-ID: <47997059.704@redhat.com> (raw)

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

Add a new nfsd procfs file "resume_ip" to enable per-ip base lockd grace 
period:

Example Usage:
root-shell> echo 10.1.1.64 > /proc/fs/nfsd/resume_ip

Only support IPV4 address for this patch submission.

-- Wendy


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

Add a new nfsd procfs file "resume_ip" to enable per-ip base lockd grace 
period:

Example Usage:
root-shell> echo 10.1.1.64 > /proc/fs/nfsd/resume_ip

Only support IPV4 address for this patch submission.

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

 fs/lockd/svcsubs.c          |    9 +++++++++
 fs/nfsd/nfsctl.c            |   43 ++++++++++++++++++++++++++++++++++++++-----
 include/linux/lockd/lockd.h |    1 +
 3 files changed, 48 insertions(+), 5 deletions(-)

--- linux-1/fs/nfsd/nfsctl.c	2008-01-22 10:36:24.000000000 -0500
+++ linux-2/fs/nfsd/nfsctl.c	2008-01-24 17:03:12.000000000 -0500
@@ -56,6 +56,7 @@ enum {
 	NFSD_Fh,
 	NFSD_FO_UnlockIP,
 	NFSD_FO_UnlockFS,
+	NFSD_FO_ResumeIP,
 	NFSD_Threads,
 	NFSD_Pool_Threads,
 	NFSD_Versions,
@@ -94,6 +95,7 @@ static ssize_t write_recoverydir(struct 
 
 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 failover_resume_ip(struct file *file, char *buf, size_t size);
 
 static ssize_t (*write_op[])(struct file *, char *, size_t) = {
 	[NFSD_Svc] = write_svc,
@@ -106,6 +108,7 @@ static ssize_t (*write_op[])(struct file
 	[NFSD_Fh] = write_filehandle,
 	[NFSD_FO_UnlockIP] = failover_unlock_ip,
 	[NFSD_FO_UnlockFS] = failover_unlock_fs,
+	[NFSD_FO_ResumeIP] = failover_resume_ip,
 	[NFSD_Threads] = write_threads,
 	[NFSD_Pool_Threads] = write_pool_threads,
 	[NFSD_Versions] = write_versions,
@@ -297,11 +300,13 @@ static ssize_t write_getfd(struct file *
 	return err;
 }
 
-static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size)
+static int failover_parse_ip(struct file *file,
+			     char *buf,
+			     size_t size,
+			     __be32 *server_ip)
 {
-	__be32 server_ip;
 	char *fo_path, c;
-	int b1, b2, b3, b4;
+	int b1, b2, b3, b4, len;
 
 	/* sanity check */
 	if (size == 0)
@@ -315,13 +320,39 @@ static ssize_t failover_unlock_ip(struct
 		return -EINVAL;
 
 	/* get ipv4 address */
-	if (sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4)
+	len = sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c);
+	if (len != 4)
 		return -EINVAL;
-	server_ip = htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
+
+	*server_ip = htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
+
+	return len;
+}
+
+static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size)
+{
+	__be32 server_ip;
+	int rc;
+
+	rc = failover_parse_ip(file, buf, size, &server_ip);
+	if (rc < 0)
+		return rc;
 
 	return nlmsvc_failover_ip(server_ip);
 }
 
+static ssize_t failover_resume_ip(struct file *file, char *buf, size_t size)
+{
+	__be32 server_ip;
+	int len;
+
+	len = failover_parse_ip(file, buf, size, &server_ip);
+	if (len < 0)
+		return len;
+
+	return nlmsvc_failover_setgrace(&server_ip, len);
+}
+
 static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size)
 {
 	struct nameidata nd;
@@ -711,6 +742,8 @@ static int nfsd_fill_super(struct super_
 					&transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_FO_UnlockFS] = {"unlock_filesystem",
 					&transaction_ops, S_IWUSR|S_IRUSR},
+		[NFSD_FO_ResumeIP] = {"resume_ip",
+					&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-1/fs/lockd/svcsubs.c	2008-01-22 10:36:24.000000000 -0500
+++ linux-2/fs/lockd/svcsubs.c	2008-01-22 11:45:44.000000000 -0500
@@ -422,3 +422,12 @@ nlmsvc_failover_ip(__be32 server_addr)
 			nlmsvc_failover_file_ok_ip);
 }
 EXPORT_SYMBOL_GPL(nlmsvc_failover_ip);
+
+int
+nlmsvc_failover_setgrace(void *server_ip, int ip_size)
+{
+	/* implemented by resume_002.patch */
+	return ENOSYS;
+}
+EXPORT_SYMBOL_GPL(nlmsvc_failover_setgrace);
+
--- linux-1/include/linux/lockd/lockd.h	2008-01-22 10:36:24.000000000 -0500
+++ linux-2/include/linux/lockd/lockd.h	2008-01-22 11:45:44.000000000 -0500
@@ -220,6 +220,7 @@ void		  nlmsvc_invalidate_all(void);
  */
 int           nlmsvc_failover_path(struct nameidata *nd);
 int           nlmsvc_failover_ip(__be32 server_addr);
+int           nlmsvc_failover_setgrace(void *server_ip, int ip_size);
 
 static __inline__ struct inode *
 nlmsvc_file_inode(struct nlm_file *file)

             reply	other threads:[~2008-01-25  5:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-25  5:15 Wendy Cheng [this message]
2008-01-25  5:15 ` [PATCH 1/3] NLM add resume procfs file Wendy Cheng
2008-01-29  2:19 ` [Cluster-devel] " J. Bruce Fields
2008-01-29  2:19   ` J. Bruce Fields
2008-01-29  2:29   ` [Cluster-devel] " J. Bruce Fields
2008-01-29  2:29     ` J. Bruce Fields
2008-01-30 16:43   ` [Cluster-devel] " Wendy Cheng
2008-01-30 16:43     ` Wendy Cheng
2008-02-01 17:24     ` [Cluster-devel] " J. Bruce Fields
2008-02-01 17:24       ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47997059.704@redhat.com \
    --to=wcheng@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.