From patchwork Fri Sep 6 21:11:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13794754 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 826721B85F7 for ; Fri, 6 Sep 2024 21:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725657133; cv=fail; b=aQITTyY6P9KLqyUw6e2M9wuMlhU2bNQG2+/qoa1iMsxrbJOt+NoOJ/MGKOJPraLn3OxQBKEoXN66NAokhsb0gHP3mLpJsSDhVlfY3qvYhP+F3aJpRbwpj4ABjwWybE7GzyqQX7ZTgxANe8RSIzX4D7i/lvfmBlLxZoRSHd3Z3nA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725657133; c=relaxed/simple; bh=SL6+Msyz+8nviJDDpxeh0RA6u71TsjB5MgQWo2b/poc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Ar0T9nUcC5DOVuzixOzihPg7sgsKnbyOkHkS2Z6nEE5LRDSqObgaUEvCXuGyLHAYgPTbY44r08iIuMmsbWliKb6qrV2T3Sk71iTWNI6YBDmmHD9KCTDPxGIgL0fPS2o9utl7RxbU92VVo2s9c0SnWYJYxlwC7VZ839EcMq3tVts= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Joq/TL7n; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=UKf80qPI; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Joq/TL7n"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="UKf80qPI" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 486KXtQt024757 for ; Fri, 6 Sep 2024 21:12:10 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 :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=YkE3aVU1/jQ33Anan1qMlYt8quah4VIArtEQh2d4/50=; b= Joq/TL7ntH6+3csQFHyttBE1QvWFY/IC+/FPUyweSE7vL0lUcZpl53H8jA9PqEx5 Zuc/twUN/Dm6yoctsb+9kiRFA2fV4UfwgVJ6OZxGw74fHoNf3NX+HPo1uSTx462u P9sx/kP7H/nT7jWYZGtFW1vHEVQu0NLT+RElfsX7sZ69Zq1R53QQ9q+1NtIrSvDq vGmM4u9wCscxo8etIfl0PmM7DuQF5kvnwYxNbLlxkSXldygTI/yI2h3OltHTTzhX XgdVFCzh8p5AsdWCKMciUi5b727E5NPijcnsNmhFBmXQla/2Cd7s+IHuA5cOHGW6 +UlSxn0Hf2XGb/O0VlW/CQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41fhwkak37-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 06 Sep 2024 21:12:10 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 486KxM1C003353 for ; Fri, 6 Sep 2024 21:12:09 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41fhybs7e2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 06 Sep 2024 21:12:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lPL3wFE+czPs0WOhoq7FVft6JIxrtLvLZUZ+ID8+uyMqqVjy+Z2qqcVSQvfctbbPpoh5sFlmP2/wLqDplruRDGjVWruwWtEoMzj7c0/o75CF3+E/6cank6bTxJXQiLTBARYAOsKLaMpUyx+PWC9mBdn0HVPWFFfnqovD2ze7MT9/6ham4y7YlbO1WYb1mWwHFpiUQn49kqyhqwKNDU8HG21FTXqtgFiUyJSK2iA3zINmBcicHI/TS6BSVzJb8Bkb3hUK6hDdhpgqsrGxkRlzkftXGwfbj3J1CndUHUJ4DcB8w4SEFPbaLDiuGUsaTIViFx1RIBweiTuk5CQIvHOh8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YkE3aVU1/jQ33Anan1qMlYt8quah4VIArtEQh2d4/50=; b=GAtS2MTjBOmZuRi97gEx8Y5TEN2zJrlREQc/HSa0l9YmX6l8Bcvglk+olQvENzpP/G9B/9MHyG0g3z/BGlFTfDFMiNFjZGAOLq7OsEySAXp3iPKay9tV/yk7xm1U98KARHCK9VWr6XA99ZZXuLXPP7n3BsOGi2leI3ZVNU7DIE9dJGCHlQVDDlqhCSY+AxQdWdHBTUKjpMqZht7G4ho+rmU7yavxvo3Pk6TQ7LBVWQl5zaXNbxZ1clIKNvfrDIvdqKGEZ8gJY7AfB+Vfq7R+7nCJatgdpxSz1vRqdKmR4dgWVhsuEYajL1iVgYbBIX5EKWeU81xDu9uw/MCALEXA1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YkE3aVU1/jQ33Anan1qMlYt8quah4VIArtEQh2d4/50=; b=UKf80qPIFS6a6Mf0XJqoUEuuh2kPJyElh9gljxftCLVh4LHUByWUMkCXIHKI57HjwKo12qaVjd7OZHn/8eQV3aEXp0MMizy8dXErqFkGqW4qH923kdtZojLUK/NsR7RHryJNS3Tr1HYKFjAgE4vB8JBbOQPABSDi25lUD5APuqM= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by CO6PR10MB5587.namprd10.prod.outlook.com (2603:10b6:303:146::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.9; Fri, 6 Sep 2024 21:12:07 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::a63b:c94b:7ed8:4142]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::a63b:c94b:7ed8:4142%4]) with mapi id 15.20.7939.010; Fri, 6 Sep 2024 21:12:07 +0000 From: Catherine Hoang To: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 CANDIDATE 13/22] xfs: match lock mode in xfs_buffered_write_iomap_begin() Date: Fri, 6 Sep 2024 14:11:27 -0700 Message-Id: <20240906211136.70391-14-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240906211136.70391-1-catherine.hoang@oracle.com> References: <20240906211136.70391-1-catherine.hoang@oracle.com> X-ClientProxiedBy: SJ0PR13CA0108.namprd13.prod.outlook.com (2603:10b6:a03:2c5::23) To BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLAPR10MB5316:EE_|CO6PR10MB5587:EE_ X-MS-Office365-Filtering-Correlation-Id: 49aa274b-baaf-476f-405d-08dcceb8906b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: ir25Mqzm3GLCDf09O55mq2MRi1e1AnIh8KvUY+E8p49v0s97ivdQwKd6TbuMaYXqx7D7wbI53GH/AvVG1uge8AwfuY7Nl+yFgkDkjy51u61B2OW2dDdB6fSOFiEENIcqK70pgqANbqgfOpxRl8NyhtBORi1YOBVHaWpMKg3H2kqihvkhGgoR9UzSMtvNmAh/r8F5s/4Y6StI4WjBR/iCJWu+UbDyJVfL+P4KsnrE1p/G9RlgCG4fmfGCFCgWweQWJ5Znr0WC7wtZKtahof/nw5C4WHQsA59tnhMBt/k+VJh04vzcyhjWMUedDoCNsig2EFw9ZDpnTQZSfk2QWholXx+PI0A3QXe4RFtpyzXquiG3k8pjs7eG7wJkHoMP4EaFi7c0g4ekRQeC4njvvtY49SWx+es6F44vZU7zqyquo/UrKszTo2w2EXE7t+VZMMNss7BvbxeHKjH1i1kHFJcJhWzye4YML/U3QFfulQdtPIvUjdMoxQg2LOOMZblDfPHQVRaw/X6ZzrnW0cXO4xAfKCEhflfVSyc8SPSjfdh4qymJ28VI6QBIKCxlgzGQaPFoUaSFeW7aEfiKBcqxY4c6J/uDxljyjF9iuEM7LeguW0XOTqTTKzxLXGuJWDmERp1p1eGjXGEjpEvX+Lnxmd7/ivbwsAVX1QaPSvWCGqMVCQHKDNwjXjZ+cZxEFVL8k6mteJ3/VEAL7hSmjQVpWTaoRkpnrVmHigdGKKM/CKHbOfDYVdk4hjVShusYqM7Qg863T5UXp2Liwvqh+cysW0QmKc5LApDKB8RXVAr3Ma65DMmC8TaTmXfCFqdh+xRFcqZ8usBCvILhaYZ1hTEOKIvBvQpCyG75mwwGAOML4qFZUD1hvvgaCINMHRFfPuywETu3tiyf+6IotwilNTF4ZoLUGMvj9tc6+tVYSIu2qoMAJOhJxUqudvgc6MNb6r+f1/wbq9yaHTGNLY9PRcF2hl17Obr8we1iDiA2HUBaC99JGpwtf6Wbd16P8NegfOQ0JiUZLPhQx0f1DQ/HFLDUxmyblFQCO6RvtQwMyjiqRSc2hjBwMgaJ5mUe+Wt5BT9II7kx5F8ldCO12ihC3oW2thoLQJ/KN4+wfk/NP8T97cJ3lLuXWKQmKrPqau8Dtht/arcZYRSsM4nl4pOWF/Uw5eA63NH+pAOdCtuCeSpCwpr5NF7C+V3GASLRn/8S3Q3vIGDs8fcOTPJEikE5fTG/+NUhivgJ9uOtW6MEqVqa6KYZxMc5bGFw/FnFflU1005zstvH0PcrgV8BBMbjQytUrB+1gj0sDJbJYcR/O1VQ9CpddhYHtg1+exaq7NuOaM+vC9cJn8AmS+TQcL4/QeMoSVGtjw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB5316.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkC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OgbwV7HlFNG3m5Rq4NBMpccWBSSay5bXPJYy0hIBn3q2oB2TBuixkn044KPk0we99paOtS0VpjMiaDpRlKE3KTryFI2KhGXg842+1nPrVmn5il0420+iaOCg8wwCw7GuXWXk/k73pdJA7JPrm/5Rur39SScbS91EbrKpEHcH9UdLzgdoGFjLiLjfT2Ne36ENng= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49aa274b-baaf-476f-405d-08dcceb8906b X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 21:12:07.3366 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SSzDjTeBPJVOQ7aCGDuJMiq1eNBGozKUZhs1NNRRxCBqdgz7rBBcGS8X3TmCgSGlBsV+yGg6DSjPejXHZr27S2NofeAJIbbTigDFpliEy8o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5587 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_06,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409060157 X-Proofpoint-GUID: cW5Keq23OCCDzgyeu0UW-d4DnrR6u1xM X-Proofpoint-ORIG-GUID: cW5Keq23OCCDzgyeu0UW-d4DnrR6u1xM From: Zhang Yi commit bb712842a85d595525e72f0e378c143e620b3ea2 upstream. Commit 1aa91d9c9933 ("xfs: Add async buffered write support") replace xfs_ilock(XFS_ILOCK_EXCL) with xfs_ilock_for_iomap() when locking the writing inode, and a new variable lockmode is used to indicate the lock mode. Although the lockmode should always be XFS_ILOCK_EXCL, it's still better to use this variable instead of useing XFS_ILOCK_EXCL directly when unlocking the inode. Fixes: 1aa91d9c9933 ("xfs: Add async buffered write support") Signed-off-by: Zhang Yi Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang --- fs/xfs/xfs_iomap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 6e5ace7c9bc9..359aa4fc09b6 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1141,13 +1141,13 @@ xfs_buffered_write_iomap_begin( * them out if the write happens to fail. */ seq = xfs_iomap_inode_sequence(ip, IOMAP_F_NEW); - xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_iunlock(ip, lockmode); trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap); return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_NEW, seq); found_imap: seq = xfs_iomap_inode_sequence(ip, 0); - xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_iunlock(ip, lockmode); return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0, seq); found_cow: @@ -1157,17 +1157,17 @@ xfs_buffered_write_iomap_begin( if (error) goto out_unlock; seq = xfs_iomap_inode_sequence(ip, IOMAP_F_SHARED); - xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_iunlock(ip, lockmode); return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, IOMAP_F_SHARED, seq); } xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb); - xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_iunlock(ip, lockmode); return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, 0, seq); out_unlock: - xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_iunlock(ip, lockmode); return error; }