From patchwork Sun Jun 10 05:05:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10456503 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 62FCA603B4 for ; Sun, 10 Jun 2018 05:07:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53A9220700 for ; Sun, 10 Jun 2018 05:07:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4846A25D99; Sun, 10 Jun 2018 05:07:40 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 E06EC20700 for ; Sun, 10 Jun 2018 05:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932138AbeFJFHi (ORCPT ); Sun, 10 Jun 2018 01:07:38 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60962 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932086AbeFJFHf (ORCPT ); Sun, 10 Jun 2018 01:07:35 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5A57ZwK095342 for ; Sun, 10 Jun 2018 05:07:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=xWGlirR5K4h7p4oA2ASVMsWE5QZbRgZPOh4Gd8UqJiw=; b=AYCcQPVLNE5PqLRDuDSKAw6iMBpCmF/Rz0oPzPkqLViTcQDxYd2N5OmlsALH6T27W7A2 jb0jYEvspoQvhGvweYcxbbFLO91Rwj6//8E0C8yCozoLscLwxiZtsjLiJGaqFL7ncoV6 g9ttGd9U/Anz8CyO53V6Kpg4dn5gst4WspXbXmNVA2GHwud/Z7GhVF0uXEggb2r4V6+X HrFOG/fEP4ZQb6ZnMLVOEaUVytgGWRtop3ONzYaCfR06n7COYnq5Rtve6sNi5QSQwOT1 cpOFGiZT4aBIRt11H98JqWHut/lv8wwJ1sVg463UZ/3qRU9+BEJopj0W93dU2UZ0q69h 9Q== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2jg7hwstaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 10 Jun 2018 05:07:35 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5A57YxA000325 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 10 Jun 2018 05:07:34 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5A57YCg002871 for ; Sun, 10 Jun 2018 05:07:34 GMT Received: from localhost.localdomain (/72.210.40.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Jun 2018 22:07:33 -0700 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v7 15/23] xfs: Hold inode locks in xfs_ialloc Date: Sat, 9 Jun 2018 22:05:00 -0700 Message-Id: <1528607108-11059-16-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528607108-11059-1-git-send-email-allison.henderson@oracle.com> References: <1528607108-11059-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8919 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=523 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806100059 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 Modify xfs_ialloc to hold locks after return. Caller will be responsible for manual unlock. We will need this later to hold locks across parent pointer operations Signed-off-by: Allison Henderson --- fs/xfs/xfs_inode.c | 6 +++++- fs/xfs/xfs_qm.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 1cd9429..946d2c0 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -756,6 +756,8 @@ xfs_lookup( * to attach to or associate with (i.e. pip == NULL) because they * are not linked into the directory structure - they are attached * directly to the superblock - and so have no parent. + * + * Caller is responsible for unlocking the inode manually upon return */ static int xfs_ialloc( @@ -942,7 +944,7 @@ xfs_ialloc( /* * Log the new values stuffed into the inode. */ - xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); + xfs_trans_ijoin(tp, ip, 0); xfs_trans_log_inode(tp, ip, flags); /* now that we have an i_mode we can setup the inode structure */ @@ -1273,6 +1275,7 @@ xfs_create( xfs_qm_dqrele(pdqp); *ipp = ip; + xfs_iunlock(ip, XFS_ILOCK_EXCL); return 0; out_bmap_cancel: @@ -1370,6 +1373,7 @@ xfs_create_tmpfile( xfs_qm_dqrele(pdqp); *ipp = ip; + xfs_iunlock(ip, XFS_ILOCK_EXCL); return 0; out_trans_cancel: diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index ec39ae2..3ae136b 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -827,6 +827,7 @@ xfs_qm_qino_alloc( } if (need_alloc) xfs_finish_inode_setup(*ip); + xfs_iunlock(*ip, XFS_ILOCK_EXCL); return error; }