All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list.
@ 2010-05-28 17:15 J. Bruce Fields
  2010-05-28 17:15 ` [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device J. Bruce Fields
  2010-06-01  4:36 ` [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list Benny Halevy
  0 siblings, 2 replies; 5+ messages in thread
From: J. Bruce Fields @ 2010-05-28 17:15 UTC (permalink / raw)
  To: Benny Halevy; +Cc: linux-nfs, Eric Anderle, J. Bruce Fields

From: Eric Anderle <eanderle@umich.edu>

The ability to read the current device list is useful for debugging.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 fs/nfsd/nfs4pnfsdlm.c            |   25 +++++++++++++++++++++++++
 fs/nfsd/nfsctl.c                 |    4 +++-
 include/linux/nfsd/nfs4pnfsdlm.h |    2 ++
 3 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
index 0cc295c..0351d71 100644
--- a/fs/nfsd/nfs4pnfsdlm.c
+++ b/fs/nfsd/nfs4pnfsdlm.c
@@ -62,6 +62,31 @@ nfsd4_find_pnfs_dlm_device(char *disk_name)
 	return NULL;
 }
 
+ssize_t
+nfsd4_get_pnfs_dlm_device_list(char *buf, ssize_t buflen)
+{
+	char *pos = buf;
+	ssize_t size = 0;
+	struct dlm_device_entry *dlm_pdev;
+	int ret = -EINVAL;
+
+	spin_lock(&dlm_device_list_lock);
+	list_for_each_entry(dlm_pdev, &dlm_device_list, dlm_dev_list)
+	{
+		int advanced;
+		advanced = snprintf(pos, buflen - size, "%s:%s\n", dlm_pdev->disk_name, dlm_pdev->ds_list);
+		if (advanced >= buflen - size)
+			goto out;
+		size += advanced;
+		pos += advanced;
+	}
+	ret = size;
+
+out:
+	spin_unlock(&dlm_device_list_lock);
+	return ret;
+}
+
 /*
  * pnfs_dlm_device string format:
  *     block-device-path:<ds1 ipv4 address>,<ds2 ipv4 address>
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 51b0ae1..034d96f 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1352,7 +1352,9 @@ static ssize_t __write_pnfs_dlm_device(struct file *file, char *buf,
 			return ret;
 
 		ret = nfsd4_set_pnfs_dlm_device(pnfs_dlm_device, len);
-	}
+	} else
+		return nfsd4_get_pnfs_dlm_device_list(buf, SIMPLE_TRANSACTION_LIMIT);
+
 	return ret <= 0 ? ret : strlen(buf);
 }
 
diff --git a/include/linux/nfsd/nfs4pnfsdlm.h b/include/linux/nfsd/nfs4pnfsdlm.h
index a961c1e..eb31123 100644
--- a/include/linux/nfsd/nfs4pnfsdlm.h
+++ b/include/linux/nfsd/nfs4pnfsdlm.h
@@ -42,6 +42,8 @@ int nfsd4_set_pnfs_dlm_device(char *pnfs_dlm_device, int len);
 
 void nfsd4_pnfs_dlm_shutdown(void);
 
+ssize_t nfsd4_get_pnfs_dlm_device_list(char *buf, ssize_t buflen);
+
 #else /* CONFIG_PNFSD */
 
 static inline void nfsd4_pnfs_dlm_shutdown(void)
-- 
1.7.0.4


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

* [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device
  2010-05-28 17:15 [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list J. Bruce Fields
@ 2010-05-28 17:15 ` J. Bruce Fields
  2010-05-28 17:20   ` J. Bruce Fields
  2010-06-01  4:36   ` Benny Halevy
  2010-06-01  4:36 ` [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list Benny Halevy
  1 sibling, 2 replies; 5+ messages in thread
From: J. Bruce Fields @ 2010-05-28 17:15 UTC (permalink / raw)
  To: Benny Halevy; +Cc: linux-nfs, Eric Anderle, J. Bruce Fields

From: Eric Anderle <eanderle@umich.edu>

This test is obviously backwards.  Noticed because pnfs_dlm_device was
allowing us to re-add the same disk multiple times.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 fs/nfsd/nfs4pnfsdlm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
index 0351d71..1cf1b69 100644
--- a/fs/nfsd/nfs4pnfsdlm.c
+++ b/fs/nfsd/nfs4pnfsdlm.c
@@ -53,7 +53,7 @@ nfsd4_find_pnfs_dlm_device(char *disk_name)
 
 	spin_lock(&dlm_device_list_lock);
 	list_for_each_entry(dlm_pdev, &dlm_device_list, dlm_dev_list) {
-		if (memcmp(dlm_pdev->disk_name, disk_name, strlen(disk_name))) {
+		if (!memcmp(dlm_pdev->disk_name, disk_name, strlen(disk_name))) {
 			spin_unlock(&dlm_device_list_lock);
 			return dlm_pdev;
 		}
-- 
1.7.0.4


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

* Re: [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device
  2010-05-28 17:15 ` [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device J. Bruce Fields
@ 2010-05-28 17:20   ` J. Bruce Fields
  2010-06-01  4:36   ` Benny Halevy
  1 sibling, 0 replies; 5+ messages in thread
From: J. Bruce Fields @ 2010-05-28 17:20 UTC (permalink / raw)
  To: Benny Halevy; +Cc: linux-nfs, Eric Anderle

On Fri, May 28, 2010 at 01:15:21PM -0400, J. Bruce Fields wrote:
> From: Eric Anderle <eanderle@umich.edu>
> 
> This test is obviously backwards.  Noticed because pnfs_dlm_device was
> allowing us to re-add the same disk multiple times.

But how did getdeviceinfo ever work?

--b.

> 
> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
> ---
>  fs/nfsd/nfs4pnfsdlm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
> index 0351d71..1cf1b69 100644
> --- a/fs/nfsd/nfs4pnfsdlm.c
> +++ b/fs/nfsd/nfs4pnfsdlm.c
> @@ -53,7 +53,7 @@ nfsd4_find_pnfs_dlm_device(char *disk_name)
>  
>  	spin_lock(&dlm_device_list_lock);
>  	list_for_each_entry(dlm_pdev, &dlm_device_list, dlm_dev_list) {
> -		if (memcmp(dlm_pdev->disk_name, disk_name, strlen(disk_name))) {
> +		if (!memcmp(dlm_pdev->disk_name, disk_name, strlen(disk_name))) {
>  			spin_unlock(&dlm_device_list_lock);
>  			return dlm_pdev;
>  		}
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list.
  2010-05-28 17:15 [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list J. Bruce Fields
  2010-05-28 17:15 ` [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device J. Bruce Fields
@ 2010-06-01  4:36 ` Benny Halevy
  1 sibling, 0 replies; 5+ messages in thread
From: Benny Halevy @ 2010-06-01  4:36 UTC (permalink / raw)
  To: J. Bruce Fields, Eric Anderle; +Cc: linux-nfs

merged to pnfsd-files

Thanks!

Benny

On May. 28, 2010, 20:15 +0300, "J. Bruce Fields" <bfields@citi.umich.edu> wrote:
> From: Eric Anderle <eanderle@umich.edu>
> 
> The ability to read the current device list is useful for debugging.
> 
> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
> ---
>  fs/nfsd/nfs4pnfsdlm.c            |   25 +++++++++++++++++++++++++
>  fs/nfsd/nfsctl.c                 |    4 +++-
>  include/linux/nfsd/nfs4pnfsdlm.h |    2 ++
>  3 files changed, 30 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
> index 0cc295c..0351d71 100644
> --- a/fs/nfsd/nfs4pnfsdlm.c
> +++ b/fs/nfsd/nfs4pnfsdlm.c
> @@ -62,6 +62,31 @@ nfsd4_find_pnfs_dlm_device(char *disk_name)
>  	return NULL;
>  }
>  
> +ssize_t
> +nfsd4_get_pnfs_dlm_device_list(char *buf, ssize_t buflen)
> +{
> +	char *pos = buf;
> +	ssize_t size = 0;
> +	struct dlm_device_entry *dlm_pdev;
> +	int ret = -EINVAL;
> +
> +	spin_lock(&dlm_device_list_lock);
> +	list_for_each_entry(dlm_pdev, &dlm_device_list, dlm_dev_list)
> +	{
> +		int advanced;
> +		advanced = snprintf(pos, buflen - size, "%s:%s\n", dlm_pdev->disk_name, dlm_pdev->ds_list);
> +		if (advanced >= buflen - size)
> +			goto out;
> +		size += advanced;
> +		pos += advanced;
> +	}
> +	ret = size;
> +
> +out:
> +	spin_unlock(&dlm_device_list_lock);
> +	return ret;
> +}
> +
>  /*
>   * pnfs_dlm_device string format:
>   *     block-device-path:<ds1 ipv4 address>,<ds2 ipv4 address>
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 51b0ae1..034d96f 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -1352,7 +1352,9 @@ static ssize_t __write_pnfs_dlm_device(struct file *file, char *buf,
>  			return ret;
>  
>  		ret = nfsd4_set_pnfs_dlm_device(pnfs_dlm_device, len);
> -	}
> +	} else
> +		return nfsd4_get_pnfs_dlm_device_list(buf, SIMPLE_TRANSACTION_LIMIT);
> +
>  	return ret <= 0 ? ret : strlen(buf);
>  }
>  
> diff --git a/include/linux/nfsd/nfs4pnfsdlm.h b/include/linux/nfsd/nfs4pnfsdlm.h
> index a961c1e..eb31123 100644
> --- a/include/linux/nfsd/nfs4pnfsdlm.h
> +++ b/include/linux/nfsd/nfs4pnfsdlm.h
> @@ -42,6 +42,8 @@ int nfsd4_set_pnfs_dlm_device(char *pnfs_dlm_device, int len);
>  
>  void nfsd4_pnfs_dlm_shutdown(void);
>  
> +ssize_t nfsd4_get_pnfs_dlm_device_list(char *buf, ssize_t buflen);
> +
>  #else /* CONFIG_PNFSD */
>  
>  static inline void nfsd4_pnfs_dlm_shutdown(void)


-- 
Benny Halevy
Software Architect
Panasas, Inc.
bhalevy@panasas.com
Tel/Fax: +972-3-647-8340
Mobile: +972-54-802-8340

Panasas: The Leader in Parallel Storage
www.panasas.com

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

* Re: [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device
  2010-05-28 17:15 ` [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device J. Bruce Fields
  2010-05-28 17:20   ` J. Bruce Fields
@ 2010-06-01  4:36   ` Benny Halevy
  1 sibling, 0 replies; 5+ messages in thread
From: Benny Halevy @ 2010-06-01  4:36 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, Eric Anderle

merged to pnfsd-files and pnfs-all-2.6.33

Thanks!

Benny

On May. 28, 2010, 20:15 +0300, "J. Bruce Fields" <bfields@citi.umich.edu> wrote:
> From: Eric Anderle <eanderle@umich.edu>
> 
> This test is obviously backwards.  Noticed because pnfs_dlm_device was
> allowing us to re-add the same disk multiple times.
> 
> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
> ---
>  fs/nfsd/nfs4pnfsdlm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
> index 0351d71..1cf1b69 100644
> --- a/fs/nfsd/nfs4pnfsdlm.c
> +++ b/fs/nfsd/nfs4pnfsdlm.c
> @@ -53,7 +53,7 @@ nfsd4_find_pnfs_dlm_device(char *disk_name)
>  
>  	spin_lock(&dlm_device_list_lock);
>  	list_for_each_entry(dlm_pdev, &dlm_device_list, dlm_dev_list) {
> -		if (memcmp(dlm_pdev->disk_name, disk_name, strlen(disk_name))) {
> +		if (!memcmp(dlm_pdev->disk_name, disk_name, strlen(disk_name))) {
>  			spin_unlock(&dlm_device_list_lock);
>  			return dlm_pdev;
>  		}

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

end of thread, other threads:[~2010-06-01  4:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-28 17:15 [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list J. Bruce Fields
2010-05-28 17:15 ` [PATCH 2/2] pnfsd: fix test in nfsd4_find_pnfs_dlm_device J. Bruce Fields
2010-05-28 17:20   ` J. Bruce Fields
2010-06-01  4:36   ` Benny Halevy
2010-06-01  4:36 ` [PATCH 1/2] pnfsd: make /proc/fs/nfsd/pnfs_dlm_device report dlm device list Benny Halevy

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.