All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure
@ 2018-01-11 12:11 Xiongwei Song
  2018-01-12 14:52 ` Brian Foster
  2018-01-12 16:48 ` Darrick J. Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Xiongwei Song @ 2018-01-11 12:11 UTC (permalink / raw)
  To: darrick.wong, linux-xfs; +Cc: linux-kernel

The mutex pag_ici_reclaim_lock of xfs_perag_t structure is initialized in
xfs_initialize_perag. If happen errors in xfs_initialize_perag, or free
resources in xfs_free_perag, wo need to destroy the mutex before free
perag.

Signed-off-by: Xiongwei Song <sxwjean@me.com>
---
 fs/xfs/xfs_mount.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index c879b517cc94..98fd41cbb9e1 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -162,6 +162,7 @@ xfs_free_perag(
 		ASSERT(pag);
 		ASSERT(atomic_read(&pag->pag_ref) == 0);
 		xfs_buf_hash_destroy(pag);
+		mutex_destroy(&pag->pag_ici_reclaim_lock);
 		call_rcu(&pag->rcu_head, __xfs_free_perag);
 	}
 }
@@ -248,6 +249,7 @@ xfs_initialize_perag(
 out_hash_destroy:
 	xfs_buf_hash_destroy(pag);
 out_free_pag:
+	mutex_destroy(&pag->pag_ici_reclaim_lock);
 	kmem_free(pag);
 out_unwind_new_pags:
 	/* unwind any prior newly initialized pags */
@@ -256,6 +258,7 @@ xfs_initialize_perag(
 		if (!pag)
 			break;
 		xfs_buf_hash_destroy(pag);
+		mutex_destroy(&pag->pag_ici_reclaim_lock);
 		kmem_free(pag);
 	}
 	return error;
-- 
2.15.1

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

* Re: [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure
  2018-01-11 12:11 [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure Xiongwei Song
@ 2018-01-12 14:52 ` Brian Foster
  2018-01-12 16:48 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Foster @ 2018-01-12 14:52 UTC (permalink / raw)
  To: Xiongwei Song; +Cc: darrick.wong, linux-xfs, linux-kernel

On Thu, Jan 11, 2018 at 08:11:51PM +0800, Xiongwei Song wrote:
> The mutex pag_ici_reclaim_lock of xfs_perag_t structure is initialized in
> xfs_initialize_perag. If happen errors in xfs_initialize_perag, or free
> resources in xfs_free_perag, wo need to destroy the mutex before free
> perag.
> 
> Signed-off-by: Xiongwei Song <sxwjean@me.com>
> ---

Only relevant with mutex debugging enabled I suppose, but seems
appropriate:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_mount.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index c879b517cc94..98fd41cbb9e1 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -162,6 +162,7 @@ xfs_free_perag(
>  		ASSERT(pag);
>  		ASSERT(atomic_read(&pag->pag_ref) == 0);
>  		xfs_buf_hash_destroy(pag);
> +		mutex_destroy(&pag->pag_ici_reclaim_lock);
>  		call_rcu(&pag->rcu_head, __xfs_free_perag);
>  	}
>  }
> @@ -248,6 +249,7 @@ xfs_initialize_perag(
>  out_hash_destroy:
>  	xfs_buf_hash_destroy(pag);
>  out_free_pag:
> +	mutex_destroy(&pag->pag_ici_reclaim_lock);
>  	kmem_free(pag);
>  out_unwind_new_pags:
>  	/* unwind any prior newly initialized pags */
> @@ -256,6 +258,7 @@ xfs_initialize_perag(
>  		if (!pag)
>  			break;
>  		xfs_buf_hash_destroy(pag);
> +		mutex_destroy(&pag->pag_ici_reclaim_lock);
>  		kmem_free(pag);
>  	}
>  	return error;
> -- 
> 2.15.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" 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] 3+ messages in thread

* Re: [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure
  2018-01-11 12:11 [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure Xiongwei Song
  2018-01-12 14:52 ` Brian Foster
@ 2018-01-12 16:48 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-01-12 16:48 UTC (permalink / raw)
  To: Xiongwei Song; +Cc: linux-xfs, linux-kernel

On Thu, Jan 11, 2018 at 08:11:51PM +0800, Xiongwei Song wrote:
> The mutex pag_ici_reclaim_lock of xfs_perag_t structure is initialized in
> xfs_initialize_perag. If happen errors in xfs_initialize_perag, or free
> resources in xfs_free_perag, wo need to destroy the mutex before free
> perag.
> 
> Signed-off-by: Xiongwei Song <sxwjean@me.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
>  fs/xfs/xfs_mount.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index c879b517cc94..98fd41cbb9e1 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -162,6 +162,7 @@ xfs_free_perag(
>  		ASSERT(pag);
>  		ASSERT(atomic_read(&pag->pag_ref) == 0);
>  		xfs_buf_hash_destroy(pag);
> +		mutex_destroy(&pag->pag_ici_reclaim_lock);
>  		call_rcu(&pag->rcu_head, __xfs_free_perag);
>  	}
>  }
> @@ -248,6 +249,7 @@ xfs_initialize_perag(
>  out_hash_destroy:
>  	xfs_buf_hash_destroy(pag);
>  out_free_pag:
> +	mutex_destroy(&pag->pag_ici_reclaim_lock);
>  	kmem_free(pag);
>  out_unwind_new_pags:
>  	/* unwind any prior newly initialized pags */
> @@ -256,6 +258,7 @@ xfs_initialize_perag(
>  		if (!pag)
>  			break;
>  		xfs_buf_hash_destroy(pag);
> +		mutex_destroy(&pag->pag_ici_reclaim_lock);
>  		kmem_free(pag);
>  	}
>  	return error;
> -- 
> 2.15.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" 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] 3+ messages in thread

end of thread, other threads:[~2018-01-12 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11 12:11 [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure Xiongwei Song
2018-01-12 14:52 ` Brian Foster
2018-01-12 16:48 ` Darrick J. Wong

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.