From patchwork Thu Jan 11 12:11:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiongwei Song X-Patchwork-Id: 10157987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD578602D8 for ; Thu, 11 Jan 2018 13:12:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 753AF26E76 for ; Thu, 11 Jan 2018 13:12:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6974E286FE; Thu, 11 Jan 2018 13:12:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E692426E76 for ; Thu, 11 Jan 2018 13:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523AbeAKNMQ (ORCPT ); Thu, 11 Jan 2018 08:12:16 -0500 Received: from pv33p00im-asmtp003.me.com ([17.142.194.252]:48855 "EHLO pv33p00im-asmtp003.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752507AbeAKNMQ (ORCPT ); Thu, 11 Jan 2018 08:12:16 -0500 X-Greylist: delayed 3611 seconds by postgrey-1.27 at vger.kernel.org; Thu, 11 Jan 2018 08:12:15 EST Received: from process-dkim-sign-daemon.pv33p00im-asmtp003.me.com by pv33p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2E00G0040WF000@pv33p00im-asmtp003.me.com>; Thu, 11 Jan 2018 12:12:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1515672722; bh=brOzlAlifFt1FTLf0yzepQUnQ3MTx/KiLqlQFn+YtOw=; h=From:To:Subject:Date:Message-id; b=Q5cZnHvTMFgA0MAEwXqtBqTBtnVykkRpt5liAqZjNq2o1Eml2rm33AKx4M0EbAgwI 3+SyWNZY5h1YuqWIR6FoIntSCwWBESxQZ977Q6S9Mi3JIa1Obic/x98S8+O9WHY7eb ekvwGWqSuNMvX+6aJosBSMmgLNk+Re7WvOeMYMCmLSVn+foIY7ujSy9qPPMfbqYss7 0dSpsTt0eiJYaB7uXG+0kb2htb1Nd5YXrX6Av7dff9+e17NdlG+r4yVmJO4HNq2ZBx woc9aCH8FNZpNdWI1psvVK/ELB8ndt7BZ1XlhPRSqbcU8EcCgNf0s0yWUmo0Fmg8By SetLpCN86cU9w== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2E00G6T4JRDW00@pv33p00im-asmtp003.me.com>; Thu, 11 Jan 2018 12:12:00 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-11_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801110169 From: Xiongwei Song To: darrick.wong@oracle.com, linux-xfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] xfs: destroy mutex pag_ici_reclaim_lock before free xfs_perag_t structure Date: Thu, 11 Jan 2018 20:11:51 +0800 Message-id: <20180111121151.13197-1-sxwjean@me.com> X-Mailer: git-send-email 2.15.1 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Brian Foster 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;