diff mbox

pnfs: Increase the refcount when LAYOUTGET fails the first time

Message ID 1357301989-10278-1-git-send-email-ycnian@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

ycnian@gmail.com Jan. 4, 2013, 12:19 p.m. UTC
From: Yanchuan Nian <ycnian@gmail.com>

The layout will be set unusable if LAYOUTGET fails. Is it reasonable to
increase the refcount iff LAYOUTGET fails the first time?

Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
---
 fs/nfs/pnfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Trond Myklebust Jan. 4, 2013, 3:51 p.m. UTC | #1
On Fri, 2013-01-04 at 20:19 +0800, ycnian@gmail.com wrote:
> From: Yanchuan Nian <ycnian@gmail.com>
> 
> The layout will be set unusable if LAYOUTGET fails. Is it reasonable to
> increase the refcount iff LAYOUTGET fails the first time?
> 
> Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
> ---
>  fs/nfs/pnfs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index e7165d9..d00260b 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -254,7 +254,7 @@ static void
>  pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit)
>  {
>  	lo->plh_retry_timestamp = jiffies;
> -	if (test_and_set_bit(fail_bit, &lo->plh_flags))
> +	if (!test_and_set_bit(fail_bit, &lo->plh_flags))
>  		atomic_inc(&lo->plh_refcount);
>  }
>  
Thank for spotting this! Applying to the bugfixes branch...
diff mbox

Patch

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e7165d9..d00260b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -254,7 +254,7 @@  static void
 pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit)
 {
 	lo->plh_retry_timestamp = jiffies;
-	if (test_and_set_bit(fail_bit, &lo->plh_flags))
+	if (!test_and_set_bit(fail_bit, &lo->plh_flags))
 		atomic_inc(&lo->plh_refcount);
 }