Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964873AbeALQsL (ORCPT + 1 other); Fri, 12 Jan 2018 11:48:11 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:47994 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934081AbeALQsK (ORCPT ); Fri, 12 Jan 2018 11:48:10 -0500 Date: Fri, 12 Jan 2018 08:48:05 -0800 From: "Darrick J. Wong" To: Xiongwei Song Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure Message-ID: <20180112164805.GX5602@magnolia> References: <20180111121151.13197-1-sxwjean@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180111121151.13197-1-sxwjean@me.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8772 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=9 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=947 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801120229 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 Looks ok, Reviewed-by: Darrick J. Wong > --- > 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