linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [MMOTM] xfs: fix dquot isolation hang
@ 2013-07-08  6:34 Dave Chinner
  2013-07-09 18:02 ` Glauber Costa
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Chinner @ 2013-07-08  6:34 UTC (permalink / raw)
  To: akpm; +Cc: xfs, linux-mm, linux-fsdevel, glommer, mhocko

From: Dave Chinner <dchinner@redhat.com>

The new LRU list isolation code in xfs_qm_dquot_isolate() isn't
completely up to date.  Firstly, it needs conversion to return enum
lru_status values, not raw numbers. Secondly - most importantly - it
fails to unlock the dquot and relock the LRU in the LRU_RETRY path.
This leads to deadlocks in xfstests generic/232. Fix them.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_qm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 46743cf..a10a720 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -659,7 +659,7 @@ xfs_qm_dquot_isolate(
 		trace_xfs_dqreclaim_want(dqp);
 		list_del_init(&dqp->q_lru);
 		XFS_STATS_DEC(xs_qm_dquot_unused);
-		return 0;
+		return LRU_REMOVED;
 	}
 
 	/*
@@ -705,17 +705,19 @@ xfs_qm_dquot_isolate(
 	XFS_STATS_DEC(xs_qm_dquot_unused);
 	trace_xfs_dqreclaim_done(dqp);
 	XFS_STATS_INC(xs_qm_dqreclaims);
-	return 0;
+	return LRU_REMOVED;
 
 out_miss_busy:
 	trace_xfs_dqreclaim_busy(dqp);
 	XFS_STATS_INC(xs_qm_dqreclaim_misses);
-	return 2;
+	return LRU_SKIP;
 
 out_unlock_dirty:
 	trace_xfs_dqreclaim_busy(dqp);
 	XFS_STATS_INC(xs_qm_dqreclaim_misses);
-	return 3;
+	xfs_dqunlock(dqp);
+	spin_lock(lru_lock);
+	return LRU_RETRY;
 }
 
 static unsigned long
-- 
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] [MMOTM] xfs: fix dquot isolation hang
  2013-07-08  6:34 [PATCH] [MMOTM] xfs: fix dquot isolation hang Dave Chinner
@ 2013-07-09 18:02 ` Glauber Costa
  0 siblings, 0 replies; 2+ messages in thread
From: Glauber Costa @ 2013-07-09 18:02 UTC (permalink / raw)
  To: Dave Chinner; +Cc: akpm, xfs, linux-mm, linux-fsdevel, glommer, mhocko

Michal and Andrew, here is the patch

On Mon, Jul 08, 2013 at 04:34:21PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> The new LRU list isolation code in xfs_qm_dquot_isolate() isn't
> completely up to date.  Firstly, it needs conversion to return enum
> lru_status values, not raw numbers. Secondly - most importantly - it
> fails to unlock the dquot and relock the LRU in the LRU_RETRY path.
> This leads to deadlocks in xfstests generic/232. Fix them.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  fs/xfs/xfs_qm.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 46743cf..a10a720 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -659,7 +659,7 @@ xfs_qm_dquot_isolate(
>  		trace_xfs_dqreclaim_want(dqp);
>  		list_del_init(&dqp->q_lru);
>  		XFS_STATS_DEC(xs_qm_dquot_unused);
> -		return 0;
> +		return LRU_REMOVED;
>  	}
>  
>  	/*
> @@ -705,17 +705,19 @@ xfs_qm_dquot_isolate(
>  	XFS_STATS_DEC(xs_qm_dquot_unused);
>  	trace_xfs_dqreclaim_done(dqp);
>  	XFS_STATS_INC(xs_qm_dqreclaims);
> -	return 0;
> +	return LRU_REMOVED;
>  
>  out_miss_busy:
>  	trace_xfs_dqreclaim_busy(dqp);
>  	XFS_STATS_INC(xs_qm_dqreclaim_misses);
> -	return 2;
> +	return LRU_SKIP;
>  
>  out_unlock_dirty:
>  	trace_xfs_dqreclaim_busy(dqp);
>  	XFS_STATS_INC(xs_qm_dqreclaim_misses);
> -	return 3;
> +	xfs_dqunlock(dqp);
> +	spin_lock(lru_lock);
> +	return LRU_RETRY;
>  }
>  
>  static unsigned long
> -- 
> 1.8.3.2
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-07-09 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-08  6:34 [PATCH] [MMOTM] xfs: fix dquot isolation hang Dave Chinner
2013-07-09 18:02 ` Glauber Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).