From patchwork Wed Mar 27 00:12:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605359 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 E3212A2A; Wed, 27 Mar 2024 00:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498371; cv=fail; b=DhRbdo+kDv/qAo2Kn5kwd0mp07KY6fYzn3nw4MkX7l/BlrunpnmDeQKqTlWgVBD3grRarbDj11uGzhef2m3BSE6YJTJnWIi9UD1GjVgGgWcBEsEkOa1XIyQQ6BWVCQmY73+C7s9mv0LZFA5H2elwKBksxfipHfBKVSbI36T3QqE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498371; c=relaxed/simple; bh=z3x3D0uP5Uf43xzYr8aToVT4uQ6YgEwi1uR9fa/Nd3Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=sdwVM+tNI+ipY1TjeoUY5Ftg7mMPHSUMwWBd85X0qn8+88gdWuEQ2YionV5r5KoVPrTkxzNrQQIDXuaoX87PnbKfCaeHMffTF72CeLM9UTEprGzedsdqB4smpBmNxrF0acvdvCIFj9AOx40HyghaocSXrdlQg8WHAxdLtRVYWFo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=m9VMHur4; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ECrJ5QDA; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="m9VMHur4"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ECrJ5QDA" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLibh3032020; Wed, 27 Mar 2024 00:12:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=OHbepO+vOat9oHV3I0+C9Q0b7W4yYaoTObUT1FLVO/Y=; b=m9VMHur4HPK29MO445jNaWZJYEpaMHdoTp35dUo1fvQvxqf4w/a5ufWBQD3Kk/18jDFd 4LHz9fzufZIHjnyLnKiKALEOM/ntUT99QxLsCwvbUCrJs578WMHDR4WsodKEzEOqGnKA 7cYV9tgkm0HOrdpnPaTV0JH682bUu4RdaA2eKmNkAY6xJ4h6guHS9L+6JkKYYvW6hcg/ lv7f6ccikUNA4NzfcycixAG1M8d/PLQdSwEpIi489NhIdFKen/9yaft3BcS1qmBHeXGX 2ALIsx1UeFcMQc/P/XwPPocdyF3IemMHQkqI5wzGXpl184atYw+y4bkpchbXcutdS7I/ 6A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x28ct5n2j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:47 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05Hv3004731; Wed, 27 Mar 2024 00:12:47 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh80hmu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PnZN3xnha8P1nm32shRZvoOojq3b1YKhM2ANGqMtaEqv8fTLtDjOrpKFeXXrYw4DKvknsittIJY/H7j+67Hgwv2wSxh7QCS6hDZxJJg6mC2xFLiHMKX2ZlqNEnjD/PA8q++OPNOuQG7jUKVtcXOXhiC41EUaRuo/HhNXRQGXKjrii2KGVsiO4kadJ03vCXrVXXdJsxt4C1ot8UZ06McKM7p21RPawhk/MrZHJ7qCkGmyMoqI/U84FufiDUIILtm2SbBR42KlJbFGzf+5SAU4IOqil6FN1B42ccB07SKHeHaWcZmZwEjFSVW7XyoiQCWwgKTNrQlneAk97bIEYOXyhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=OHbepO+vOat9oHV3I0+C9Q0b7W4yYaoTObUT1FLVO/Y=; b=Y1hriiTKavHI8LTXnZRB5e6CEhdT0eQgm7OhzROaqsSFS9RP1V70GBtTVTcgXYg0ZivxaCs3QM1JsvuvsowwRl09R5Z1lxI0v1bgXM3IN8ERZLWNBiZdHF8lseGncCJnjHUlJWQksgWPW301L4U9uGvHWt/6wRkQaQitYgWO/fr/4tEreK5yfgMIfX7EuR1gb9V65pKydHag0sB2u5fPnRZ3vwSw9WTObYAQ7fncOG9uW/ICaM8t5VGE4wo2BkwhUS4VANLsYIAjnZM73zTD6l1+GOqn+pc07z/wvWm4zv5R8/hsg7IQ+lm7dURwQ+3X3SdpVeBfPC3T+cpUjLZP5g== 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=OHbepO+vOat9oHV3I0+C9Q0b7W4yYaoTObUT1FLVO/Y=; b=ECrJ5QDAsg90dFKn7PLSHQicgpFMm/cLzenv3VNmtDjPIhwz4cuF0FKcr8htaXX+0S8PrCZIq8ikl8+Pg0jrhK6KsDokLP3iN5GT4wTQ5Mbb5G/lmE4f3TZUVTe3UVe8RTLXbb3eN44vQn9nlkrog2lsTIMS5hw1oUdF+ZCBetY= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by PH7PR10MB6226.namprd10.prod.outlook.com (2603:10b6:510:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:12:45 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:45 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 01/24] xfs: move the xfs_rtbitmap.c declarations to xfs_rtbitmap.h Date: Tue, 26 Mar 2024 17:12:10 -0700 Message-Id: <20240327001233.51675-2-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0003.namprd05.prod.outlook.com (2603:10b6:a03:c0::16) 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_|PH7PR10MB6226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PM1XpvGfSp2QcGxWCchRDeTHXuzmW5n7qWyCB7ClZomxS6rRJj3g5R2s9MisD1CZXCc0g7mMEWpZxPFIzxZLKAC1PnyjkBqz2k7Y1SVXxGIwxpT+Z3+D7uS1c6zW7rugkzTpYwvi1KI/Uw2QbaWp/ZMYOknet8nUE2AI7orb516vg8yHkDtvwU+x8uLMGwBvJYyhVk3trQHGYW2IVvTh5qahDNT89saw2Sz+nKJDZ7Qv/Q8aZBxiMTg4G2bvwQ9Ydo/DjyhcOCFB0xv/VCFeWXXVpuz+6aBPtZp02Gel5Kan73vE/oz51no/lstUBtHk1jI3vHozvP53m0Ij+hqn16N6qDG9hugq33ysqxHnydXHXF/pMEm4LkwOvE8JBZs/1qLX68DADZTDTZvaYZQPhQW8JNE/tGga2UQ6zTdZWgRzC/GQQ0eH15273ndO5DatyFB/+pviSBud7vuG+julXKT2RXMKdtwdbtcTenulOVRWv/FgT8Pz1MPpxZhSVCfcwsaPFgiQ/eq+NqZyE+5RAYEHiOEZdpn8SiUl0+oOZkSqc0Y5mbsCci5qkPOduAVOTN63tjNJhhsj39PGSl7N12TbjuLeSOO2ozdRZqjmiTQM6wCbS6jrwa6TDoyBw6zQP22Qp4COcAE5aHbf5hZhHiqmAIOSrDeCd5QvS+9QsQM= 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:(13230031)(1800799015)(366007)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wZPxBok49wT3cbsjw1jnLscdnJbwn/0QHToVwzM7/IntSM6Hk3k1QAFZYzrr1YcBVJKQ4fMrmIWU1M5nI/Xieq0uJr88nJMpuFHA4SZWFnsZ7/tKZOF1dQDvy0Ib6Hb+Zkm1VCtEDcLDGnYqJ9RSS1PXZwTWfk5xUzrT28gicVfZTloUTe5wYmFtzm2q8JTkAS/G3Qq3dGT/DfAn/sJaPY4O95smeWZ3etgzDn9WePbiSDdrf6/dbZLjdbeXq+krWbvN9E3/Rm907zNKxSdGx7wE+ffGap18BgH/dz6o4u5U6eoZp1dZGZ6ZTK90FzNc9I1UCye4KjvTC5ZQvI9AzcVhPBuwD80oxszjmegLv95ky1baFw998kLLAi0M+4pg0+WF7pwwFVNW5SnrQRaNx/XJUkzqDTLT08KQd3ooopbqQxEBS4ZyEgCmZ2OkXbcT4xk57sZHe1WU4GQgj+8fX4iVUFTzl6oglUCKYvbQ4Mb7+hcuMAqG/Jghnz0mQ2t5m0pZy6Iim73zICtvTNRJt2FnWIGpBbYMm4ftNa67DwBH5TTCPr21u3fcaxa3pxijRtjOtF1v1nGZSZ1YZZae6S3ygFOEMZWvZ5MNZqFOuVSVSU0OV+Vobcy3n0xFHI+FoMbdCqP3tu+gqhRJxUnL1QB/9NV1jRucyY/qBiml6pEFPNy2Y8TCaMgDQR+uiLCR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EH7Qlbg7FLWlt8aFb2nAMhJ7DsNK0cHI5yFwWKGH196g0SGZNPN1/djDZie8kzxRXezOZcXr1pHvRpgCz/OxO13/qTRq4wpUoQR/koT/VLMgoHyndYN4KmpHxKk4Vqqqbb6Uhl4Y/gVoPnAyiB2wefpIA80AJAYcnKd8siYQPpt9n10uUR/kf/PKT8L/oZcLXO1USIDTkgXRDK/Zb33KVaS9DXbe3lDBlz1xER9Gyg+sFjJAUEaeThn9LjHkz8O7yXWnctANXh0DmJmdLWj0jFHyP1nEGez1RwrxvIrEcd/evLrRK7L5+BQpIUMQHv1DMIiZWfIO2xrutsLL6Sx8WWQkLD5wUdwsaQpUNDGwHG5ZcrZFBxC1VFG+MhkPcZ3joRiNLh6OGvLlBvQNSpWvJdmF1iTvF10SfRZR7woNbXjoRDcKA4BsCtHfD6FPAPG1gViVMUUDBrkPCDivK8qSw9XGUR2eCpNwIfUZZaFbiP2vDXJSpWhFJ7PkeFHImt8VqAiipxavlZ8xCWfFn100a9hfyoZsa3H1XnsjVlmj1RJSAegqb+UGyv+Os6BRDeUDpPzOhAlTt6sZ5ylYxlqaiwpZ9s= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf4b1af0-0e79-4be3-6184-08dc4df2a084 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:45.2062 (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: JMTUV6LCoUE32it8E3M4BW240gdolWcKXZmXNO6zWhiu1AIc4Zz/gjJ5Wi+UXkIbU5T6uEp22vR5OTTBwSiDgIXhMJ1S8zYp/5u5yyTTV1g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6226 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: BIpRWHHL_PpyzyKgxZ9PjNH8C4AIg1Yg X-Proofpoint-ORIG-GUID: BIpRWHHL_PpyzyKgxZ9PjNH8C4AIg1Yg From: "Darrick J. Wong" commit 13928113fc5b5e79c91796290a99ed991ac0efe2 upstream. Move all the declarations for functionality in xfs_rtbitmap.c into a separate xfs_rtbitmap.h header file. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 2 +- fs/xfs/libxfs/xfs_rtbitmap.c | 1 + fs/xfs/libxfs/xfs_rtbitmap.h | 82 ++++++++++++++++++++++++++++++++++++ fs/xfs/scrub/fscounters.c | 2 +- fs/xfs/scrub/rtbitmap.c | 2 +- fs/xfs/scrub/rtsummary.c | 2 +- fs/xfs/xfs_fsmap.c | 2 +- fs/xfs/xfs_rtalloc.c | 1 + fs/xfs/xfs_rtalloc.h | 73 -------------------------------- 9 files changed, 89 insertions(+), 78 deletions(-) create mode 100644 fs/xfs/libxfs/xfs_rtbitmap.h diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 617cc7e78e38..a47da8d3d1bc 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -21,7 +21,7 @@ #include "xfs_bmap.h" #include "xfs_bmap_util.h" #include "xfs_bmap_btree.h" -#include "xfs_rtalloc.h" +#include "xfs_rtbitmap.h" #include "xfs_errortag.h" #include "xfs_error.h" #include "xfs_quota.h" diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c index 655108a4cd05..9eb1b5aa7e35 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c @@ -16,6 +16,7 @@ #include "xfs_trans.h" #include "xfs_rtalloc.h" #include "xfs_error.h" +#include "xfs_rtbitmap.h" /* * Realtime allocator bitmap functions shared with userspace. diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h new file mode 100644 index 000000000000..546dea34bb37 --- /dev/null +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. + * All Rights Reserved. + */ +#ifndef __XFS_RTBITMAP_H__ +#define __XFS_RTBITMAP_H__ + +/* + * XXX: Most of the realtime allocation functions deal in units of realtime + * extents, not realtime blocks. This looks funny when paired with the type + * name and screams for a larger cleanup. + */ +struct xfs_rtalloc_rec { + xfs_rtblock_t ar_startext; + xfs_rtblock_t ar_extcount; +}; + +typedef int (*xfs_rtalloc_query_range_fn)( + struct xfs_mount *mp, + struct xfs_trans *tp, + const struct xfs_rtalloc_rec *rec, + void *priv); + +#ifdef CONFIG_XFS_RT +int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t block, int issum, struct xfs_buf **bpp); +int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, int val, + xfs_rtblock_t *new, int *stat); +int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_rtblock_t limit, + xfs_rtblock_t *rtblock); +int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_rtblock_t limit, + xfs_rtblock_t *rtblock); +int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, int val); +int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp, + int log, xfs_rtblock_t bbno, int delta, + struct xfs_buf **rbpp, xfs_fsblock_t *rsb, + xfs_suminfo_t *sum); +int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log, + xfs_rtblock_t bbno, int delta, struct xfs_buf **rbpp, + xfs_fsblock_t *rsb); +int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, + struct xfs_buf **rbpp, xfs_fsblock_t *rsb); +int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp, + const struct xfs_rtalloc_rec *low_rec, + const struct xfs_rtalloc_rec *high_rec, + xfs_rtalloc_query_range_fn fn, void *priv); +int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtalloc_query_range_fn fn, + void *priv); +bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno); +int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, + bool *is_free); +/* + * Free an extent in the realtime subvolume. Length is expressed in + * realtime extents, as is the block number. + */ +int /* error */ +xfs_rtfree_extent( + struct xfs_trans *tp, /* transaction pointer */ + xfs_rtblock_t bno, /* starting block number to free */ + xfs_extlen_t len); /* length of extent freed */ + +/* Same as above, but in units of rt blocks. */ +int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, + xfs_filblks_t rtlen); +#else /* CONFIG_XFS_RT */ +# define xfs_rtfree_extent(t,b,l) (-ENOSYS) +# define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS) +# define xfs_rtalloc_query_range(m,t,l,h,f,p) (-ENOSYS) +# define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS) +# define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS) +# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS) +#endif /* CONFIG_XFS_RT */ + +#endif /* __XFS_RTBITMAP_H__ */ diff --git a/fs/xfs/scrub/fscounters.c b/fs/xfs/scrub/fscounters.c index 05be757668bb..5799e9a94f1f 100644 --- a/fs/xfs/scrub/fscounters.c +++ b/fs/xfs/scrub/fscounters.c @@ -16,7 +16,7 @@ #include "xfs_health.h" #include "xfs_btree.h" #include "xfs_ag.h" -#include "xfs_rtalloc.h" +#include "xfs_rtbitmap.h" #include "xfs_inode.h" #include "xfs_icache.h" #include "scrub/scrub.h" diff --git a/fs/xfs/scrub/rtbitmap.c b/fs/xfs/scrub/rtbitmap.c index 008ddb599e13..2e5fd52f7af3 100644 --- a/fs/xfs/scrub/rtbitmap.c +++ b/fs/xfs/scrub/rtbitmap.c @@ -11,7 +11,7 @@ #include "xfs_mount.h" #include "xfs_log_format.h" #include "xfs_trans.h" -#include "xfs_rtalloc.h" +#include "xfs_rtbitmap.h" #include "xfs_inode.h" #include "xfs_bmap.h" #include "scrub/scrub.h" diff --git a/fs/xfs/scrub/rtsummary.c b/fs/xfs/scrub/rtsummary.c index 437ed9acbb27..f4635a920470 100644 --- a/fs/xfs/scrub/rtsummary.c +++ b/fs/xfs/scrub/rtsummary.c @@ -13,7 +13,7 @@ #include "xfs_inode.h" #include "xfs_log_format.h" #include "xfs_trans.h" -#include "xfs_rtalloc.h" +#include "xfs_rtbitmap.h" #include "xfs_bit.h" #include "xfs_bmap.h" #include "scrub/scrub.h" diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index 736e5545f584..8982c5d6cbd0 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -23,7 +23,7 @@ #include "xfs_refcount.h" #include "xfs_refcount_btree.h" #include "xfs_alloc_btree.h" -#include "xfs_rtalloc.h" +#include "xfs_rtbitmap.h" #include "xfs_ag.h" /* Convert an xfs_fsmap to an fsmap. */ diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 0e4e2df08aed..f2eb0c8b595d 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -19,6 +19,7 @@ #include "xfs_icache.h" #include "xfs_rtalloc.h" #include "xfs_sb.h" +#include "xfs_rtbitmap.h" /* * Read and return the summary information for a given extent size, diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h index 65c284e9d33e..11859c259a1c 100644 --- a/fs/xfs/xfs_rtalloc.h +++ b/fs/xfs/xfs_rtalloc.h @@ -11,22 +11,6 @@ struct xfs_mount; struct xfs_trans; -/* - * XXX: Most of the realtime allocation functions deal in units of realtime - * extents, not realtime blocks. This looks funny when paired with the type - * name and screams for a larger cleanup. - */ -struct xfs_rtalloc_rec { - xfs_rtblock_t ar_startext; - xfs_rtblock_t ar_extcount; -}; - -typedef int (*xfs_rtalloc_query_range_fn)( - struct xfs_mount *mp, - struct xfs_trans *tp, - const struct xfs_rtalloc_rec *rec, - void *priv); - #ifdef CONFIG_XFS_RT /* * Function prototypes for exported functions. @@ -48,19 +32,6 @@ xfs_rtallocate_extent( xfs_extlen_t prod, /* extent product factor */ xfs_rtblock_t *rtblock); /* out: start block allocated */ -/* - * Free an extent in the realtime subvolume. Length is expressed in - * realtime extents, as is the block number. - */ -int /* error */ -xfs_rtfree_extent( - struct xfs_trans *tp, /* transaction pointer */ - xfs_rtblock_t bno, /* starting block number to free */ - xfs_extlen_t len); /* length of extent freed */ - -/* Same as above, but in units of rt blocks. */ -int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, - xfs_filblks_t rtlen); /* * Initialize realtime fields in the mount structure. @@ -102,55 +73,11 @@ xfs_growfs_rt( struct xfs_mount *mp, /* file system mount structure */ xfs_growfs_rt_t *in); /* user supplied growfs struct */ -/* - * From xfs_rtbitmap.c - */ -int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t block, int issum, struct xfs_buf **bpp); -int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t start, xfs_extlen_t len, int val, - xfs_rtblock_t *new, int *stat); -int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t start, xfs_rtblock_t limit, - xfs_rtblock_t *rtblock); -int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t start, xfs_rtblock_t limit, - xfs_rtblock_t *rtblock); -int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t start, xfs_extlen_t len, int val); -int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp, - int log, xfs_rtblock_t bbno, int delta, - struct xfs_buf **rbpp, xfs_fsblock_t *rsb, - xfs_suminfo_t *sum); -int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log, - xfs_rtblock_t bbno, int delta, struct xfs_buf **rbpp, - xfs_fsblock_t *rsb); -int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t start, xfs_extlen_t len, - struct xfs_buf **rbpp, xfs_fsblock_t *rsb); -int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp, - const struct xfs_rtalloc_rec *low_rec, - const struct xfs_rtalloc_rec *high_rec, - xfs_rtalloc_query_range_fn fn, void *priv); -int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtalloc_query_range_fn fn, - void *priv); -bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno); -int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp, - xfs_rtblock_t start, xfs_extlen_t len, - bool *is_free); int xfs_rtalloc_reinit_frextents(struct xfs_mount *mp); #else # define xfs_rtallocate_extent(t,b,min,max,l,f,p,rb) (-ENOSYS) -# define xfs_rtfree_extent(t,b,l) (-ENOSYS) -# define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS) # define xfs_rtpick_extent(m,t,l,rb) (-ENOSYS) # define xfs_growfs_rt(mp,in) (-ENOSYS) -# define xfs_rtalloc_query_range(m,t,l,h,f,p) (-ENOSYS) -# define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS) -# define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS) -# define xfs_verify_rtbno(m, r) (false) -# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS) # define xfs_rtalloc_reinit_frextents(m) (0) static inline int /* error */ xfs_rtmount_init( From patchwork Wed Mar 27 00:12:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605360 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 56A09DDA0; Wed, 27 Mar 2024 00:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498374; cv=fail; b=WPC/hlAM4CidWGkSKMr7gbQNgqVkDkJlATxxiS8b7Jh5x5XsfCgCNuMf4JBx1lSMhXP/cPfWUZanbkz0RvBLgoch2DiWc/zl6/XE+0NlacZtYDYQ6mRtOuY7wMbT51FJmO0KNrsK5CcE17a3HHePrecajas1VP1PTyEa3CL5Adw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498374; c=relaxed/simple; bh=4l+0DH9zeDI7Suvn/oDwu2/oJmiqwSjUZePOQbqscLs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jHOsfR6oadIy2npdP2waxI9RZu76UnI63wEJQPX/bMsCoM2EBdZ9IHmnEZQISADSTdu15ItS6Bvp+8ClfuFnXL80G/Dv5hhu8vhFB36AtAg5so2mhYObaIJCQKmZXj/AESo+2pDJD0p18MI+bFM/aq5dT35lPEp4YxuTRaj5pUo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=B/usuY9y; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=j0qx7FpT; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="B/usuY9y"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="j0qx7FpT" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLiWAa026006; Wed, 27 Mar 2024 00:12:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=puonQDncL29Iv+ev8S+31dwewaismEPtaTaww+WbBRE=; b=B/usuY9yhi4EW/AwTfT3uKAh8a9ERYLun0adTvxsKHnKzfiKNIfuVyq+2s8+c4yxOK9y xAWiHbXTHbTTz3Tel+PgMtISe202hvYZlcWlH0BjF65o4RJK0eaCqlnK3WY6DWxWA/Uo Laj52hlvd2jrsaUPujagZ0XrnpzmqTlyjgh2HLJ7pLlnKaWFeN4G8VIE8qN/POFq0fnf uH+pr8N7g/tTXr82VXz0SeVY3Xhy1D0cuXcRrK5QUIerODgReYrUE12gFf+4Hi847c64 VgvBQLWUyKeuh14cWm3oRgx/LJN5Yn9cbWcQ1DU6UeSVUzybaT936j9W6L4uapyqFiDv ew== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvscj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:51 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R03ovA020681; Wed, 27 Mar 2024 00:12:50 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1a75-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l8Gm9uUKF85vQ0dtcPbDaKA5cFWyObBTlHyrMF6LVB35BR8ELg7jrq+Z29BBCFvmokpMRnrTRp+CEBhTCuO0Vk3s+3G+bTFloUILMzFLvh/TgjUmEsufDBR96DZ0gAGmVtGhYYD0QsVYL9P0lP9tQ+6S2eMl4K6Ai1PgniI6eTOdn6UAgszDsCNIuCLezPZmlyNQiyl7QxDjQHW4rM15U1Cfc6WsZVNt4DKu2e4UvLXo5kH7/5tyX/bUIpSv2bAYEycwq2AcBSggdCH7JdXnYhZq4jrqNA/3uy1MtRvPp/xUrhpuSBMG2T2yVJoZNGyyCG4xQBUmvrKPi+kW+5YZOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=puonQDncL29Iv+ev8S+31dwewaismEPtaTaww+WbBRE=; b=OFoBAoUrUftwRKU0Yu1TUUjoh6JRREVEk9S/Pcvum6u4Kcf21yNADMUJ0N0yth8h/7+56Qc7fBMJ1r5N/+pdJmQDhKyfL+yeJ6QDVhwWhUE2z/5hU8L2tWQP/EGKZoyF6OHh9VdVELraXTUcTJ6filKFhU/2vTa7XYylfnawo7I0ZtNT8dLfEDHpI8Y584iowosWJjduBXO82tPCRIbP9WVAvqiuir7HrBpWKppr51sZ9s9ziZ5OYVd8SwiOQDDVjmFowBVyCj9TH1PjSz8vKvE0E9oTR2u8YNH2/DmU9UvpW5o7HO1vYyji8EzbE17RcFwyZDucWETc2G77olxZsw== 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=puonQDncL29Iv+ev8S+31dwewaismEPtaTaww+WbBRE=; b=j0qx7FpTWHW/Tlwb4LvcgzzhoriGJ6nkHEzzrZq9uYKIKaNUjzjo912MayUSsueKNp9BJrA+A9AWKS9vBYmZWYx69QCtMb0/9+43hRruAx/YDHuqqRBwzf3rTBXl/zQFqlNsMhS2K6Zs3Ry8RGlcWf3kl8G2Wy1Yx28KZfQZYvQ= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by PH7PR10MB6226.namprd10.prod.outlook.com (2603:10b6:510:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:12:47 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:47 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 02/24] xfs: convert rt bitmap extent lengths to xfs_rtbxlen_t Date: Tue, 26 Mar 2024 17:12:11 -0700 Message-Id: <20240327001233.51675-3-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0002.namprd05.prod.outlook.com (2603:10b6:a03:c0::15) 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_|PH7PR10MB6226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: llfIm9aV8Nf+1IPnfs1mNKV/KNlNK54ylmXzVLJ1+XqnBglSn86CWPYFDZD4QiEyNLfE48pUMPhkq3//aNzHp+o7bpkx2wl87d7opQ47PpjlH7vCil79I7qP6sU4R1u4dG1cdW0lfF5xJuob06ijHXdIOt+HfEnIMpzmgcZvoIn/4XT8I3nYFo0YEoaXGK5eUuyoiXWlYiyhbJXYqbg0QomU8kCTxkqf52oBIVIDPnapgUqB660WFtYPQGkZX8gfwZyGLA9qy05gSYB8Cc5HbF+z6PjzbYyic7qIB8hZjzCkbBOMu4YMtzl3z6Tl1hzLl3lAlkLYV+C/SK0D9Iy+ahwf6/bVo8ufsKw6f7oQYHTqrmntKVX1slNzVy4P1BBXAIKZNFuqotuQRwiKahCCnniTqnZxMdXQUcwcY/8GGuyegdlAd+9f7kVSKr547XT5oCDEn12fmATsYeM6AV/GFk1vGVOVLm8FZlLgoQsl6x205Jf1Pf/naD4cq8vGw+5Zr+A4D/Df8T4EgmHJlS2wyU2SKROoH05kZdbTetXZevPyyeQ6kQGE7h3B9zFjiv5emt0402kaOlk9iCxOJERYWlopVDYCe/vvEDM31TYmALLDImDpI8RsjqTxrVNa5D9RvWvSaXblhc2NLzjyt4FGmMBSQm4uHefzTTDRCV2GuiY= 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:(13230031)(1800799015)(366007)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 07VHyz911JG9WuVhaTiqEFJ5sb7oW+GDh/OlN0ufwX3tBMXmpbmZoUTec8TaYf/t3lgkqqAmXZujhsh35JJYwAhWf3nLnECK474mVGzha8wmKi6dk5fp+CPsb5TsvG1l/mILhk/FOtqcC50A32RZ3YxdwGXCUusAgVrapUB3gHvb1K0B7Tw3l7nokqrmVUb3VkeWFDjldRzUgSGUfgGGHJ8dTp4768daOFwP0NbYtQki/vMNHz+MpxJoN4uoBLyXvbQ2wEKe9yRrGMyfESTYOPdZ0j2Vg7/af3KHEVdtEYeqwwa5RIT0rz2XwAAzkjxj44++JIwa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Pw2CC8YtTpNYWg61SGi8ThMa8Hgl3YBYe2JUGk3mVEF+TPOHBxo02nfVe557Fzad1HY9UO+BWRCG7eroJcBIppwq2SdIZT+ZZSk7QCBm1vQLHCLykW1a3qhFGmVFeQWAkMX8KsdFtrY+/ujkbMQUfRrYQtneEzzKsheWUBHpvtM0+pn9WjLNJnJrwicey3PVCE89yCknuWCVc7Lkquf9+OyPH0bnDz4BT0uPL+NIw1Hmmu5FgBUZwYbGy0pM0uDU6r8I+LIw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: H2FUz00AWggW93HRBdQo4PKcS6pJcQFkdrtbaQIBBxsQNdgr3aXl7Md16NAVrO4GGIuEpw9sr/iSbP2ktO783Vuj3gHh56i5S6YifMgrbWGgYTIz8RTpCrWamqE3dFC1HVBrwkVu/fwkXnTzsH2dlLBP3ITmSsk/8WHlgULhuhVylu4lpFdSr319i4Npk/V6DOxatla5p9JQJ52U7Zfv1EM6vhLSH1GyIBUKWPg1i8foHxipIoMwZiuwTS2iRFac2Q4oerPBh8Nz8h6uuzn67Jp2NW8PxhZ6mZak6JWy40kqLDBthXIJglq3XUoWf+1yvXT9CSx01wp6KaTfRzkCDTG6irKldGRqHr+SVoudC1IAianzMJmp0a6inNJr4tQgc3I1i33E5MkwWB1AkZyxIofxgogJwHaFEDbxuYd5koFf/rvy0KKW2mFwZqcEG4imG7uFnugp6ggj0gadc11iXX3sXmSQDD/BpoapeuxbGg0k4+vW57RgtLciwyXHw99KLBT5f9Ktad6d04PVxwh9cZMHSq0SsW3zZPeJY+MDC2+S+ciNyqq+5UQDA5UPe6E/6DzOjqQ1+Bs9+TcRpQvxJCT832pX5t8ODeiOEcTWKG8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4165790f-43c7-41f8-ad84-08dc4df2a1e3 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:47.5842 (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: y2lHdwGDEU9xLXMneHTXLwrvdi56g4pHu5Y2Hm34LLRD3OupgpyWHrB1NfZ09FNP3IjdZZ1hesPnXVa0Ir+FoIOoXK3j6cRLAtX7uymrtEQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6226 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: tbs13oaQfst--hdoNO8TEjMvEBea2kpU X-Proofpoint-ORIG-GUID: tbs13oaQfst--hdoNO8TEjMvEBea2kpU From: "Darrick J. Wong" commit f29c3e745dc253bf9d9d06ddc36af1a534ba1dd0 upstream. XFS uses xfs_rtblock_t for many different uses, which makes it much more difficult to perform a unit analysis on the codebase. One of these (ab)uses is when we need to store the length of a free space extent as stored in the realtime bitmap. Because there can be up to 2^64 realtime extents in a filesystem, we need a new type that is larger than xfs_rtxlen_t for callers that are querying the bitmap directly. This means scrub and growfs. Create this type as "xfs_rtbxlen_t" and use it to store 64-bit rtx lengths. 'b' stands for 'bitmap' or 'big'; reader's choice. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_format.h | 2 +- fs/xfs/libxfs/xfs_rtbitmap.h | 2 +- fs/xfs/libxfs/xfs_types.h | 1 + fs/xfs/scrub/trace.h | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 371dc07233e0..20acb8573d7a 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -98,7 +98,7 @@ typedef struct xfs_sb { uint32_t sb_blocksize; /* logical block size, bytes */ xfs_rfsblock_t sb_dblocks; /* number of data blocks */ xfs_rfsblock_t sb_rblocks; /* number of realtime blocks */ - xfs_rtblock_t sb_rextents; /* number of realtime extents */ + xfs_rtbxlen_t sb_rextents; /* number of realtime extents */ uuid_t sb_uuid; /* user-visible file system unique id */ xfs_fsblock_t sb_logstart; /* starting block of log if internal */ xfs_ino_t sb_rootino; /* root inode number */ diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h index 546dea34bb37..c3ef22e67aa3 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.h +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -13,7 +13,7 @@ */ struct xfs_rtalloc_rec { xfs_rtblock_t ar_startext; - xfs_rtblock_t ar_extcount; + xfs_rtbxlen_t ar_extcount; }; typedef int (*xfs_rtalloc_query_range_fn)( diff --git a/fs/xfs/libxfs/xfs_types.h b/fs/xfs/libxfs/xfs_types.h index 851220021484..6b1a2e923360 100644 --- a/fs/xfs/libxfs/xfs_types.h +++ b/fs/xfs/libxfs/xfs_types.h @@ -31,6 +31,7 @@ typedef uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ typedef uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ typedef uint64_t xfs_fileoff_t; /* block number in a file */ typedef uint64_t xfs_filblks_t; /* number of blocks in a file */ +typedef uint64_t xfs_rtbxlen_t; /* rtbitmap extent length in rtextents */ typedef int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h index cbd4d01e253c..df49ca2e8c23 100644 --- a/fs/xfs/scrub/trace.h +++ b/fs/xfs/scrub/trace.h @@ -1037,7 +1037,8 @@ TRACE_EVENT(xfarray_sort_stats, #ifdef CONFIG_XFS_RT TRACE_EVENT(xchk_rtsum_record_free, TP_PROTO(struct xfs_mount *mp, xfs_rtblock_t start, - uint64_t len, unsigned int log, loff_t pos, xfs_suminfo_t v), + xfs_rtbxlen_t len, unsigned int log, loff_t pos, + xfs_suminfo_t v), TP_ARGS(mp, start, len, log, pos, v), TP_STRUCT__entry( __field(dev_t, dev) From patchwork Wed Mar 27 00:12:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605361 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 E4D8CA2A; Wed, 27 Mar 2024 00:12:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498375; cv=fail; b=szN/e+TAygtr/RBgOYCMAtj4EAF9McmPYyfi2FvMYYIATc1KppiiG8dlJLTY/NckrzkWA40AdfJnnh0xsvh9TAPqgwdyRDO3htWZ2v2XZ3FfYurrBrXkwML9n79HKmRn72qFAcYjc6+sT00oB5VC6+dU+Tw58r82Gwr1RPTEsAk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498375; c=relaxed/simple; bh=yn1eJwaPZACK0enbZWOPUs9sdNE/XHts3w21Qt/7yas=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=q6URoCEWLl7N5J8cDEDChxhZv6GikQ/O7YZwHXEvztKZ4m2FC30wIunQbBNRWvU7T9TuimJgTfieaIWs4mlyNHWltqZNCxssUDcuLUDgmHIMuk4Zyu9QMGIuQ4eV+3lhm00HZqk9nxZ1ZH39CriCv5MRbFD628nW7BrMKibbARg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=jmU2rkpb; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=l+R/0Fmt; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="jmU2rkpb"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="l+R/0Fmt" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QNnmde008836; Wed, 27 Mar 2024 00:12:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=j3fAUf47eDkPMvS0YiPc8w5goUsG4AzmMmMRQfoiBKs=; b=jmU2rkpb8ki9u1KSVbxCg4AO46cTr5cPrcZAqnkAHBl9F9KAx75kb0Z1Pz14BPmVcM0w YL9HzPczLUMcmtzcQkozgG4w0+dI1tCs/Kq/iBhnz2FIExEsgI30B9lC3PYSMUlMNUo8 /gYiwM1XpogMBg/OejNr+OjTYYwTD5wUnOCnEYA2VBomfOc+qhkjlTXyx40B1wUAhlfd 716O/WsmfAcwER5NKThRQwSvGQoO5Gghf8LUVKiqPGTz2h4R0TOejCtMRyJk27KKuIae 6myG8LKSGvF29OmY0DDRb13sqGPMn5Rlx1PN6C6mHa82eDwIsVOKB4De6E1B243rS/Px sg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvsck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:52 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05SbS011649; Wed, 27 Mar 2024 00:12:51 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh7sq6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oaRwHrhQAtXiVk+ONFmvr+YEM95sB1eDvQUsws6VS4xcmYz+ATf0Yt7vuxEIXN33IyUru/+R3BxM5+Om9y2YChiiWmsS/f6dY5ynLkVfxsiSTz43oEPS1L3LCf95hR31oPyGF2nttZmbbyDlIt+mj0fto2fiqJR0rL5MHEn2qtYOjadFpnKoJHdzJ+uSWkD595OSffDHAcT8PZTC7UET2ph2r33WPoaHqEAgQJ+xmMbE9VxQY6X3WnAPOKcgua9jKkwb28hKuNTlJzumbjpcVu3Xm3x8imw83UIIUeEKmlQIA+GmdSfsvXiLPzJIu4QmD3jV7Rm81XBDOGpCWdao5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=j3fAUf47eDkPMvS0YiPc8w5goUsG4AzmMmMRQfoiBKs=; b=Zptw+s50JtdoIY2BxPIN5veQ+gqzfXS7e2CAxQJmGyTS8WYJcdSEfF6h3HkKwOZIHRChzP4RkDgNAZcam8zZaa50XNUeWicmyGfKr7Y2Mu2epqr0kRa989/kdca2nSAbHfJyXj4x3gpaqMOhUv6CtL0dCdhygQGdXGB8JLE866iwh5wiTSMteiswLJBt8j9PQXSUoCekySXawhuv/3Ye+90F8WBpZywYPelRaQwBFkDsTgKU2v2DY1x6/fToxf15bOtYRaa/1FC9VnZOSgbrnCJ3GUdAWPj2/J25epED9FlCfn1qd0RwmhIpFpjCppcH6GMAcKGMRizpNaSWhPwx1Q== 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=j3fAUf47eDkPMvS0YiPc8w5goUsG4AzmMmMRQfoiBKs=; b=l+R/0Fmtxr7Ro2P4E3HY2PfPF714rdu/+iMXJEXNpWENckvoYq7bd7O0VqQG2fj6wZySOL530cJBVyBdNKHPsAYBkkoHsQsetcFwkJPNY92KS1NjokUmIzohQJjnwd0CQK+7sTrn4YX62HxGsJKIZV+BfhemlUZj2v5ufJ9qVws= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by PH7PR10MB6226.namprd10.prod.outlook.com (2603:10b6:510:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:12:49 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:49 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 03/24] xfs: consider minlen sized extents in xfs_rtallocate_extent_block Date: Tue, 26 Mar 2024 17:12:12 -0700 Message-Id: <20240327001233.51675-4-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0001.namprd05.prod.outlook.com (2603:10b6:a03:c0::14) 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_|PH7PR10MB6226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zFvNQ7YJ4rNcnFCP5S0pHaUw0aIQaW22WUAghlWWKW008pRuaKiwkRoyAED9fvf3pCSyZwU9CIISHPLgbWaG70vX5qvex1DsvaktTdXVXGfDmVFHwTI6rJRwfDeX6tV0qRx12pSKI3i2RYXbKxIHlWiCR02U54ny/vMePLj66R45vo22QjGpY204RmJePgo+xqdwDmQzaKCDM5TiYMpjV5uI4fr/M9UBlRQOcSpmtnTX7rjBWTuXF+9VSuvHJ+ksiD1OGc0kpSqIxivpVPAApE1ft6y+kvc/ulu3VwHuX+lyE/Q2pnDRLzDX3BKM4pPgQnU5OhPh3y4SBpJ4rhcup4JcX/JbhpmtYNJ/51koXTQ4s1As5ZuwBt3SQJxQ8fchmqsE43rDNDIlUJHkI99Vy3jXDDFxDeuq5ylRXeJnyvUTpDxo1L3wrOocSmkW5Pyhz67yqFBp7JyGBGqbRPOZpRowngNGOJhzBA07T5Os8akLyxaYAApnM3cO1EgwjXd3OJkqA4Jrd7Kr7c23XnpWtx4xPUsQCyaDqDlGyj8V+wrmTVB7c44ujB9vIn/mWOrdzh7K7p+PmJKIG6fSskkCzGHEonVJ3WkDoH4x5/XttwkLmrI2zxhgs9jgEWv5BxeUal4MK6H3ULN7XM55pv7uN8nxaonWKLuJCRIs1EG79rs= 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:(13230031)(1800799015)(366007)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R/XAL7kwksLT3RmWVoblk0zWi/mDJ69/w4zYIK25dAGkquGBRNvzLdaCodq2s0Hem8gsXrRumNXmjkopjsT4U7QwS5RvFPbVFgNTXL0J4UXzFPJR6+kvsR74z9CrfVrcsxrMtzO6XcF1gM5o52Sdgv0N1pugmLz5NBmVBHMydCFX0ZLzHEwWOB3D+uDwc0pkkIkkobZwoIYdgtKzGHR33GXIcRRcTX9HmcbMfHUA6UgeG5zFzEDOT1CcDxuZSRZ6p0Vv7kSBtJqQ3Zc8qo3gXRslOK7HcKpYBDkcmNMdtzOPKeDLceHChZMKndyrzumWAqN6m3d38LpgErh7Duq21v6c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WoE3Hjppc3Nrm2e/HYpFynRbh5sTzkv0cdzg4iCWSuDGxjAgIX8gGFOSyr6scGT/P2VDj5sf7dvzp45YVCOUfkIGyglYkEV8H9oL8+HEg95akcNuIY9YtT9FKxsRj5AsLh6dE+1COqbuaZBSGVd3lKLbzaEAJYvp7dB7uFtnKAXhJIb9/nAr1T46qp3jswwVDSDFhDB2zsXwS9zBeDxnK0LTNzHvcoDJjesDA2/BGLUh0BYcWhDJ+mSKyA/ZcTtQcN4zOw1tBpuYJHw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NtzlWruhjdZ8ON7dxVY51acAM+N9Db4bD3C+lq65Agg+513jB3nZ6w9lMIQ8kgfnhV1mOtzJw7R8pGY843Vl+MKOa0j9DiU1pJFyGmPmYUjriKrrFCkh0Laxfym6THoWsXNRG46u4TuQ9khliV2YC0TZvfOGDZ8raKqEebxjYdCCY09Hlc+JAALsIYdk5E/E8J8NvrkX+Li0TPm2Mv9lCPQmAwr4NI4GmF/oL2AbZdVeBmd2bLsgqni5YBvW8v2r/JWqIbo2F4tkaLfK6kR+4r0iDSpFJYVJXwZtt2MjlLB3ODX8RlUUO2r9wH5HpVNUXX8N76aunB+YXJRoZGFZDS8xLPxNZOqDf34OL0zzICKJC2UNdRMTB4hM4wJJheVeLPDjrmz91Km+XNQgf9dX9CStquoFuc+W1Qb1eLgNa048zSvDBGN8+RYA2J9N9Vl07Z1pvjPhcoa8BuQKDygSfCN0ye1xBAkq5pALe974oOtODtsd+Fmx7N3zWkimD/7Ift+g/+aPkVnZ0mrf13Cich1TLIqn8fgu3qecsFHyxYcSYf0qVkszNww8YnBVciMIYkRkO57/u93sgRicFuL4R3LlwSF95QefDaiPDrOac+M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 752b612a-b912-417b-36a6-08dc4df2a2fc X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:49.2792 (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: P1/0z8PZGH/b/Gto7xMJJgoHDBIAf51CDCxe40oV8NE7ucpn1UjCDZRmeXiHAM+RfsZbTVbcGdw9VdpngU1A6lMb3w5xiVwPqb0CKV8Nd7M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6226 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: MYsHpjD8lUOL6h2nrgJLaTK1AQ-fjFaY X-Proofpoint-ORIG-GUID: MYsHpjD8lUOL6h2nrgJLaTK1AQ-fjFaY From: Christoph Hellwig commit 944df75958807d56f2db9fdc769eb15dd9f0366a upstream. [backport: resolve merge conflict due to missing xfs_rtxlen_t type] minlen is the lower bound on the extent length that the caller can accept, and maxlen is at this point the maximal available length. This means a minlen extent is perfectly fine to use, so do it. This matches the equivalent logic in xfs_rtallocate_extent_exact that also accepts a minlen sized extent. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/xfs_rtalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index f2eb0c8b595d..5a439d90e51c 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -318,7 +318,7 @@ xfs_rtallocate_extent_block( /* * Searched the whole thing & didn't find a maxlen free extent. */ - if (minlen < maxlen && besti != -1) { + if (minlen <= maxlen && besti != -1) { xfs_extlen_t p; /* amount to trim length by */ /* From patchwork Wed Mar 27 00:12:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605362 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 17F41E541; Wed, 27 Mar 2024 00:12:54 +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=1711498376; cv=fail; b=ezzBB4l1MhUPjFh/qKjsEFs8pTxuFs5RqHMDXqkgQx0avos7q2x3fkDmHQ31MDKtli4RNE/VlkfhZMhZvN55zM6N6zDONn/9F9DjXdrq07ZJsEnHjKiGCLzvULODi8hZ1cQIAFJCUqEh0+kjQLd0vm90oYAuxajEEiaTFJz4CDQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498376; c=relaxed/simple; bh=UTKCA+hqoLNbHHHT4DkJvMLVTrzhNwweJIWiXl8dQMw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=frj/AMZNDVAWXtetD6UguCgPB3OtsRWSvjK691/Icc9HfODUpVMDPvUcJ/xmrBLDKgwHcg84VlknYV227TL484tzVKp8sU45fLfIEZ1C4KyQYCQLMGZ0qMlANNjYnkJtHk9jGJxBsaLvTerzAGZcgD8NIrIB6WsMHH5por6bgNQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=KScMtij8; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=TJ3I0SlE; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="KScMtij8"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="TJ3I0SlE" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLht8M009776; Wed, 27 Mar 2024 00:12:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=G6xt4v0+UBF2hVICHAk0LsKGuZGF7Mi+1z+Kgjp+XqQ=; b=KScMtij84mfm/eX0O0BiZK3+INompwQAQO0cuMlbIiOtW3YSA4y/85LlvxL4yYG9NdRO KbSQU0QK0UJ7W0za/3Rbiwb+vC2n6L6noH1oY+BndwJdR8tj40wguqEqyMnB5q/tyz0H GxfnLDoPyuULuSt0ViCT8lXqPy+kZYdJasjpfufqKXfoGjRO1USeftNme9OD+4D0HFss uCc0oZJ98w0XSMjHAJ9EMkHG8NdRjnMORjbRBd0kSeJC4I9DI/H5clesMPRPlIJCy949 PLQtBf/bgnn4W487wvM6sxaGWPyZUpjIQaF6uj1FQA6BWWShm1tSa8rXQDFIColwkyJN gQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2f6h57g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:53 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R04A77004783; Wed, 27 Mar 2024 00:12:52 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh80hqs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g0lkSYGss4fGODMCXGh3hP58a/GO3Qvoquw1S9lkinjqTGeDi8l3u8CpOh+fnPp8tpsOv3HjhGGBQQj6et8kyUB5cQTTK6lcMdNkSvnfmmOHddMPUH8QrKe0gqz5GU/yXpgV78Rkv5Oq/XDJ9nMUPMwbf17qQ2Od3AmhaZgQ4Okt+6QWWU5rf8jYT4NF4QlPZehdjNBOZb6qiOE+YdgSsLost2qpYzB0t2CLLtlUF2YFCxWabCp37ldoOW9Q+T7r4C7nsFnmd79oBeehm1cfLDttUiPAJmGn7jCvoLrjwnANZh+Gu476qKdZjnBH7OACl/DewQTz2193W6rgpvQ3uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=G6xt4v0+UBF2hVICHAk0LsKGuZGF7Mi+1z+Kgjp+XqQ=; b=b/2qUMBXE8a6ddjbHMgE7u54k1UO/+TzIuca/S2hCVUZkpzdeeKT4mX6bzkwVQoe7jvr5YUpvWzZS/KofZV+IKyQofDeMDKQd8XZ1iKIgTTLT6Ni60JB4YvxX1H/wjn20rspleZu55b/vIcdV4fke9ejZ9RGHMI86h1i2Lhci2WE2MzsFOZOYSNQesrXWhcEsVk77JRdvp1d8eSwsbWWOEClkwwH1Gb3fTJlK7FaM7EjQ4s9EnFWl+Lfv11e6yCPCuodfFtAnp2QdEhDUotPw9+SB8a+5bE3McfX7tR16OIsyRNa6Hob3JsHSUlSDCR6pxSJq48YICLwVofpoeZrBw== 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=G6xt4v0+UBF2hVICHAk0LsKGuZGF7Mi+1z+Kgjp+XqQ=; b=TJ3I0SlEMjjpt++6gADLCTDHuNwUxyn8E/RsZ3fCE3SUTAgXpOvrcvnhQy4FSBV+iY/OwveBwyrBQgoR8BwcATF84QdNzpt/uNqFMRny7d9o4DfKClDJt3rRjF+g1yIbBSqqz7HNXF+4Tr1+8eC8H8ergsd9neMrX4DH8jsXyW4= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by PH7PR10MB6226.namprd10.prod.outlook.com (2603:10b6:510:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:12:50 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:50 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 04/24] xfs: don't leak recovered attri intent items Date: Tue, 26 Mar 2024 17:12:13 -0700 Message-Id: <20240327001233.51675-5-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0004.namprd05.prod.outlook.com (2603:10b6:a03:c0::17) 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_|PH7PR10MB6226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rymzw9U+VcmsflmbnWACG02CdLTL8oWPl1pR/lwdgygq+epSFMWq53DT1l4qQUst+W1lKB9meXGYsu74vwvI7hYPvkkb6hai9ucfCbHilhziT69zp5s+AjaoetfZ0Y97Vz8fWKapQYZ0DHbJX8wi7CRR4AGE9PGDwM2j03Ab8/MURBdr1KjAaJmzxKiIywfG+Z0xyE5L8PFdRSx7H2MqF+1mxBatmllipsq0ufx4DR1hAdEJfqvYk7rGl4asQOm2J5mZUxqE834vWrr0zFHvgwdufKSbbSP3kbYQ5SxSSAO4yLcOiLomMwTgEhTNHQ+bqHvRojr2+ZG3555BQGweFin4BZp9p9t6a/UenJInXReo59BrVJctkXezGHzBX+ofV23hOogLheT8+Znfk9pClPue7mwZHU+TQrixNiu2yv8FUvkuAvQz78763e+QzQ+sq7FVzywUgbIEwAB9D0JtGVZorojD9RCyAwkkRoRLvl4F40VA65mQXClOUH5HxMgrHUm+fUJAWhI2gDGL0Q3Q4r/p0bmYRyxMYO3Max6oa18sWrHnw43PpZ0yYotvDRzQjC/KBXHa7wYNfqeKHy3QGDGZmsC9vSaAWdHtbdqTkqMwJiS0j5k3FeDvdlZX+zSrZ1YxggGCdLJB00z7j5c5RlI8A53/rZQu9er42J2vlZo= 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:(13230031)(1800799015)(366007)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wo2gTZ37eqVeCl4xxypkd/3AQNcj8zMqtk7WFZdgS3j6zjC4KkdOIXn3L/ViCewJPvOt/E8g+79qZ9qgu5f2ntEUD6MlHTHUn8qzG8CuYL9vzVwxxOk/7r5L8PSTqs7l8kz6jCxtefdQFMty3BDG02ROoHamwbcs3UP21F+JFMIV27glGiuHiuS4CeeZ3pkBur2JJId8EVM5S/Ty99uS9BBtt8x3vPMGTVf2IPxLt99sFGbeXDNZbGhE287ST9ynx5XEoVKc47wXczQ8XnKvs/RA0QPttVaGJE34bxpXLLX+lV0HYmFv1YG87CyRao4h3j0JJ5gXwAUWJUYgFkPIgkqlrbHjZH9s+WGJAGD5jZxTPD5+GPiaNkEizRdPNQE5eSpEX7h1mfOFrnP1CLKqiuIG5sD+1p2kFKaYGpEq7OLoqBqNeuSiQNe/6KUk6w25nkL90WOY64MT/Y8FqUeCjU4BPOAvYFRUP8OtbUgDEo+MliTY802FtNikbV2h/3WhVI03lXm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lZn814wgRA6C9IHGvZ89A38pfWjTdRpWilrDAIyurVohzm03Kz/uPL0FmBFdd+KbZTUvuzzJlca+YGKCJVWCpv2buQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SNu7H8b+F8LIKVvRp1qL95RQMBV9xUIuY/Xgv884oXale/1/MT2JF1wCZiD7k5OKrFMOR38f0fx8Kl/idW9IN3TuMpeNPVpwpolDhvTwixYHFnlyJhNt6MWd5e73HMdl61aoT2IDw3/8LGq5BO1B+e6jNl6dY60Kao6sBsqfEo871e1kaqyGU0oDFw0GRCR0KaD9w3po6vxZkSFIeVsKqnj6mbLvtPg0uUcl0exhf3OsXNTIWGR0t2BLdghHTEHeuCyqCDZrxk6X7OKbiaoDJFZ96PRZBV4t6FaLl2IA38R0UFV0Xf1z+zK0B4lwbsCnJ30XoMDe+fVPMVEyvSeo0MEFrvzX0xQ1qpbsUCeMcUrLZ3+R4fQn9idI+7q4sfxK51QfstAlMKMrpvdea+0tVovLeLEKxa7GvsRDG0A5j7CoVtCOXGWRzKes9RqtOd3/MJyeJkdvXSzSg2c3U32Ep3HmoOyldORkM3VUdGKhXzc3Gf2FH2l2bLS43qZ5tzNJkAJUYVi1YM79W8J2q7cIUmJS9lESnjBzzFaYONOTc0YTgDmhh+uPdYER+ZQkDHkhiX6xBS5BWs6Uc5Djt0eli6skCaQQXCSuZCmHDY2HvwY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba23b338-e69f-44f0-97b7-08dc4df2a3e5 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:50.8729 (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: 4ZCkanX4VWQfYOUjXFjEEb4qEjtxra6u5sl4VeaBkwKZTTGMvHQlFQzzk0htVUfauXhBp2NQUanN2QLM5nxZJXTneWXT6Cx1T7lQ7eM9+ms= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6226 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: d144vslgxEHLLaJD0HnPcOjhwTvoHH7j X-Proofpoint-ORIG-GUID: d144vslgxEHLLaJD0HnPcOjhwTvoHH7j From: "Darrick J. Wong" commit 07bcbdf020c9fd3c14bec51c50225a2a02707b94 upstream. If recovery finds an xattr log intent item calling for the removal of an attribute and the file doesn't even have an attr fork, we know that the removal is trivially complete. However, we can't just exit the recovery function without doing something about the recovered log intent item -- it's still on the AIL, and not logging an attrd item means it stays there forever. This has likely not been seen in practice because few people use LARP and the runtime code won't log the attri for a no-attrfork removexattr operation. But let's fix this anyway. Also we shouldn't really be testing the attr fork presence until we've taken the ILOCK, though this doesn't matter much in recovery, which is single threaded. Fixes: fdaf1bb3cafc ("xfs: ATTR_REPLACE algorithm with LARP enabled needs rework") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/xfs_attr_item.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 36fe2abb16e6..11e88a76a33c 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -329,6 +329,13 @@ xfs_xattri_finish_update( goto out; } + /* If an attr removal is trivially complete, we're done. */ + if (attr->xattri_op_flags == XFS_ATTRI_OP_FLAGS_REMOVE && + !xfs_inode_hasattr(args->dp)) { + error = 0; + goto out; + } + error = xfs_attr_set_iter(attr); if (!error && attr->xattri_dela_state != XFS_DAS_DONE) error = -EAGAIN; @@ -608,8 +615,6 @@ xfs_attri_item_recover( attr->xattri_dela_state = xfs_attr_init_add_state(args); break; case XFS_ATTRI_OP_FLAGS_REMOVE: - if (!xfs_inode_hasattr(args->dp)) - goto out; attr->xattri_dela_state = xfs_attr_init_remove_state(args); break; default: From patchwork Wed Mar 27 00:12:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605363 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 D40A3A2A; Wed, 27 Mar 2024 00:12:57 +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=1711498380; cv=fail; b=ApkyPTQ0MBH4NlrHa4PghM8Ngo5yWIW114ngb+7doBuMlbn6EB+IVoIgewRv0m40lz86yGSb7895gVZQ5/uvGF1VtVPUiJSHw3m14PQeINHN3zRdpdYZAwPlW3SQimLkSg6lKxzI0vAbBQM1EvgrGg60l+v1ZFzbw4eTh5qTlaA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498380; c=relaxed/simple; bh=K4VEPWyCjYXgm75BykDysv8p6zCe9SmjzsiGQ7uAnaE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VKvqtuvdA0/03gozQ279oq+sWjiWbXQ6jAYxXR9US3GUb8O2BodApQrYDYJhtbd1BFC44tXsPNtKnQW1ENj8O93TPJ75qRvsXz4VneR2nL5NwZReWpE9ovnAQRgfF00tZATfM86YBnNELn9bKISbWxqZ5P77pzdkivKk3waPCAk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=N8D0Hfjk; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=eETNo2p5; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="N8D0Hfjk"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="eETNo2p5" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLhxNG016381; Wed, 27 Mar 2024 00:12:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=gQKp2SlKEmGMEVFmO4lsTfsdDISGzX48XToaX+mvqug=; b=N8D0HfjkG1kaTUVHsxjgb8yioJkNaVgAv4gROrfA456u2XBt9m8YXvpBy22Lq7sG58HG /ErIE7Klr3T12suF53u0uKUVExHn11dAGfOa6P181IE+OQXQv0LTV8bedhekD8Os55Dr wXLmPRu21BOsYSgiEULEfvXq91WnOqF7mPLP4fRgetmD216s7LolozAGoGUmOp/7pLmM RWTBD8QbvN1C1BKDcTzcTOfoLiD/7G+tjGglzuV69TRPeFOuPUY8OpvscM2FHKutxpY4 l6cXm4BCQbLE6FrVeciOUVlc0SU7zhgaiAKGvDwZx6OD2HEnUy42ccbXM1y4DSUDVZeo sw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1q4dxc0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:56 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R03ovD020681; Wed, 27 Mar 2024 00:12:55 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1a9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aKKAUEuuVJJ493hGVfSwATP/2LfEPqNYXMCjYhSZU/c/DQx+4m+lakTStSN2yXtFU21HMNIia3UAQiObBGieyv1TwHTbKWW0HtPWT9EWm++8KUjl2xhQP6O9Fq/uz3Y9FuEQCVWv7hSmkr6OUgJl70wLZH1Y5Ymntd0Cpo1FCeGj6LFwfOAmFoRrbpXvYDKE+sfhL+0C4BamQK8+Ob6t2Lr5hO5Y08vQSaNRkVTRWVyBu8EPgcvnJKaEqUI+LY3ZuoUd7W4hKAN6PnIOJf8sad8rbpMH9uGlAYUCyhimdB494ap7cGrVqqBQvIhIk1D+UiX5T1MQOb4RwQkEwqlMSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=gQKp2SlKEmGMEVFmO4lsTfsdDISGzX48XToaX+mvqug=; b=QQ2K7xze6v7ZehjZi6ApFL50ra5NZFNA8lqHgmQm1vHHUqiR99rZsmVvxGhGzvAuNFXOZBxyY8+duHL9CXiV7zq4Ud2hNTHCdm3wVHzvzxkjdvaWbFcdRe0RMScvNlxy+mOp1YeZCFrDTzXoStjkgMeTmTwFxHIaB7fOsxYp7zOEV9I+xFEZHSjEsUQRxTQBAVkeJZL4uwfR50wnqhtAECnWsPJyzgME0eqfjp83PXdgLlGsxO7/9epg/yNaXoYCOBT+iLoSECZVngzO5AFqjYCaiD76vRRK6xdrxaZsNu8W9d5AGajSg9FTCxWuHBeaX8BZg4jwkioXaMoZnKzzzQ== 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=gQKp2SlKEmGMEVFmO4lsTfsdDISGzX48XToaX+mvqug=; b=eETNo2p5Jc8XZckURse36P0Ff3dvmeG9kKrKv2Ox6oMNXggOT7Iq0YPdL/NHneuXbjkCla4ib5WJ291mK6EmDBjoClS+l4UJvyYAQZX966nGgGSV0u7oW4ztFBQn/DF94DIWSYIM+rbfHYOFeGStpNELeKT3SxxSrwmOBis69J0= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by PH7PR10MB6226.namprd10.prod.outlook.com (2603:10b6:510:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:12:53 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:53 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 05/24] xfs: use xfs_defer_pending objects to recover intent items Date: Tue, 26 Mar 2024 17:12:14 -0700 Message-Id: <20240327001233.51675-6-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0005.namprd05.prod.outlook.com (2603:10b6:a03:c0::18) 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_|PH7PR10MB6226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tnNmQ5x15sQQaenBdWTkp0RBa6xrX06huz7pDbCMFJp2K63dik2DlPvNpXKk7cNb470U6oa43Jk9OXmp6BjZl3JIgUCjo5v+0uDOiUNlphiqIlSRzhQ8P3fpi3qIohqzdcqLHvu9pcOCXDZSZrPCjo/ATIw6jbmOieJv6hTx/eei1yStX0WjiKAm6i4FKlSa24LnpTURUD4yPXKn8sEEyBjHhWN/5OXbuWrT3eQAEKd1O5dn2UK/8j8vCvW+CH93lXgjfV/QOSsbR9PNkV4/c+2H+iMEmtLkPzsLGHipPlZbTI/7FLc9HiQuX9BeLZQBdgheeDybAl5de9ftI4g0cIv5dSm0EANDTHo5NzySZUx7mdSQ0U9hhxpWX8pFuNldFjfYgeOcuQ+0xP8vHYUt8ivhvEdpenYbtpeRPMos0cOcjsFai2wrR7wQO/jRpk3rcIukY9sWIq4gIIr+OypThfe5cymv3WwoqeSrYtphwAJNItjsdpnZboR+M2Ku9iNwpvSN/znpG0seSqpPHupZU6ikZfUw8nyVQ5+nGTbCEqUjeGX2NS5rmYGhz+yvOwfhh/EHhJ4pVTb34T7DZt37YuCIW6xosbdq4V+xf2FhU5SW/dED8aiyGVV1BV80r2aGvP++I81irqVm0rdS9Dq/qL/Xq8VSxgpGA98Osxe1zTk= 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:(13230031)(1800799015)(366007)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NN5igR3xMT3bnTBOPTh1TkA1EyIwCW74yRDBhRPDBRWDcyYsLx+Tb0TdldR3krL/Cfdg7htV5Jk5vfYKbAqOq7mUKn02+dEV1czBZi8AYvo2IzkxOOcezOhhkDLT51I08+chZNzzGVOdUhkq52DssGp7KoNCSfTBaAkuFcqj98BwXBnCSzaLfM9/9NlvSSXc/HsbNW9qcjJqSZo7/mC4iXKtZACesYBiQg4gN7RNefNQW5p1J2ZWfdlf/VvtfxG6aYVf5N9OlXu36qooY8Qn8QFPHXZKvKG398tanoM9Kszx63GbgZI4rtiRYxCTDfpt6ydZx0HuBnzWMXlZ2L/UcGsRXxJjQaYWm37sjk791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75i16eZtydrPL1K1SGb+yEq2alaEjIlS9KcpYMoOSXRISuWf1cDQoI4Cw4G1Mzy7aj+6TMu1xe97Im5tR+zGwFWxrkBrLonF4dVSEdNbWGu2IUFSgLbE6W6z4UbX89MNK9lkz3cbHnmAf5Gy7t1PdXucso1gGOPldwCixMRwioW9IUpXrsxUwK99RhI01ROP8tHEK34ACCOqPCNWku3+E1Ev6eTwrlAK2ez+XMDw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bS0oUyy1xKwWNjct/c7+Q2GiEOV3A4Uaa1a+as6VJcGa+ul8CWs5ibA7FKAXmDKdJo74y9cJoWehluP7D7cj6eIGnCFLsJ2GEKSAa2xhGCoAIiYy6kXXlnrGzq5KHJl4i58DiSsiQMtEakqO5Zc/XtPKV0CUejkySnMfC5X/Oe1wA86u6NlUcEEJXPjzhz/J4nCnBLgSx2UJxGna8HrBolTex/NRqjhx0wxDYppAFYPbUfcyLRH1whb04abfcSdIgiXjttpM6cywzJfjjFIG+eLd57MYpurNrPE9jym8xIM5sztXPlUP7QC498blDABwkVZVwKu9qG5biyzcYBoJ695E8oLhE2FiMlO6egqqEd8douEazyl4MjdnPm9hVMRa5I2l2bnZh6N419rb6duKjG7kGaPP/07YSibwPRfOu/It+LnU1+H9S3qKv+NcCV3XeHZwhIsdQSwn4AiNcihYk4/6vcIaijdmxmqZFj5bqrdt/DeIYJQEW16+z7w6LtJIFUkSh+xIbUdSCUeBMDkXSC9ZgmY82w7nPaExujVS4mXNhLQrIthsof2w8BuTxm2fxHcgfvMTtPwggaNjWxv43S4ZmnlYAneBowx+iDY117k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 416f2e21-d785-4e8f-de8b-08dc4df2a530 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:53.3282 (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: Ov6ME1dyJ5GyKVlTkus8F/7uqmSZA8d1qxgGc8t4TvadiYtFaYOZjNIBZAL71baI71KwRTSXijVltXMx2Tu8+SUVKJspIGRvc9iDUI5KVvQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6226 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-ORIG-GUID: w5WW_hkrQKjnzUDscPSX2FGVcnaOMaqL X-Proofpoint-GUID: w5WW_hkrQKjnzUDscPSX2FGVcnaOMaqL From: "Darrick J. Wong" commit 03f7767c9f6120ac933378fdec3bfd78bf07bc11 upstream. One thing I never quite got around to doing is porting the log intent item recovery code to reconstruct the deferred pending work state. As a result, each intent item open codes xfs_defer_finish_one in its recovery method, because that's what the EFI code did before xfs_defer.c even existed. This is a gross thing to have left unfixed -- if an EFI cannot proceed due to busy extents, we end up creating separate new EFIs for each unfinished work item, which is a change in behavior from what runtime would have done. Worse yet, Long Li pointed out that there's a UAF in the recovery code. The ->commit_pass2 function adds the intent item to the AIL and drops the refcount. The one remaining refcount is now owned by the recovery mechanism (aka the log intent items in the AIL) with the intent of giving the refcount to the intent done item in the ->iop_recover function. However, if something fails later in recovery, xlog_recover_finish will walk the recovered intent items in the AIL and release them. If the CIL hasn't been pushed before that point (which is possible since we don't force the log until later) then the intent done release will try to free its associated intent, which has already been freed. This patch starts to address this mess by having the ->commit_pass2 functions recreate the xfs_defer_pending state. The next few patches will fix the recovery functions. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_defer.c | 105 +++++++++++++++++++++-------- fs/xfs/libxfs/xfs_defer.h | 5 ++ fs/xfs/libxfs/xfs_log_recover.h | 3 + fs/xfs/xfs_attr_item.c | 10 +-- fs/xfs/xfs_bmap_item.c | 9 +-- fs/xfs/xfs_extfree_item.c | 9 +-- fs/xfs/xfs_log.c | 1 + fs/xfs/xfs_log_priv.h | 1 + fs/xfs/xfs_log_recover.c | 113 ++++++++++++++++---------------- fs/xfs/xfs_refcount_item.c | 9 +-- fs/xfs/xfs_rmap_item.c | 9 +-- 11 files changed, 158 insertions(+), 116 deletions(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index f71679ce23b9..363da37a8e7f 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -245,23 +245,53 @@ xfs_defer_create_intents( return ret; } -STATIC void +static inline void xfs_defer_pending_abort( + struct xfs_mount *mp, + struct xfs_defer_pending *dfp) +{ + const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type]; + + trace_xfs_defer_pending_abort(mp, dfp); + + if (dfp->dfp_intent && !dfp->dfp_done) { + ops->abort_intent(dfp->dfp_intent); + dfp->dfp_intent = NULL; + } +} + +static inline void +xfs_defer_pending_cancel_work( + struct xfs_mount *mp, + struct xfs_defer_pending *dfp) +{ + const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type]; + struct list_head *pwi; + struct list_head *n; + + trace_xfs_defer_cancel_list(mp, dfp); + + list_del(&dfp->dfp_list); + list_for_each_safe(pwi, n, &dfp->dfp_work) { + list_del(pwi); + dfp->dfp_count--; + trace_xfs_defer_cancel_item(mp, dfp, pwi); + ops->cancel_item(pwi); + } + ASSERT(dfp->dfp_count == 0); + kmem_cache_free(xfs_defer_pending_cache, dfp); +} + +STATIC void +xfs_defer_pending_abort_list( struct xfs_mount *mp, struct list_head *dop_list) { struct xfs_defer_pending *dfp; - const struct xfs_defer_op_type *ops; /* Abort intent items that don't have a done item. */ - list_for_each_entry(dfp, dop_list, dfp_list) { - ops = defer_op_types[dfp->dfp_type]; - trace_xfs_defer_pending_abort(mp, dfp); - if (dfp->dfp_intent && !dfp->dfp_done) { - ops->abort_intent(dfp->dfp_intent); - dfp->dfp_intent = NULL; - } - } + list_for_each_entry(dfp, dop_list, dfp_list) + xfs_defer_pending_abort(mp, dfp); } /* Abort all the intents that were committed. */ @@ -271,7 +301,7 @@ xfs_defer_trans_abort( struct list_head *dop_pending) { trace_xfs_defer_trans_abort(tp, _RET_IP_); - xfs_defer_pending_abort(tp->t_mountp, dop_pending); + xfs_defer_pending_abort_list(tp->t_mountp, dop_pending); } /* @@ -389,27 +419,13 @@ xfs_defer_cancel_list( { struct xfs_defer_pending *dfp; struct xfs_defer_pending *pli; - struct list_head *pwi; - struct list_head *n; - const struct xfs_defer_op_type *ops; /* * Free the pending items. Caller should already have arranged * for the intent items to be released. */ - list_for_each_entry_safe(dfp, pli, dop_list, dfp_list) { - ops = defer_op_types[dfp->dfp_type]; - trace_xfs_defer_cancel_list(mp, dfp); - list_del(&dfp->dfp_list); - list_for_each_safe(pwi, n, &dfp->dfp_work) { - list_del(pwi); - dfp->dfp_count--; - trace_xfs_defer_cancel_item(mp, dfp, pwi); - ops->cancel_item(pwi); - } - ASSERT(dfp->dfp_count == 0); - kmem_cache_free(xfs_defer_pending_cache, dfp); - } + list_for_each_entry_safe(dfp, pli, dop_list, dfp_list) + xfs_defer_pending_cancel_work(mp, dfp); } /* @@ -665,6 +681,39 @@ xfs_defer_add( dfp->dfp_count++; } +/* + * Create a pending deferred work item to replay the recovered intent item + * and add it to the list. + */ +void +xfs_defer_start_recovery( + struct xfs_log_item *lip, + enum xfs_defer_ops_type dfp_type, + struct list_head *r_dfops) +{ + struct xfs_defer_pending *dfp; + + dfp = kmem_cache_zalloc(xfs_defer_pending_cache, + GFP_NOFS | __GFP_NOFAIL); + dfp->dfp_type = dfp_type; + dfp->dfp_intent = lip; + INIT_LIST_HEAD(&dfp->dfp_work); + list_add_tail(&dfp->dfp_list, r_dfops); +} + +/* + * Cancel a deferred work item created to recover a log intent item. @dfp + * will be freed after this function returns. + */ +void +xfs_defer_cancel_recovery( + struct xfs_mount *mp, + struct xfs_defer_pending *dfp) +{ + xfs_defer_pending_abort(mp, dfp); + xfs_defer_pending_cancel_work(mp, dfp); +} + /* * Move deferred ops from one transaction to another and reset the source to * initial state. This is primarily used to carry state forward across @@ -769,7 +818,7 @@ xfs_defer_ops_capture_abort( { unsigned short i; - xfs_defer_pending_abort(mp, &dfc->dfc_dfops); + xfs_defer_pending_abort_list(mp, &dfc->dfc_dfops); xfs_defer_cancel_list(mp, &dfc->dfc_dfops); for (i = 0; i < dfc->dfc_held.dr_bufs; i++) diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h index 8788ad5f6a73..5dce938ba3d5 100644 --- a/fs/xfs/libxfs/xfs_defer.h +++ b/fs/xfs/libxfs/xfs_defer.h @@ -125,6 +125,11 @@ void xfs_defer_ops_capture_abort(struct xfs_mount *mp, struct xfs_defer_capture *d); void xfs_defer_resources_rele(struct xfs_defer_resources *dres); +void xfs_defer_start_recovery(struct xfs_log_item *lip, + enum xfs_defer_ops_type dfp_type, struct list_head *r_dfops); +void xfs_defer_cancel_recovery(struct xfs_mount *mp, + struct xfs_defer_pending *dfp); + int __init xfs_defer_init_item_caches(void); void xfs_defer_destroy_item_caches(void); diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h index a5100a11faf9..271a4ce7375c 100644 --- a/fs/xfs/libxfs/xfs_log_recover.h +++ b/fs/xfs/libxfs/xfs_log_recover.h @@ -153,4 +153,7 @@ xlog_recover_resv(const struct xfs_trans_res *r) return ret; } +void xlog_recover_intent_item(struct xlog *log, struct xfs_log_item *lip, + xfs_lsn_t lsn, unsigned int dfp_type); + #endif /* __XFS_LOG_RECOVER_H__ */ diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 11e88a76a33c..a32716b8cbbd 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -772,14 +772,8 @@ xlog_recover_attri_commit_pass2( attrip = xfs_attri_init(mp, nv); memcpy(&attrip->attri_format, attri_formatp, len); - /* - * The ATTRI has two references. One for the ATTRD and one for ATTRI to - * ensure it makes it into the AIL. Insert the ATTRI into the AIL - * directly and drop the ATTRI reference. Note that - * xfs_trans_ail_update() drops the AIL lock. - */ - xfs_trans_ail_insert(log->l_ailp, &attrip->attri_item, lsn); - xfs_attri_release(attrip); + xlog_recover_intent_item(log, &attrip->attri_item, lsn, + XFS_DEFER_OPS_TYPE_ATTR); xfs_attri_log_nameval_put(nv); return 0; } diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c index e736a0844c89..6cbae4fdf43f 100644 --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -681,12 +681,9 @@ xlog_recover_bui_commit_pass2( buip = xfs_bui_init(mp); xfs_bui_copy_format(&buip->bui_format, bui_formatp); atomic_set(&buip->bui_next_extent, bui_formatp->bui_nextents); - /* - * Insert the intent into the AIL directly and drop one reference so - * that finishing or canceling the work will drop the other. - */ - xfs_trans_ail_insert(log->l_ailp, &buip->bui_item, lsn); - xfs_bui_release(buip); + + xlog_recover_intent_item(log, &buip->bui_item, lsn, + XFS_DEFER_OPS_TYPE_BMAP); return 0; } diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index 3fa8789820ad..cf0ddeb70580 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -820,12 +820,9 @@ xlog_recover_efi_commit_pass2( return error; } atomic_set(&efip->efi_next_extent, efi_formatp->efi_nextents); - /* - * Insert the intent into the AIL directly and drop one reference so - * that finishing or canceling the work will drop the other. - */ - xfs_trans_ail_insert(log->l_ailp, &efip->efi_item, lsn); - xfs_efi_release(efip); + + xlog_recover_intent_item(log, &efip->efi_item, lsn, + XFS_DEFER_OPS_TYPE_FREE); return 0; } diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index ee206facf0dc..a1650fc81382 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -1542,6 +1542,7 @@ xlog_alloc_log( log->l_covered_state = XLOG_STATE_COVER_IDLE; set_bit(XLOG_ACTIVE_RECOVERY, &log->l_opstate); INIT_DELAYED_WORK(&log->l_work, xfs_log_worker); + INIT_LIST_HEAD(&log->r_dfops); log->l_prev_block = -1; /* log->l_tail_lsn = 0x100000000LL; cycle = 1; current block = 0 */ diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index fa3ad1d7b31c..e30c06ec20e3 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h @@ -407,6 +407,7 @@ struct xlog { long l_opstate; /* operational state */ uint l_quotaoffs_flag; /* XFS_DQ_*, for QUOTAOFFs */ struct list_head *l_buf_cancel_table; + struct list_head r_dfops; /* recovered log intent items */ int l_iclog_hsize; /* size of iclog header */ int l_iclog_heads; /* # of iclog header sectors */ uint l_sectBBsize; /* sector size in BBs (2^n) */ diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index a1e18b24971a..b9d2152a2bad 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1723,30 +1723,24 @@ xlog_clear_stale_blocks( */ void xlog_recover_release_intent( - struct xlog *log, - unsigned short intent_type, - uint64_t intent_id) + struct xlog *log, + unsigned short intent_type, + uint64_t intent_id) { - struct xfs_ail_cursor cur; - struct xfs_log_item *lip; - struct xfs_ail *ailp = log->l_ailp; + struct xfs_defer_pending *dfp, *n; + + list_for_each_entry_safe(dfp, n, &log->r_dfops, dfp_list) { + struct xfs_log_item *lip = dfp->dfp_intent; - spin_lock(&ailp->ail_lock); - for (lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); lip != NULL; - lip = xfs_trans_ail_cursor_next(ailp, &cur)) { if (lip->li_type != intent_type) continue; if (!lip->li_ops->iop_match(lip, intent_id)) continue; - spin_unlock(&ailp->ail_lock); - lip->li_ops->iop_release(lip); - spin_lock(&ailp->ail_lock); - break; - } + ASSERT(xlog_item_is_intent(lip)); - xfs_trans_ail_cursor_done(&cur); - spin_unlock(&ailp->ail_lock); + xfs_defer_cancel_recovery(log->l_mp, dfp); + } } int @@ -1939,6 +1933,29 @@ xlog_buf_readahead( xfs_buf_readahead(log->l_mp->m_ddev_targp, blkno, len, ops); } +/* + * Create a deferred work structure for resuming and tracking the progress of a + * log intent item that was found during recovery. + */ +void +xlog_recover_intent_item( + struct xlog *log, + struct xfs_log_item *lip, + xfs_lsn_t lsn, + unsigned int dfp_type) +{ + ASSERT(xlog_item_is_intent(lip)); + + xfs_defer_start_recovery(lip, dfp_type, &log->r_dfops); + + /* + * Insert the intent into the AIL directly and drop one reference so + * that finishing or canceling the work will drop the other. + */ + xfs_trans_ail_insert(log->l_ailp, lip, lsn); + lip->li_ops->iop_unpin(lip, 0); +} + STATIC int xlog_recover_items_pass2( struct xlog *log, @@ -2533,29 +2550,22 @@ xlog_abort_defer_ops( */ STATIC int xlog_recover_process_intents( - struct xlog *log) + struct xlog *log) { LIST_HEAD(capture_list); - struct xfs_ail_cursor cur; - struct xfs_log_item *lip; - struct xfs_ail *ailp; - int error = 0; + struct xfs_defer_pending *dfp, *n; + int error = 0; #if defined(DEBUG) || defined(XFS_WARN) - xfs_lsn_t last_lsn; -#endif + xfs_lsn_t last_lsn; - ailp = log->l_ailp; - spin_lock(&ailp->ail_lock); -#if defined(DEBUG) || defined(XFS_WARN) last_lsn = xlog_assign_lsn(log->l_curr_cycle, log->l_curr_block); #endif - for (lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); - lip != NULL; - lip = xfs_trans_ail_cursor_next(ailp, &cur)) { - const struct xfs_item_ops *ops; - if (!xlog_item_is_intent(lip)) - break; + list_for_each_entry_safe(dfp, n, &log->r_dfops, dfp_list) { + struct xfs_log_item *lip = dfp->dfp_intent; + const struct xfs_item_ops *ops = lip->li_ops; + + ASSERT(xlog_item_is_intent(lip)); /* * We should never see a redo item with a LSN higher than @@ -2573,19 +2583,22 @@ xlog_recover_process_intents( * The recovery function can free the log item, so we must not * access lip after it returns. */ - spin_unlock(&ailp->ail_lock); - ops = lip->li_ops; error = ops->iop_recover(lip, &capture_list); - spin_lock(&ailp->ail_lock); if (error) { trace_xlog_intent_recovery_failed(log->l_mp, error, ops->iop_recover); break; } - } - xfs_trans_ail_cursor_done(&cur); - spin_unlock(&ailp->ail_lock); + /* + * XXX: @lip could have been freed, so detach the log item from + * the pending item before freeing the pending item. This does + * not fix the existing UAF bug that occurs if ->iop_recover + * fails after creating the intent done item. + */ + dfp->dfp_intent = NULL; + xfs_defer_cancel_recovery(log->l_mp, dfp); + } if (error) goto err; @@ -2606,27 +2619,15 @@ xlog_recover_process_intents( */ STATIC void xlog_recover_cancel_intents( - struct xlog *log) + struct xlog *log) { - struct xfs_log_item *lip; - struct xfs_ail_cursor cur; - struct xfs_ail *ailp; - - ailp = log->l_ailp; - spin_lock(&ailp->ail_lock); - lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); - while (lip != NULL) { - if (!xlog_item_is_intent(lip)) - break; + struct xfs_defer_pending *dfp, *n; - spin_unlock(&ailp->ail_lock); - lip->li_ops->iop_release(lip); - spin_lock(&ailp->ail_lock); - lip = xfs_trans_ail_cursor_next(ailp, &cur); - } + list_for_each_entry_safe(dfp, n, &log->r_dfops, dfp_list) { + ASSERT(xlog_item_is_intent(dfp->dfp_intent)); - xfs_trans_ail_cursor_done(&cur); - spin_unlock(&ailp->ail_lock); + xfs_defer_cancel_recovery(log->l_mp, dfp); + } } /* diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c index 2d4444d61e98..b88cb2e98227 100644 --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -696,12 +696,9 @@ xlog_recover_cui_commit_pass2( cuip = xfs_cui_init(mp, cui_formatp->cui_nextents); xfs_cui_copy_format(&cuip->cui_format, cui_formatp); atomic_set(&cuip->cui_next_extent, cui_formatp->cui_nextents); - /* - * Insert the intent into the AIL directly and drop one reference so - * that finishing or canceling the work will drop the other. - */ - xfs_trans_ail_insert(log->l_ailp, &cuip->cui_item, lsn); - xfs_cui_release(cuip); + + xlog_recover_intent_item(log, &cuip->cui_item, lsn, + XFS_DEFER_OPS_TYPE_REFCOUNT); return 0; } diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c index 0e0e747028da..c30d4a4a14b2 100644 --- a/fs/xfs/xfs_rmap_item.c +++ b/fs/xfs/xfs_rmap_item.c @@ -702,12 +702,9 @@ xlog_recover_rui_commit_pass2( ruip = xfs_rui_init(mp, rui_formatp->rui_nextents); xfs_rui_copy_format(&ruip->rui_format, rui_formatp); atomic_set(&ruip->rui_next_extent, rui_formatp->rui_nextents); - /* - * Insert the intent into the AIL directly and drop one reference so - * that finishing or canceling the work will drop the other. - */ - xfs_trans_ail_insert(log->l_ailp, &ruip->rui_item, lsn); - xfs_rui_release(ruip); + + xlog_recover_intent_item(log, &ruip->rui_item, lsn, + XFS_DEFER_OPS_TYPE_RMAP); return 0; } From patchwork Wed Mar 27 00:12:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605364 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 181C47FF; Wed, 27 Mar 2024 00:12:59 +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=1711498381; cv=fail; b=svkT44zPNhpFQQv+PJ+wYZpiSnGC2oq+Fd78OzzFdWJ6Ayy49XqIwYDvExepsPqgMB3t1UuJF9BgzN9HNPpv6r3cb2WDFcyCFHQAs5h4DfpnA6sNAtDzAHOXSDubAR0m9/nb1DwIOcm15HTF3VuYiQczHHUnj84E3ioLcffDgpc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498381; c=relaxed/simple; bh=eD4MDhTj0WjNYZxwYlv6wLx29+emTnQGHtMAlVWfi8Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Z8XDfsGJ9Kok9JZxysmhGloccTFw4Dov6rr9yakGMNs9kD6vEDUYxuS53q8M6M9kuPoWphEyxEqlY7xNw8wT4q3JnIUwN84u0cjZjf0o5xerTdRzsHy7KJrsRKjrMAxsJ8M1Ys7z4USdTBZx41qw8ftUwEfxRlyBVwXF6sZzpOY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=LqwBqx+4; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Qitdkyy+; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="LqwBqx+4"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Qitdkyy+" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLi0kY016419; Wed, 27 Mar 2024 00:12:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=Auqw0sX6VUz2uJdB6R8O3dnJ0Nyboi3UaacxlOaG9Co=; b=LqwBqx+42Oh0pENnMg9q9tRRigeuiwc3kkQG+jInIWCbkMpGBd78ZJ/au+9RjUEoXYWf Ihnj4oldaCYzd3DNF001osNzOE8eyb76SDJvH/01mHHIjDQLrr6e4+7xM2rli1Rgvkl2 nkxXDwCQ3IwZEauoKTu1eOJKlc/huOaSqEuMd6Gh578QeeLkJY6KdXroRhTnCh8a9OEX ygzcTPd4bPd1PvDYzs0g6m7TfrpsVDei6UpIeLMFqcnwavuvxwZvThf3y480JUWJnp0b UluXz6qwswcZ3I/41dt6zP8zRQaGzmOFLYI70CuobMi5lErQE4b9BnZhRpqfriKgG2y4 WQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1q4dxc0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:58 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42QNYHVV021954; Wed, 27 Mar 2024 00:12:57 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh80x73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:12:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kka4eREhuD6X2HNyLaNo8a99RSh5wGYoXHybkhWMJWtXBwsaP3RkE6WcOqHOnogbGURlM3CzdWkeAb5H6ETKZLpdhMwh+kRgIdOp+kKmTSoF5JLv22PNsDOEo+WTHzO1TChkYR/Qe4e3bduJPhSSGl6JdlRIZThjTU4vYvugGEl72wrDgUMRP3IufABN7uZhGzbpdUsZv3aQyx0HAJvtQhaZ6iehQPOZnDHNlZjgNNMmqlq0RdkGwzWrSxiclRrbmfTVPWEDgdCcBv7WSbk/lPUT575+iTPjfYpjg7ElQMVOzbZXOBwA8IY5wEmqr8PzZmg3B0SwLs27zwl1BGoBQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Auqw0sX6VUz2uJdB6R8O3dnJ0Nyboi3UaacxlOaG9Co=; b=VrSALDjNSpXPhNhc/1jFGYqeKiuvMSzBoiGDauhsXW9jq0wVkj17Xugp2Skx1YdwRLTbrfSorFJN3abI/LoXZLV70YRS48/lJuDLLfFqdz09vJ1pCEfDOl9N/nf94UWQo4FOLetQFSRi58kGv1MyOF6EA3cGNvtBTkdnHXZkfijnBd4mpCSsniBlgRTP+Au+PyOhBjuzouxGV56dMtuT81bldmICv7tuM5W/c++QsnEG15kzf0n0jwgYA19B0p2RslUYTLkGBmNw6mEXk8C9Kks1jURbhsCkAhPyrDSQ3gVP00oytnXiK1gbfMTlY5nYPcoxzVdOwOza6v0eoUYJEQ== 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=Auqw0sX6VUz2uJdB6R8O3dnJ0Nyboi3UaacxlOaG9Co=; b=Qitdkyy+enGNtaPrR3DJRMhiUxMmiX5QbP7bPJGzEU4iVuIOzxkwqU9p8UkFm5GQxPxMuMt1TOPeXymJnsM/KPGWtXzURpIVPW08ndNRzzfblbxHHOX8Fb3gWo+5syot1oYAAyJXKx6NlsEThI5xFAQ+YCXVxFTh86XjqszaQds= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by PH7PR10MB6226.namprd10.prod.outlook.com (2603:10b6:510:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:12:55 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:55 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 06/24] xfs: pass the xfs_defer_pending object to iop_recover Date: Tue, 26 Mar 2024 17:12:15 -0700 Message-Id: <20240327001233.51675-7-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0026.namprd05.prod.outlook.com (2603:10b6:a03:c0::39) 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_|PH7PR10MB6226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bBk3OlJ56xGoO8c4bzfRGE4Vs0zRlq/iZwjf1P+YT5hvSXDbbmPE54FhjKJmIJLkLaPLQyhOdp/b6+MVE4RaG0Bm/fX6u4tCZMx1X0PMJiKvEtNoIMzT8T3GTTv5yITwpSi/4VTGmVd4zxRUVY/95Uzcs/F4gftEXd7218fvhQ7UCxDhmh7/3I3AKsemy59kuEOad/S3FQs1E8chs8fJDy5kbk/XiPjFkoUPPMmOZtFwP59Mlqxnd34EG76ihLT3HdwavDHN5eAML4GXYWJqqKjR7y961P2NBkWk5UkAj8T4jRlVRm9fBfqpD/Io3Xeaxv9Luibrs6FsD/7+PqAV/OLw3t2wSPCRGkaSHJ42/1Dm2DwOmotW8HHHQzjfwPzwfgCsfd9np+xcTtr/MB4DtVv3lShhXN8EvVvioCMk3e0K1n3JEj25MmOtEynSALIqIsycJXXY2FC9V6jwqi4M3vSRMA5tU+JkYCqY70/6u+HNgakUwHjRld8v34hZyRp3d9s6Kfl6DoJ7vjZdC8VfQ+4wDkRYaWPaFXkXU68N9RH9lEtQ41ZE6ylDlyT+/QHU1SpVI2iwP4E2XbfWXNbCSHO1IQMrffgYh3q1Zos8Ytw5xoafDGPe2tRKJ7EneiHyxjmsGRyedFGEFQsWfAEdr+deRv7ZMECkqpv8svsf5CI= 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:(13230031)(1800799015)(366007)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4KsB4la69E9HiLpwmkMWOWjLZAk73TlP8lUwst0CnwT2XcrwrIwzZmSkFGEOiQml+srgyDNObwdMaYgfNqb4svVb+XJvrS1qVawL8QxTS1X99TYBpOQGmc7tofJmT3idT9HcMjt7Rr0iqLxsV9nwsn8MR2xozG0xMgR1qMFBD7/d3AqANgiZkJDJSnwjQG5u86BxaZDSsntwyP5QW2K5b2NJVQpJmqJ+tKDksRMUfeBpOoHEEJn9uo6aSvS4SRBpHLtZnyxKT5MQmmG8vv8WX5Nntb6QGfz/1bVFubpSopuFN3+vD1ZZQ9jLMB+2qy5Guk2kB0zOTvG6dGSr54de3ERSik4pDBwZp/9lYm9AsydcVGnc4T7CQMdr8q5u+Gjt9qWwiWdOX8wjOMA2NsPvSE0W4k45oOpa2pM4nbcKhtG2ZSIT382yq4DApYPI6JoG9ljteDsRXoNvQsJHUFOIhf6dOVuKxvZXz7K9VF9QzHWF04IeGuOFQxR0XfcT4dvBz5QHt2bdbekik4FXCCHk2fyoutPb++Fa6RYckdZ0ftKqPn67RCHtLBsL/I1dvUP31ax3aS4gKV4girltjyp3f846c8LCwhDN3ZMG3QWvfwLj1AxozCfe2eO0RVmkeTOLoCR+8ZQC03vsPEOdygxeoPSyL8ljghKIpkS3sCVtSsCZ0RfurkcZOE4BcXBNyHlXwRGjVGTLKCo04nEgfiNkujmbyJCA0i5UhQbpo0StDcpWh+pKXgMvLB8zYK/qM3eK30zej+TX3uNRyEQwfctaoiVGUxYPh0nOIA2SQjSigGxI63TjNpIoKbgulxF77r9zi7u4oXttvlFPjSQKRPP8sVNb/phBmu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wGSmz6DdBxf9VNpQ+cpPlZaruTzhCH4zNGhqbCxI/CIb0gqhCEUUIbaXGIKFOYWE2QJ6oBeXERbxpzhX6zPOOjJh9V8Us+mJi8zn0sFbtF/xIpApu3/+VS2vMvm1Mody0P/2iZYl21IRzUqoJvHZHlGEYQqpBstuVE6w+z2rL832VeFxMYT9Dvb7Uz+PE3gWzrIqrM5guAtRMF9I18AA9OVDVmuF70IxU13YhjuqQLwVDi2R0e05JCuwWcnp/OuKEBvfC6UtmsxALmcgiN9S+yzijUmLbjKK6f55Qg2v/eCkxmEtYYfqhD04svUKKbC18Qxy+B8ozogWztimNKj3Qt70hAfMXNdkC75k4QgeT4WCxA9n1cBmc3N9ZMK14dztnmLLvt1JsNyTbbHFOGO8nQjK/eF8ckMe5UWTTfI7yEq0XZczaie2Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60f0bd1b-3763-4393-adc0-08dc4df2a6d7 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:55.8699 (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: S8OjJcbbOG3O82XvpkU0sUpqNFs+cY13l6R+uv3t6XLwZWLEWURkl5YoFq3nKOfUAnP+CIdoVCKaGrQojK9ouobNS4x6QEEiwRjJsxdVAQE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6226 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-ORIG-GUID: z9O-1LhkDTf5NYkgybJIdCm8eoVPy7q3 X-Proofpoint-GUID: z9O-1LhkDTf5NYkgybJIdCm8eoVPy7q3 From: "Darrick J. Wong" commit a050acdfa8003a44eae4558fddafc7afb1aef458 upstream. Now that log intent item recovery recreates the xfs_defer_pending state, we should pass that into the ->iop_recover routines so that the intent item can finish the recreation work. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/xfs_attr_item.c | 3 ++- fs/xfs/xfs_bmap_item.c | 3 ++- fs/xfs/xfs_extfree_item.c | 3 ++- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_refcount_item.c | 3 ++- fs/xfs/xfs_rmap_item.c | 3 ++- fs/xfs/xfs_trans.h | 4 +++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index a32716b8cbbd..6119a7a480a0 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -545,9 +545,10 @@ xfs_attri_validate( */ STATIC int xfs_attri_item_recover( - struct xfs_log_item *lip, + struct xfs_defer_pending *dfp, struct list_head *capture_list) { + struct xfs_log_item *lip = dfp->dfp_intent; struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); struct xfs_attr_intent *attr; struct xfs_mount *mp = lip->li_log->l_mp; diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c index 6cbae4fdf43f..3ef55de370b5 100644 --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -486,11 +486,12 @@ xfs_bui_validate( */ STATIC int xfs_bui_item_recover( - struct xfs_log_item *lip, + struct xfs_defer_pending *dfp, struct list_head *capture_list) { struct xfs_bmap_intent fake = { }; struct xfs_trans_res resv; + struct xfs_log_item *lip = dfp->dfp_intent; struct xfs_bui_log_item *buip = BUI_ITEM(lip); struct xfs_trans *tp; struct xfs_inode *ip = NULL; diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index cf0ddeb70580..a8245c5ffe49 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -657,10 +657,11 @@ xfs_efi_validate_ext( */ STATIC int xfs_efi_item_recover( - struct xfs_log_item *lip, + struct xfs_defer_pending *dfp, struct list_head *capture_list) { struct xfs_trans_res resv; + struct xfs_log_item *lip = dfp->dfp_intent; struct xfs_efi_log_item *efip = EFI_ITEM(lip); struct xfs_mount *mp = lip->li_log->l_mp; struct xfs_efd_log_item *efdp; diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index b9d2152a2bad..ff768217f2c7 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -2583,7 +2583,7 @@ xlog_recover_process_intents( * The recovery function can free the log item, so we must not * access lip after it returns. */ - error = ops->iop_recover(lip, &capture_list); + error = ops->iop_recover(dfp, &capture_list); if (error) { trace_xlog_intent_recovery_failed(log->l_mp, error, ops->iop_recover); diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c index b88cb2e98227..3456201aa3e6 100644 --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -474,10 +474,11 @@ xfs_cui_validate_phys( */ STATIC int xfs_cui_item_recover( - struct xfs_log_item *lip, + struct xfs_defer_pending *dfp, struct list_head *capture_list) { struct xfs_trans_res resv; + struct xfs_log_item *lip = dfp->dfp_intent; struct xfs_cui_log_item *cuip = CUI_ITEM(lip); struct xfs_cud_log_item *cudp; struct xfs_trans *tp; diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c index c30d4a4a14b2..dfd5a3e4b1fb 100644 --- a/fs/xfs/xfs_rmap_item.c +++ b/fs/xfs/xfs_rmap_item.c @@ -504,10 +504,11 @@ xfs_rui_validate_map( */ STATIC int xfs_rui_item_recover( - struct xfs_log_item *lip, + struct xfs_defer_pending *dfp, struct list_head *capture_list) { struct xfs_trans_res resv; + struct xfs_log_item *lip = dfp->dfp_intent; struct xfs_rui_log_item *ruip = RUI_ITEM(lip); struct xfs_rud_log_item *rudp; struct xfs_trans *tp; diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 6e3646d524ce..4e38357237c3 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -66,6 +66,8 @@ struct xfs_log_item { { (1u << XFS_LI_DIRTY), "DIRTY" }, \ { (1u << XFS_LI_WHITEOUT), "WHITEOUT" } +struct xfs_defer_pending; + struct xfs_item_ops { unsigned flags; void (*iop_size)(struct xfs_log_item *, int *, int *); @@ -78,7 +80,7 @@ struct xfs_item_ops { xfs_lsn_t (*iop_committed)(struct xfs_log_item *, xfs_lsn_t); uint (*iop_push)(struct xfs_log_item *, struct list_head *); void (*iop_release)(struct xfs_log_item *); - int (*iop_recover)(struct xfs_log_item *lip, + int (*iop_recover)(struct xfs_defer_pending *dfp, struct list_head *capture_list); bool (*iop_match)(struct xfs_log_item *item, uint64_t id); struct xfs_log_item *(*iop_relog)(struct xfs_log_item *intent, From patchwork Wed Mar 27 00:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605365 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 C4E74F9C8; Wed, 27 Mar 2024 00:13:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498384; cv=fail; b=Xy0/Bc0XNLOXYjE+m+FBhTSBc5Ycx7x+G6oba9Fbs9qhj0SX3NTTaheYSCyEqZjGksxBK/wByYHn7oOrYvDPiLc87FRjX2nsAI5VSqebdJ7RxxSt5gdRrXv2R9/Wqv4DOcqu5vRSTbmkilm0DM11loY4AxbQXL5febBl2qNYZ9s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498384; c=relaxed/simple; bh=VLqJMxv+spxylycCs8wDlJLJK0PgGu8TTIGckSHed/Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=mvXj5IqcJcl+GILldqCS+XHtDfHmo8TPk4BLH0WIJ3rvE3LufSB7KdYs8l9HO/OImBsFrnhJ31fDh1ZSxYEoD5CM4nja5mCAtmCM9BfyGEEb934KdaC6BJXtk0hwSOuE2LyluudK/d7T7JF64SfPv78ikm94IsmYzLg0BWirVxk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=Cfw+G/9U; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=VVtv0Pve; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="Cfw+G/9U"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="VVtv0Pve" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLjlAZ019151; Wed, 27 Mar 2024 00:13:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=zg+iYY15lMbTJ3Ozfjfo4AD+6sMrod1KsW+LC8LaH5s=; b=Cfw+G/9UjebqC7itLTvYZdCgUcTtmZa3HPAL/VrdhCcMyqznxDE6+fwxalpQgBzf8D2v +VY661zKkQbRvqW8CNCqVknjjSJ9DTZE08iemnfFe1ELuyhbMlEH65urAyIGnT0tkueT mENqT75qNBlJVxs17XGGlNPRL/mrutKDnbhLloOhyWxVGwAdGJaiNzO5KvgWaxzJ8Cd2 9L9cN68VUKzPKdsDMkGCtaAgXDaECXtB9a4K6yHulSG800i7qRlaNT0kOoWwKwnFr1FF KVZXVEPVXMt8iNEV41LRKp1aOUbweXIBRcqIGciXdv+wV2RERvqDXvTNpKV8tNO04sF5 JA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1pybp8af-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:01 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R02Rfd020876; Wed, 27 Mar 2024 00:13:00 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1ac2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IAjj2ivQeuDDUO4ze7i1XD4sg8EwVVD0gsrsQPSFZ1uDQ+Fj798zKl4qkVoNijtwTYtxBiccA7MD4gjZV6aynAt1TfD5QLIeCD/b8OsMNogiAhaG/D3AyykHdS254YS2+ydyNiKmNvQpwYrgkqlCop4RhKIKtCzahHt3dSeJfVXP61Ffp/hba0Wf+SBXD6HZb9oQIlbjcoWFkKDhS4aVgrZQh2dfM9su10bNeLE3ePfzaVUe6YypvvhVXGHR/ZRf2Ei9J13FVQWOns1m6dORYrK2+ZEXRRtSZcgbW80QDv4RyW9VBNnPowcZh/qn1DY3U15CfvcNoJ/KtqieAkWb4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=zg+iYY15lMbTJ3Ozfjfo4AD+6sMrod1KsW+LC8LaH5s=; b=jGXim/Ab4OuynPqBWCHGMWyDWKeDnOSzCAW4yG5gX7bcbvmzMuOH0TvwLbJe1AcjCIzQaa+tagSpWF55b66zG/yiziLCtHrIGb7Hvbgow4bwR/K8KzwbfMUuozZy+UGdwq2Rh6iKob2EhSBFlU4Y9j4gIPICu17exZqv4bgr8Lf1I3Xnz+hznVPpta80rvZn4O22LdA8klLdBVxopqIVr+zTmtq8yAwLo+voHr5dxJ3kXPphy/JLRKYR+gH6o0Fi+rddJdPC7n90XqLeZuJgzeif5UzWPyhjj0XxNxIWp2bJIr7Jg7eg9L6trQOIyBLwh8ed9LoT+zssYgHwcY5ydA== 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=zg+iYY15lMbTJ3Ozfjfo4AD+6sMrod1KsW+LC8LaH5s=; b=VVtv0PveMwnY0IO+ph8igYqlrBE/JVXzZcUGdQG7lVH7c6iGamJZIybMLc2uomlVWJPBEBaDB+5RGD+v+jZ/AwTYLmHS0C0qa8eHBcig/whKC6u5SH99twSZVdaijZPwRhqPYmAfl4eG5fAxOzBBSHQkyIxSmvUxTSyN+PUuECE= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by CH0PR10MB7533.namprd10.prod.outlook.com (2603:10b6:610:183::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Wed, 27 Mar 2024 00:12:58 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:12:58 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 07/24] xfs: transfer recovered intent item ownership in ->iop_recover Date: Tue, 26 Mar 2024 17:12:16 -0700 Message-Id: <20240327001233.51675-8-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR05CA0017.namprd05.prod.outlook.com (2603:10b6:a03:c0::30) 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_|CH0PR10MB7533:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V67g3fqH1PdTUO21l9w6IlZZoGrxoFT93e/MDU5JWHvg9T9DfsPIJqaN0v8KQbUK7/1droRda0a66G1Rxua+kLDVZAAV5+S+9497htqjIC+X/ospBRwZJIzmlBTUlw7YO6ARjvNZenogw5tV9YyW+0BXeXLlmMdnEGopDu46mr4WYth+iXPRHdfdqTYtehk9nQDFXKyH0zQ4jl/6ImHVturmR1OZgFX2piSLtJd2iHQ8xAYJvFTv1Rn3xsZ3JV38Vx/KxR/R+KoN2+74xNETD9C/nTMgY97zcLu+sWQebNDqVeASN2qB1ON8xjSXCQhbJ7RpLqClpd7hJJosJ39PE+hog0OGb42hIy7NjxxrLqQ5Ks8YI1yfYHeaEH5lh/6ri2VDZ0gormsP8RHjUzW82NWar759w0UXJ004PQo2NPMCG8OauCR93CHsWuoMXExj57UMIXj+TBavuAtiW1wW5KlzyN/l7FpOlsK/+w5awkgt3brvCOwKhbNkyUwb4LCS3VLOmvU87kq+lNdUJLzjQcPtSSFrs33pjbFJtUGZti0La1Srd2PQ/HxD+22Hj6rnwyF2ygDbHCkeNxpbBMirFoZ8RCbUch/fm/aUfU2CMh2a0vZArZCysQeB/SAKtZ5XSeNchPlZWDuvavLqffyVVT4yGGO+caKRVDTl97N4c4U= 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:(13230031)(1800799015)(376005)(366007);DIR:OUT;SF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sSwNeWttmihdFaavng5VXX5+0qA/Jmd1kksixjpq6YDOsf80fiqYNgUlQico3sBl3WIIs+wGkXmIVwQZuMFVO5117zOdn3Vfdf1TScYkJjTcXiR2t5MXMN89pnwKugqhrufmVU1GWS6tHx8gqIOV6trZVEp0jke2rnGiZsa0XS9oP4kC4Dvz9glH90X56puIpMfVIwXgGJLRnKx9LF/0mR0dt4V/3wkCXwrq0dJPXvAZh3IoSHdzuBpRVdXY4rkX3+DWd58richJ6wYHUkbdLg8MdlPTYJApRu/M8V5dOppE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ca87cc2-f65d-4aeb-2b32-08dc4df2a81a X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:57.9341 (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: FQUaelrqMxPsnKxHUX7at1tMBvp5Kee3UM4msxNYeyEWs9msdogfBr+riBDvLdRoDQm/oPqtYpFx2KeYye08XNqGUydWScUWAcgF7pqbxpA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB7533 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: 90BBcDveVNcjDYLK6RYF5pldZME583z3 X-Proofpoint-ORIG-GUID: 90BBcDveVNcjDYLK6RYF5pldZME583z3 From: "Darrick J. Wong" commit deb4cd8ba87f17b12c72b3827820d9c703e9fd95 upstream. Now that we pass the xfs_defer_pending object into the intent item recovery functions, we know exactly when ownership of the sole refcount passes from the recovery context to the intent done item. At that point, we need to null out dfp_intent so that the recovery mechanism won't release it. This should fix the UAF problem reported by Long Li. Note that we still want to recreate the full deferred work state. That will be addressed in the next patches. Fixes: 2e76f188fd90 ("xfs: cancel intents immediately if process_intents fails") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_log_recover.h | 2 ++ fs/xfs/xfs_attr_item.c | 1 + fs/xfs/xfs_bmap_item.c | 2 ++ fs/xfs/xfs_extfree_item.c | 2 ++ fs/xfs/xfs_log_recover.c | 19 ++++++++++++------- fs/xfs/xfs_refcount_item.c | 1 + fs/xfs/xfs_rmap_item.c | 2 ++ 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h index 271a4ce7375c..13583df9f239 100644 --- a/fs/xfs/libxfs/xfs_log_recover.h +++ b/fs/xfs/libxfs/xfs_log_recover.h @@ -155,5 +155,7 @@ xlog_recover_resv(const struct xfs_trans_res *r) void xlog_recover_intent_item(struct xlog *log, struct xfs_log_item *lip, xfs_lsn_t lsn, unsigned int dfp_type); +void xlog_recover_transfer_intent(struct xfs_trans *tp, + struct xfs_defer_pending *dfp); #endif /* __XFS_LOG_RECOVER_H__ */ diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 6119a7a480a0..82775e9537df 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -632,6 +632,7 @@ xfs_attri_item_recover( args->trans = tp; done_item = xfs_trans_get_attrd(tp, attrip); + xlog_recover_transfer_intent(tp, dfp); xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c index 3ef55de370b5..b6d63b8bdad5 100644 --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -524,6 +524,8 @@ xfs_bui_item_recover( goto err_rele; budp = xfs_trans_get_bud(tp, buip); + xlog_recover_transfer_intent(tp, dfp); + xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index a8245c5ffe49..c9908fb33765 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -689,7 +689,9 @@ xfs_efi_item_recover( error = xfs_trans_alloc(mp, &resv, 0, 0, 0, &tp); if (error) return error; + efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents); + xlog_recover_transfer_intent(tp, dfp); for (i = 0; i < efip->efi_format.efi_nextents; i++) { struct xfs_extent_free_item fake = { diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index ff768217f2c7..cc14cd1c2282 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -2590,13 +2590,6 @@ xlog_recover_process_intents( break; } - /* - * XXX: @lip could have been freed, so detach the log item from - * the pending item before freeing the pending item. This does - * not fix the existing UAF bug that occurs if ->iop_recover - * fails after creating the intent done item. - */ - dfp->dfp_intent = NULL; xfs_defer_cancel_recovery(log->l_mp, dfp); } if (error) @@ -2630,6 +2623,18 @@ xlog_recover_cancel_intents( } } +/* + * Transfer ownership of the recovered log intent item to the recovery + * transaction. + */ +void +xlog_recover_transfer_intent( + struct xfs_trans *tp, + struct xfs_defer_pending *dfp) +{ + dfp->dfp_intent = NULL; +} + /* * This routine performs a transaction to null out a bad inode pointer * in an agi unlinked inode hash bucket. diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c index 3456201aa3e6..f1b259223802 100644 --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -523,6 +523,7 @@ xfs_cui_item_recover( return error; cudp = xfs_trans_get_cud(tp, cuip); + xlog_recover_transfer_intent(tp, dfp); for (i = 0; i < cuip->cui_format.cui_nextents; i++) { struct xfs_refcount_intent fake = { }; diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c index dfd5a3e4b1fb..5e8a02d2b045 100644 --- a/fs/xfs/xfs_rmap_item.c +++ b/fs/xfs/xfs_rmap_item.c @@ -537,7 +537,9 @@ xfs_rui_item_recover( XFS_TRANS_RESERVE, &tp); if (error) return error; + rudp = xfs_trans_get_rud(tp, ruip); + xlog_recover_transfer_intent(tp, dfp); for (i = 0; i < ruip->rui_format.rui_nextents; i++) { struct xfs_rmap_intent fake = { }; From patchwork Wed Mar 27 00:12:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605366 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 BB7BBF9F7; Wed, 27 Mar 2024 00:13:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498385; cv=fail; b=hIDVl+LIu6SDloeHTieae938gSeV/cqErn/NUppt+MIK2urZwTSbsI+ZxH86PQDYQzWcNOONPuQ9zlNpwMzLQRpLphXbuizm+UjI5bKFw0ICpz78SQ+qGPUDwNOcuOlQ/D9SO+nhtXSMdG1fgdo7O/57cFdyRg3k0J1ggIZtleI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498385; c=relaxed/simple; bh=P56e9wUWb+5TuOAKoc7i8mLclTtdZMEarJbuYo4ldZQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jnV34EJT3OrsEeMwY/jr6AC3izGEOJdDALBEh+5/2E/QYGh6zK5EIY5j1oLTfkMBLPjEgslOTxXOnkxFTBkqO5CUx0kuriWmBdlHW0REFfg4LJS5OBuf5oYXScKrmB7pdnsx4gwJN8/Y3EMyAyWe3+lqJW5OETwLXV/kdm+0cHk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=g1WBFN/K; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Gqay1COG; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="g1WBFN/K"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Gqay1COG" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLiWHY026015; Wed, 27 Mar 2024 00:13:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=dEcEmkavvpGIX+egnpbq8AxzdGe09ZfX27BshcdsfHE=; b=g1WBFN/KK0gDgRrDE/gUE0mQt9U9OgBFY92cR9Gu5eGQuz/OnY5yY9+o+BHedPeQkj/e vLe+CF8Q9zXzYGTA9wn5xn2/+C5ektUR3mjialZRoxYSpWCSnR5SE7WAx8x0lc2xMTPe a8dJEkTKpMEkXcYoK4IyuvPO6p1TTwHIfCvuwD2EZF/jlhLhmRRc2TqDuyZC1gGkBbN0 Bo+maxbefQwPTpUVOEkw3DiyqW9Q4Gyj74DzH8bKQ9yMMc6Iai5EgCg2zwXkmIR0D8xr z/vBuZmYN7/ldg+AWQq3Wz60AC8Xjoh02Qn6F5rdB1zM+3GfgcYcnGhZMnu14Tuae09E 0w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvscs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:02 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42QNj9d0020716; Wed, 27 Mar 2024 00:13:01 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1acr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSho9u5+jNi6w0pjTtlMhInVRmuimQEwLZReFBWsAEAum6qmj+IV3e0/6JBHO78xc7nD4ZvRmRfKlMWYq29pr2dn0tUMeesoLkUZrp/J5xlhkFF4U3XCiG39AW8ewbXRdaPwh3yBV/PWRTgci2KhTfkpXJfwQX7Bry5914CvtzCwKGLpN5/4IACcS8SU1hKo+FiSORDPsX1AT1wuDO63AlTVvohA0IklglCw0Fc05Gf5KRNd+Ckc8AWy/SiEoVy/Q9ijLEW7M2OEDSXXct0s8ELH68xXz0+DeuXDJJtaj6GR1So84ox/KpkbYtAb5+tN0lMUYknuGrTLgs9MfJSLWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=dEcEmkavvpGIX+egnpbq8AxzdGe09ZfX27BshcdsfHE=; b=BdDsIeqZLYNh2oKh745R/vt2Chm+rR6zyRcdmdq2zJO9RRl16kpoTnN1DgTma6rMf3ep/C1KWr5nKs4P214ES5ztoT2bPqOCYC+1E2qnv3aBWUbk9Dt5NSoqNTIBX9n1vS90UF5NgltHcBwbuvvNeo9Z9kqIwrvfakXu4mdLrkE/sn8qWP87cTx2jKMFr0IFaDALXPuVpWshsOo1E8ePcsrCi7E+pKo+R0jjZWJin4ijKNTHF+2hSz07RVvKxo39qiTKeW2LndZjFE/8TClGOmmxEcMOIwoMNk38fWnMl6tszlwDRqtYHXWkBkBXI4spwNMONJPXzZt/qkMeb/dl8w== 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=dEcEmkavvpGIX+egnpbq8AxzdGe09ZfX27BshcdsfHE=; b=Gqay1COGANLrKz5UicUTPfbAIa1hP8lvMEm+flY1uQz7rW2jt51kKnTB9/e7EoOTk+hq3v9cAUZYMed8XLj32GYDGhUI3uIZ0cW0N2oyARA8lEVb0tdMXLY0FBKp9X3j1vVgBgwWLepgd6dw7xIMROhx+WWdeWG2Xp/I1+EV4OY= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:00 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:00 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 08/24] xfs: make rextslog computation consistent with mkfs Date: Tue, 26 Mar 2024 17:12:17 -0700 Message-Id: <20240327001233.51675-9-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BYAPR07CA0075.namprd07.prod.outlook.com (2603:10b6:a03:12b::16) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q6hP02cDN11Rz/SY8N6tX8pOKDgmCbyqfLylMtBcHQjOY6C2MOYRAle4pKkWme8n/ID+QtLoKVPOapiF501TxhNwhbhI5jmFnAY3l+XRdThzSSPv6/xO/u1W35NmPsmdSa7f06NIU5JjDecbq4KZT3fkfO9tPWTUWs0l5IwAmtvILhHkY4+uQDoKpUlEdpov2JDTfzj5RKy4b1nBSu9Vhf9Krwh1ApXqayHwv7oDDnV1q4Byn1rCkfNJQCfHki0MApfA6O1+86x+XFFOUwMfenUhgxHKUXByx57wQqvERf117PCwKQi6YU7XOQKA9DVQVy15uIFq7S08q/BnYpCpUamovompp/zudWO6jXixjRRHSBxTKwF5YRSRoLSAxTzNl45A0iPqOFE995f5Tx007CtHc2lM5afLN+fPmzhI11WJxzEEyk1oYcqYRaADrGqJevSd/qM9TdKAhhuUQkxG/g3oLI0uQcitSM+24Qmt4GIDpY30F3JpfG/tebtbTJmkuVFN6jaD5o1mWa0wJl8KytTDYkud3Ylr+Rlzcr2mvIerLhqCesFOA0r+2tdGfEuHjzk+LFELb8EbBkYVWaV5hTSrCC0GQuepp/COJpryi3u3tO6/2vzhNwHhtyoh6nbekUG9CpSsZMeh9fyhcmOQz1ecBZfpwIX1atrwC5vBtUA= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xuit76/3+UUT+9Kd3FoZ9p3DzUHJGIjVWBQ5Z327Yw2safWEngWkR61lExr1DUOk2L9kgS7/jzXU0nT8yXx6kyZHFtdirE6VPHZt83cA1b/F0YSUDty4LimMUCEgC5iPQaX2OEj74BfPaNzaCBXcUfoNVRaej6h2Nk1F5TeFwwps7gARRL13MifDf20YvLpP3KcqrhWjcDzFJ8udjqTa7VDuMeqpfTYYjxDR4pG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coBfNpU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a845086c-f3e1-4186-47f6-08dc4df2a950 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:12:59.9750 (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: 3NqKhu2IIYzhTiVVBLImqP79fDnyfaxY/qK5q2z4JZE8ZRI9yxg7hPxJoAkURPxfHr808/49l8vlGQEYlYlZ29U6BD6EhJ03QHbE3FuOPNs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: Du_8TEpmrHwdmkehrRf6Bflovzs34o_1 X-Proofpoint-ORIG-GUID: Du_8TEpmrHwdmkehrRf6Bflovzs34o_1 From: "Darrick J. Wong" commit a6a38f309afc4a7ede01242b603f36c433997780 upstream. [backport: resolve merge conflicts due to refactoring rtbitmap/summary macros and accessors] There's a weird discrepancy in xfsprogs dating back to the creation of the Linux port -- if there are zero rt extents, mkfs will set sb_rextents and sb_rextslog both to zero: sbp->sb_rextslog = (uint8_t)(rtextents ? libxfs_highbit32((unsigned int)rtextents) : 0); However, that's not the check that xfs_repair uses for nonzero rtblocks: if (sb->sb_rextslog != libxfs_highbit32((unsigned int)sb->sb_rextents)) The difference here is that xfs_highbit32 returns -1 if its argument is zero. Unfortunately, this means that in the weird corner case of a realtime volume shorter than 1 rt extent, xfs_repair will immediately flag a freshly formatted filesystem as corrupt. Because mkfs has been writing ondisk artifacts like this for decades, we have to accept that as "correct". TBH, zero rextslog for zero rtextents makes more sense to me anyway. Regrettably, the superblock verifier checks created in commit copied xfs_repair even though mkfs has been writing out such filesystems for ages. Fix the superblock verifier to accept what mkfs spits out; the userspace version of this patch will have to fix xfs_repair as well. Note that the new helper leaves the zeroday bug where the upper 32 bits of sb_rextents is ripped off and fed to highbit32. This leads to a seriously undersized rt summary file, which immediately breaks mkfs: $ hugedisk.sh foo /dev/sdc $(( 0x100000080 * 4096))B $ /sbin/mkfs.xfs -f /dev/sda -m rmapbt=0,reflink=0 -r rtdev=/dev/mapper/foo meta-data=/dev/sda isize=512 agcount=4, agsize=1298176 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 data = bsize=4096 blocks=5192704, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/mapper/foo extsz=4096 blocks=4294967424, rtextents=4294967424 Discarding blocks...Done. mkfs.xfs: Error initializing the realtime space [117 - Structure needs cleaning] The next patch will drop support for rt volumes with fewer than 1 or more than 2^32-1 rt extents, since they've clearly been broken forever. Fixes: f8e566c0f5e1f ("xfs: validate the realtime geometry in xfs_validate_sb_common") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_rtbitmap.c | 13 +++++++++++++ fs/xfs/libxfs/xfs_rtbitmap.h | 4 ++++ fs/xfs/libxfs/xfs_sb.c | 3 ++- fs/xfs/xfs_rtalloc.c | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c index 9eb1b5aa7e35..37b425ea3fed 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c @@ -1130,3 +1130,16 @@ xfs_rtalloc_extent_is_free( *is_free = matches; return 0; } + +/* + * Compute the maximum level number of the realtime summary file, as defined by + * mkfs. The use of highbit32 on a 64-bit quantity is a historic artifact that + * prohibits correct use of rt volumes with more than 2^32 extents. + */ +uint8_t +xfs_compute_rextslog( + xfs_rtbxlen_t rtextents) +{ + return rtextents ? xfs_highbit32(rtextents) : 0; +} + diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h index c3ef22e67aa3..6becdc7a48ed 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.h +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -70,6 +70,9 @@ xfs_rtfree_extent( /* Same as above, but in units of rt blocks. */ int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, xfs_filblks_t rtlen); + +uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); + #else /* CONFIG_XFS_RT */ # define xfs_rtfree_extent(t,b,l) (-ENOSYS) # define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS) @@ -77,6 +80,7 @@ int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, # define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS) # define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS) # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS) +# define xfs_compute_rextslog(rtx) (0) #endif /* CONFIG_XFS_RT */ #endif /* __XFS_RTBITMAP_H__ */ diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 6264daaab37b..25eec54f9bb2 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -25,6 +25,7 @@ #include "xfs_da_format.h" #include "xfs_health.h" #include "xfs_ag.h" +#include "xfs_rtbitmap.h" /* * Physical superblock buffer manipulations. Shared with libxfs in userspace. @@ -509,7 +510,7 @@ xfs_validate_sb_common( NBBY * sbp->sb_blocksize); if (sbp->sb_rextents != rexts || - sbp->sb_rextslog != xfs_highbit32(sbp->sb_rextents) || + sbp->sb_rextslog != xfs_compute_rextslog(rexts) || sbp->sb_rbmblocks != rbmblocks) { xfs_notice(mp, "realtime geometry sanity check failed"); diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 5a439d90e51c..5fbe5e33c425 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -999,7 +999,7 @@ xfs_growfs_rt( nrextents = nrblocks; do_div(nrextents, in->extsize); nrbmblocks = howmany_64(nrextents, NBBY * sbp->sb_blocksize); - nrextslog = xfs_highbit32(nrextents); + nrextslog = xfs_compute_rextslog(nrextents); nrsumlevels = nrextslog + 1; nrsumsize = (uint)sizeof(xfs_suminfo_t) * nrsumlevels * nrbmblocks; nrsumblocks = XFS_B_TO_FSB(mp, nrsumsize); @@ -1061,7 +1061,7 @@ xfs_growfs_rt( nsbp->sb_rextents = nsbp->sb_rblocks; do_div(nsbp->sb_rextents, nsbp->sb_rextsize); ASSERT(nsbp->sb_rextents != 0); - nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); + nsbp->sb_rextslog = xfs_compute_rextslog(nsbp->sb_rextents); nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; nrsumsize = (uint)sizeof(xfs_suminfo_t) * nrsumlevels * From patchwork Wed Mar 27 00:12:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605367 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 97D86F9C8; Wed, 27 Mar 2024 00:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498387; cv=fail; b=gy/LxwUJ4skem5HIMruJ1MVcSlfOZjgIxLWvoyszUSuqXBDJz802dMHEnCnOkAGP/r/YA1kHIlE+6g/DY/oe7kv8Hi0FQLYymOv/NGEvBNG24iukcKVWJnfJH/+ovxMlYV5jCfL9bvojyrByskaMXarrrnmxg/B0kNqMOqaMaYc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498387; c=relaxed/simple; bh=hsBufX/JvofxonXaenjW/x16ElGY+007ixr8k/ukHt4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aeWflqYVgcsI8c2jC7pbK3HtTBHOWKabCa63t3xIJNrUCz8j0gUFnol7hTD1+KS1jw50OYI5VOygDxDneaHNE7ccVY/4WsnE/YEy5YVDIAo2zxpqirttOFQnyVZvHl1sn4tFDFgd3c2s3VPz0WfHDSHwlysmE/JJNaxmyanSpnA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=MuPxeFKY; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=E+mNKq+z; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="MuPxeFKY"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="E+mNKq+z" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLilFt026106; Wed, 27 Mar 2024 00:13:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=29qRJIMYDBxGaDnYuXz3EkjdAwdDIsOtdboR5xQDEFY=; b=MuPxeFKYGg1UBa4U5Us8Y9ce/0z5UtsO7cL7iomD3CYe3nAqmT3K9sNkLt3N2s6XvuVC W7dYwr9V0K0PzFgT866b9wE2jI4VbAwfYd1PN/nTc+3W9PHgYhQmCl8Htm8NAKyE2spm 9zgrCYIv0oVqs7UZVYSAyRhLaokXm/iJEpAuqMO8c8uRpdYoIEz4HZ9rn2CCN/fItTzw DnDYOUZV2Z2vDEBpPXKbuWcKMD+8c0d3yHySHrln8CI5hh8F5ttTvM4Oj4os6AI0sy5S QZSfZ3I8DDg3prRfvvynCEGd6mDccC10yvCFBAU295qRRcEQjDlwwLL/a4WrOODSi+2t Vg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvscu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:04 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R03cjE019720; Wed, 27 Mar 2024 00:13:04 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh7r7cd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LsEaqQ7owJa61kczlbjHGdvOckHPiTcaizlcG4HJ3F1TZOTuB5jrz+ymBt0OZmym/EO/d4ud4Vyt503mtY7eC4qy8utEg2F0e6OqftaXMKVNQv0VIvbaNR/TyVMrxvf0YT+w/tt2mQKO3/NmXhfzNB6wh/XYRu86+NlcJ2VUlmQaTwDa7O+repXbvsOW8UeOUyKySe/dCtEb5g/UDvSEbD8gsu4f12R2A1faykglftFJKjcFO8b/BRBze1ytY1vxRScrx5xQtVD4A01RtrZ3cLIKfooAHSvKQzTZHp97xRZ3pb8PvWGdWXW1v4LPDdgCcYWMazM6Uyi7PuOm4lrTSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=29qRJIMYDBxGaDnYuXz3EkjdAwdDIsOtdboR5xQDEFY=; b=jeSQAWDqsd/IyhW7XGFDtxJ53xpXlfZmaTt+YhSoc48OfyHOjdTJv0vuv2goF9+sMyXzfntv07MugDWeXD66cBq2iZHWv3c3Vbf17IQxHrP1nC5tG0JZVaLqhL00eKXM1GJp97vXlaTf4wa1/NHVEOTVi2KtwfxGg8PBQghr6OsIvzKlgzHTveeG9hiaGiXGokvURMMZQDxq39zFIgZzk1PsJczMqtaBsTvVgqje2CbwV9xhGzNDw9dZNtPrGjponKDA0Tnd+4JNtK9eZHR7K82n1A6zERM4D8gsCgb+sjVeM0cphERp3VbPPy5Cayl25JO3GScWIKfYXacRMd7gtg== 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=29qRJIMYDBxGaDnYuXz3EkjdAwdDIsOtdboR5xQDEFY=; b=E+mNKq+z0naA/T0CzK9qCqK4NtJGuKuJC3Q8wkMvojDZp2YFe5iWSHkZ/pzgK3SQ6thHWO4eas/2BbOMm9N7xqjHaOuW6lH7KmYFenhCVrW2+HHWgWTZgTnjVCa/OF+A3qV2YTdLKnfImQOAFMa6U3N7c7EWxCOuFb8I329JKrE= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:02 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:02 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 09/24] xfs: fix 32-bit truncation in xfs_compute_rextslog Date: Tue, 26 Mar 2024 17:12:18 -0700 Message-Id: <20240327001233.51675-10-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +n7D+u6S6TmFn0Zmklr05MGD6wbdljYvuxXJat1OTJ6Aafw1zmySuq9qulzSFfjUX1AeFro1tEa+IdSnN4HEccmgMAn4wcZNJ8NNKm5Go0+EVUytfIvg7lgMDdLR7CMNJHIUaNf9HQ0vePNlmmUpCRQBj44f4+aYmqeVZhoyd1TflMI62WSYxiYYOFNkX3St21DbDOSwgIC9pdAy0B8jZ4iTlhDQrPPC6WoywA/klzvgf9XWtbKnHjMuq70pRxF9ivtCBL6OimQDhDu+ICfCMh/1pZYarzOiyVfZRbPKWy4XC6cKEW0F7FUlg/JWrcsLotzzgE/8jYU/8mQvGrk1IltqDW6ywLW3T3IPF+T8zIEdALZbSTJ+zHktfGoihiZ7NIvjhEnoy8PAq6sjRhknoXNLZFfJcpv4iXjVlKYpWv0ArV79Ky5kBCMGl5D/8ade1AM3on3wNoVHxR96nw4ECHnPLpQcBK+JMBbbEjD6R8vz596pJ+SZ8nx05sLsqnNcdRMZrSwFUDNnGT27JAcoFlFtRqxa3NRx2KOQ/A3I/Axplt9H1pcNu/6RiW2kroFfrUIRR+oPf5ONULM7qOrqwICWZeH8IJCB7kuL3HcceLln5g1GzqJCcBw3yQZGI+BOYo1k2deVLFH/2pl7DXDAhELZscyb26gZ3aj/QGIqWrA= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yR5ISrGyyBiCvwub/D7sLVOZf9aVYbI4hAD+MD4ZM1X5haM8vSTrDUvwGPZoAjvgb4MMDB3Ug+uMAKin7m0jXMoclwQ5ihOTEY7bYOkQ4eNj2dnmmsboI8nX2oEJseKVcyLX2pqHVLXkA8cxIdJA/acRw+MKhmMRDDQ5nmlOv49IK5iYz7fCZ+Op/kXc+FSAx2Ynd6BKQIcJY3lN1BpohL6M0YmeUBNmiEOvLR4FkAaKhYkBSZ1wB9+ltAz/SSAKHcv8u8WbvjTFtmR3aLjyIGK5XeenXWEQa9rElQcNMCzwZs0hTSlpymqGz1zuq5AsnM7RSFTR6wSAavhpDtHyLzdSdg8M2pEA6eoYjTl6n5HvoiEuGeQr/IPCS54z/ixtILSFmmWKpnaZjomeyYLpkR8WHwGcIKLnE1cOuPlUdu5C2zLndcAlHA6ouNgGDH2mgWeZIoNlro0vIdAvPOQfvDwo5MJj5u0GdJcf16MSClmrPz2KPzusyqjNDmpMheV4OA2gQSmugzo+dNR1QvkVpFhNRJ+/igwhu+OH56BSonG9opkwu/zBvCtc5Kid1Q5MSdnJWGMP7sHchiqsInWX2o1PNLCQokH4YGuU9clRPokokJL8mrA70p8fkqcVzwb0wxqtxfPIh1chvL0WkAmt9wI6wmuhpmeUcKdSYZXqtvxDOwItN9AmKFtVnNBkeP0n5NSTF6VmdAXD1nYd3lNpgYnVN06VwK/BxZVlwzXoJUix3/mtVgBarxLnqnVFvuU5bNEM186IuCADO+4xWq/AdfdNJMlS/QxO1ptjqM//m3EeqPUQ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c1FCVkPstFF8up3f3N9edWO9Su4TMztKVTPydYoAadw/rGn1mPt/IqganCt5JcWKv9TJpyEKUUhTxQ9uSpXLILCdcADe28mHWkyCYB7OTzkqNv2lYPK1w7IzmvR1ScczeXLmiWrpzyyhgIKayWR1TSqVstdYTOYdMUwt9tsdzmK+Bl5DoifI85s9Rah+gJkH0a4aylSHlP5GzuwVMwdq8SdKTLFwhMUv/u/h95NMjXc6rkrzdYWyiRWKHlTmePkyasQ4jBWIyry43yHv5yAG5slrR1YTSnYABAIP+jtF7E9at9Yxt1OQDBclDnO/IRMhBPXhcEiqr7BMfqL/oMdnZuWbWhJV/h+CzUImqT6WUiFGOO1CMVULkWTudUNOrZJOSdwZ+cQihgRAa4KraSmK/sEhZYVwp9KBXe4RinMbpTLSGuuGYXGGkIxs5U8Oo+VmJRhQT4gD2h5Oetgql6SSfLsojDuP8gHBIcArVvBKI5N1SbGHqiFr1c= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ff09d4e-4184-4caf-1d4c-08dc4df2aa63 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:02.0381 (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: b88+faft0AF8sNdQJ7oX+CID+aEFpTdEi+8xOR29rm3B2mMsw3jbd5OyDXbxkqAxrlpNox6wsrthQrQzIIiPplI3oc5/o4CP0pyFCJDn8hs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: Kqx9YnY2rMoXo1Dhi25RZiXqrmMSeUlA X-Proofpoint-ORIG-GUID: Kqx9YnY2rMoXo1Dhi25RZiXqrmMSeUlA From: "Darrick J. Wong" commit cf8f0e6c1429be7652869059ea44696b72d5b726 upstream. It's quite reasonable that some customer somewhere will want to configure a realtime volume with more than 2^32 extents. If they try to do this, the highbit32() call will truncate the upper bits of the xfs_rtbxlen_t and produce the wrong value for rextslog. This in turn causes the rsumlevels to be wrong, which results in a realtime summary file that is the wrong length. Fix that. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_rtbitmap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c index 37b425ea3fed..8db1243beacc 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c @@ -1133,13 +1133,15 @@ xfs_rtalloc_extent_is_free( /* * Compute the maximum level number of the realtime summary file, as defined by - * mkfs. The use of highbit32 on a 64-bit quantity is a historic artifact that - * prohibits correct use of rt volumes with more than 2^32 extents. + * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct + * use of rt volumes with more than 2^32 extents. */ uint8_t xfs_compute_rextslog( xfs_rtbxlen_t rtextents) { - return rtextents ? xfs_highbit32(rtextents) : 0; + if (!rtextents) + return 0; + return xfs_highbit64(rtextents); } From patchwork Wed Mar 27 00:12:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605368 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 9F5D3F9C8; Wed, 27 Mar 2024 00:13:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498389; cv=fail; b=E58RNZFgu/Aeh4aZ86jmeD3H0d6d79FIYDwDg8vd1GZG+bs4mEq6VbfvjPXLjPHGB9E/WoHRiB0SJ6ytkAGxKP2qUM5NWQ7l55EkZ88OJdhd+sc5A7WTKR7TdvYf0oIAGiTE8kAhbrPSlnRfany0QHOd7gxo9BrU5MX0TCzdlUU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498389; c=relaxed/simple; bh=eW/fM1BRxUoFWolCdq5Uoc+/hvCLzUk8J3qghlIXm9U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=auXmCUucU6VKKUco+Pdc+BKIG1UuWHcNRE0+tUBg33SAP1KyybNvGw8jS/X8Z/91/00dgfGZLJUVNY2T5IkMKbJFVRgQWsHQoU/6xX9oSoa+QVgT7UKY9UY9XJ/328EtHRjSq+nlFytTTVD4JFrvzzsnPzjRSMWIdpgwJkCX+X0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=iH241eCA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=FuVOnqo5; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="iH241eCA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="FuVOnqo5" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLiWlp026019; Wed, 27 Mar 2024 00:13:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=NUTQZolmMoIMDz0pvbI5oaGu1Wew48Jfs/dazUAGPQY=; b=iH241eCAabMRNAMApStGRDnqJV66WczFEG/CIQNEfmLvTCxoVg/wCzzvkHsDU40z+lFz QSbhUlLYzpLyJrFndAzFRugf9CYp3Gyb7BVNaXvLQDkys3U56pfd839LXMYp60tklLZm MwktKp4EHzBwZpL0/myoKgTsyJX7iVlHmefmo6JHbXr76CHBZX0/Fz3+UbE2C6C32xcV ZYj8kyCt3iQYxmPVLCm8mPHEiy6dE2NU9IVNpoJL3hmqCqLHmiJakKlOl6/vWC/T5+r0 3FO8sJjB0DMWbFD8WPmptACDAB6BcY9mcI1JLI3kIgpJ7NnQJhWVjT0CDls/hCJFgkjR wQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvscw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:06 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R00UOX012409; Wed, 27 Mar 2024 00:13:05 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1rd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ipieLre1V3D9YZ+1MInlcHDJh0z3saUfgGtcoYc0dXrdyb2LjGxlsgGw+c/2j2RE2EbTcEG1+dY/7Pvw492C/NX9RhqRzuAcUSM9qyWazlm7hIkZAoWIlZfIw4DjEXxVrfvX0Fg6SSpsQjx46SpJAJhytdEeZopKY5diH04ECoxEHUj95/xH7K8hE0dLuibf/7z9QRyOUvEG6arvOvNWOZncAyIpxaadd3yNeHo7wMLzX9qy3PgpGAjnxTRyvpQQrXNUAaQbf/q/9/luQhWtSzIe1DR13S319oULnA3ha6g9PZxbiC1n85KB8nxxXKnNDfc5cI/NkTc/Hmsu5gJIJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=NUTQZolmMoIMDz0pvbI5oaGu1Wew48Jfs/dazUAGPQY=; b=A+dMDgqx3x+R8UmTUUxhdVAxFS7xO3Lrrw8AwmtLoEU9esW2z5wmPNmBxAp/sHSytYOTUbMJY5/hAO+Z4S3QzSCBLs6qWpksrqxwPhWiTgN2cAIyJ45dBkMKxceiis8858cODD78Zf6eivlTWTn4UBxcP6RsIZdM8SEyeXZCpgtNvZV+rXhuX51t9POO1hvUrRDAJUvzqaoa0DMel//T7Fx+vEHN6qc3i1dakSH2yPGsVx0kZRmuYFmNIxTWpULsR7cWxFWhAlT1trP7gbiqW6zRQlUVfyiMoctQjjWAszErd/qjlg4BYqwlTCeJdS4bjXTtqo0FhlIDeSxECkyj1A== 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=NUTQZolmMoIMDz0pvbI5oaGu1Wew48Jfs/dazUAGPQY=; b=FuVOnqo5KbElFo1mEt+LrgxugsXzHqP4hUpBpH1rAQyeTGtNjzMtxlS+8B0QFS7Nu1fLJ8jyo8nmi6+PpuXOSXnSEl1yTVRurcl5mp/AoayYePUmqU2MRVsOCBXRHJFsy4hayLLSZuizpcaAPha61y1nhs4V8/YH78YHUFLIQJI= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:04 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:04 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 10/24] xfs: don't allow overly small or large realtime volumes Date: Tue, 26 Mar 2024 17:12:19 -0700 Message-Id: <20240327001233.51675-11-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0022.namprd13.prod.outlook.com (2603:10b6:a03:180::35) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QDhJcwusUPOhnIj8QuJaXSLWqYnpigIzfuT7sMPocuylmJJ22jFQxZ3CZJ/uR8dZllWByEB/lWxjjQ4ovWmbi0QZiSKzHSIM2vuv9cuKzwYGNC4GBhAj3+IC6YOUtOwyDkSdAsL2GtsOBZuMQJgURqDsy3YZ0tgmv2Fz8JK8frRzO95iLfrin5xRvLgeLpCySufdxXsXA1bOFhTtyKjVyTyR733uCDFBJOlp3NZCf3kSLj9gTt2y8kVCMRCh4avG3DqpDHAtIs8U8tGuhULghD7i7o64CAHoH2J3IyeJy+6EwBzDv7jVbG73+AATDtILAcXrMg3ZRzmmNxmKO1jmjnDlWLhhHLRHwiQGHwik0MHZxrKcRdF+7p6ujv2gzoOmVvbW/TOTHLlmX2hZi8zadZ7IGuETP/1o0SviwWo2PlBK310XrVu6dqGusRiZSdJA/IeFEdvQEAA9Ie0VCViIdmB096KKskGlvxC+eM35+8jFVL6wvCk1JG5kaIldYI4EW6HP0N4w0PNyVrkPHpcG3RG96dfIQ3cxe3pyX7Ckvz7hSa8EbIEJtnd/qAiuxzSS6pPBLolbPDNN6HgxLXDqL1KC6oMs39SAOfBfijVnpp7q2J7jy2TkA7g8MNNmB3MJ2jtDxEQDOOSkeB6qbc67aYwV7jVWajrcJCzZhAYwsqE= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zpcXQIIN0ZVEycvmQMBdWGAxrnaALfrhh4n9b6j7GD/bC29VBRLAZB5IC6kjnvkUmzrOfL84IDGhszVytFOKAKzXTIaV3Dks8ArSz3kowLXfAnz3ZdgZffDfUkwNw7MklI4XjCecYcaB3ZNguCTZSaDldljOkZ+zuDoQduBQFzX2SI2uDAKZlSbSR5qDh3683hOW4GnGXIUR0Sbr9bJLL7GE+c4JvSBfdc+kGPgPBOiCQpyEvD5FdlUPlk1ujPzfTyBjSSWAteCV6heDDFaf5y44uPdV71GDpstK0fUkH3ugZwoJVniNle9eWZgue+sIXNyu3mmDy1qGZub4XJgTWnCQnB+A/ECrvLcfWVXsB59VkzucCAkPP0jp0veljzFRMalzXJWIXgbaLghHHPRtU8nNXg9FaW0yCt9e4/+FYh01GdEFbc1vBTkr4+o6FpdeKA2z5kDkCOYvcIIpMfYz9yzgFVnUKmRSVKihAzfamARnBW6oGmkKEaDKMQOWGG7Yupl5thlhIK0sfMeHNCZImVapPHiZmDAlZnrl6Y//0ajjCs1ixC9hS/vpJPYGJpD2n/+EA2NTvyCDmuCI+V2aS8D9SPyzoD8RHFkA8tKvQqDM+LO9yGPnp3+/ozvmrAs8QYMO1ndUFNqdiXZ9Wj42Qc2cAo8eHq0yz/d/CCVxGVF28NrlN/fQZHVdDr99cRj/tbKEo5lQH9CZpnkzzxCVeDMAtfX5oRLSqWioV0INjoveLtLFWoufOe4IGYo9uh0iggYnuSWtC+T8rRL8/Ne7fHUa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t3XB49YeG692Vd2Vsav6SsyMHx+zdHk4sJoy+ZtWSyl3I3LySGyVn+g+M9qaT7zPt6+3QjEen0UWcbDG/plPosSXHvGpUAI7cuL8i2u0Y1hf2xhgdlfd+bK1Vbrcc/ghHgBjXUEnqss1WRCZn/HlDZkI5OxbVG2BOO5af2KX6f89ful9qqlzenNiWLivPVuEdZ18fCDawqHLeDg/c4EX0mPfxMNf0CCikSWl4TT6I3DlcEq5P2YUADVKWV2FJ2CEbDpiCXLbRNGufMbULQLfkzt/RqCUoX8+iJLWSrMq8R/239kBOT8zuvVyrxIMLQA/MhwhySakvQ7kjqO2AgK9XBFmC1Bh+buiJkBS7pT4yY56wBMp0omkpO+gYkm7A8SwN0jDQsDURHHBntLwRefmkPCcA98EfjhrYeJufc//I6OxpwfvXmEdZ5NYihR8CIK1kiqFzsI0gGuqs8qZen5PJwQz5LSuZs5cMreRvYlRxJ59zGgkLUOxd2z5r1y+ZuIobo6M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aad81866-e988-4b83-6e54-08dc4df2ab9c X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:04.0419 (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: lVOBfeAp3CvJGOSqm1u0Q52RMh4U8oVChzGOtl2wIG6L7GuhkUZDNuu1ziI6Jo2mdqqZaiHtaNeVec6h4GtHWw/TiacHS1pMgtfVXEV7qTU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: CyveLpdauz8MDeGOfe2dx8cG0LcECPBC X-Proofpoint-ORIG-GUID: CyveLpdauz8MDeGOfe2dx8cG0LcECPBC From: "Darrick J. Wong" commit e14293803f4e84eb23a417b462b56251033b5a66 upstream. [backport: resolve merge conflicts due to refactoring rtbitmap/summary macros and accessors] Don't allow realtime volumes that are less than one rt extent long. This has been broken across 4 LTS kernels with nobody noticing, so let's just disable it. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_rtbitmap.h | 13 +++++++++++++ fs/xfs/libxfs/xfs_sb.c | 3 ++- fs/xfs/xfs_rtalloc.c | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h index 6becdc7a48ed..4e49aadf0955 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.h +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -73,6 +73,18 @@ int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); +/* Do we support an rt volume having this number of rtextents? */ +static inline bool +xfs_validate_rtextents( + xfs_rtbxlen_t rtextents) +{ + /* No runt rt volumes */ + if (rtextents == 0) + return false; + + return true; +} + #else /* CONFIG_XFS_RT */ # define xfs_rtfree_extent(t,b,l) (-ENOSYS) # define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS) @@ -81,6 +93,7 @@ uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); # define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS) # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS) # define xfs_compute_rextslog(rtx) (0) +# define xfs_validate_rtextents(rtx) (false) #endif /* CONFIG_XFS_RT */ #endif /* __XFS_RTBITMAP_H__ */ diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 25eec54f9bb2..acba0694abf4 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -509,7 +509,8 @@ xfs_validate_sb_common( rbmblocks = howmany_64(sbp->sb_rextents, NBBY * sbp->sb_blocksize); - if (sbp->sb_rextents != rexts || + if (!xfs_validate_rtextents(rexts) || + sbp->sb_rextents != rexts || sbp->sb_rextslog != xfs_compute_rextslog(rexts) || sbp->sb_rbmblocks != rbmblocks) { xfs_notice(mp, diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 5fbe5e33c425..e5d6031d47bb 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -998,6 +998,8 @@ xfs_growfs_rt( */ nrextents = nrblocks; do_div(nrextents, in->extsize); + if (!xfs_validate_rtextents(nrextents)) + return -EINVAL; nrbmblocks = howmany_64(nrextents, NBBY * sbp->sb_blocksize); nrextslog = xfs_compute_rextslog(nrextents); nrsumlevels = nrextslog + 1; From patchwork Wed Mar 27 00:12:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605369 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 A4A5E134BC; Wed, 27 Mar 2024 00:13:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498391; cv=fail; b=dqLsV0GdHKaz9R606hw4OxnwnF+oDIxP4cd+/aozwQnfzUgI4acnB266ycW+173nNR6Y8ZFrRfa/g9qKErex85aMXPwpD1s9dXX6QeQ3J/KGMuyA5uTKmFUpTLBR7HCG3nD3C20Yi1bBni8O7JKax7dsWpKG+JKDb19W9Q8PtL8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498391; c=relaxed/simple; bh=X4k2P3lm3XL2Yf95xt1yA8uWUajrIW3XiZg7fLnbt0g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=u4jOjiAEGspblmD17XWJgPlTGgRdVRTpAXfJE/7iLHpSzEq+qIbQjw1Mc3stofRIxkJAog9520VLvWjOaguSRQdnNjxxBgZTpRwCrJphi1eys32G5hh4JTc1bJXu9vS4WZiby8tzy1u+2lMwIH58Ul9mQAvXVHWFutxqOPwO4RU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=fsuwpiF9; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=HCZR325G; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="fsuwpiF9"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="HCZR325G" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLkgbr021513; Wed, 27 Mar 2024 00:13:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=Hp4XfHXjuaFPH2SVMc06n+relXQUy17reKlpu3oGGC8=; b=fsuwpiF9q8Mn51CocIzftqkI/kuo+sEEgE3EGhed+x7+4ygWkMMvBK8/5H6TdfMmNBl4 3iGu/p/j4l68oH8Yc17TscURObDTBmTUXnWaF3zl9EJR0mVVswu+60F/NiGgEiu8ILEi BdI4vqNBjkbkdQtRvLHKhMNnh/sS7wEW5xoGn/IFFN21l9NHToQQYOHueKejxEuBhWMX hDdydoeA/n8munc7SJcUv0sYi9JjGfyioILV5L31wgJNp/MpvNVu3GhNvPb2N/cIoOT7 k5UbBq2dCIO6m19u9DPi3potK75xK93yZzhCLBbGcwmYUZF3JY6Cjj7YMguzbRyVwQ9Y TQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1np2ecbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:08 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R03jNe012586; Wed, 27 Mar 2024 00:13:07 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1rdn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WCA8BfHCaYUXrrV2ODa323CZcSVLGsuAhqRClkdRgYuUnaiI1zsImX4Wx6ksPykVhI+qjxDNy0R1pF2kbONFqsTfadRopYhrPeF0lfgPJPwD5Z49xTpnkMfsLhNP76Lpt1eLKciglTDR07ES5TosdXUz+/W8pdJe79fHldWCFpX7lBkoP5mis9z9Vk0BJg8A37hqHjAI7nemk+HY+Y3QnFXhVohTE2BrpVSfYqnMtPKcIe/VFxCwcvPo2kMHl4M+FsTjCch4417P4Wqv27uKTTWTVbUaBhDPfh1yCG998qWRSPRYrKZWt/z+SLRwx8WX4v9nxChnSGKVvccGphcOtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Hp4XfHXjuaFPH2SVMc06n+relXQUy17reKlpu3oGGC8=; b=MtrHvNYnfVNkIjFzYvpDxXOqU+zQte0QwScoVtL6Hwrd3L7OkcapWU3fTcPg4YySxI+yJeob8ZDDq8zbwY7I85lJ0U8IsD6pp9V2MZgK+cCMPUfj6S1YGmdPbGRDC4O8b4WWxJP/CiEuYJj0DhaOiUztzph03xfzbYLLGUMIuyWJ78VfIvqtGqfFD1SrsxKHRQZqcZ3p0XFjy+4X4Ch/RRqQZxu2QEuZGZ3AKzukj7D6ILbtGvwws02HAx5vkfFy8Jj8JvPZZ2QbWGis1V1yO4+aBHYDk76XpxiuLuC0cKIQw8jT+rbPXm1FhOj+2HJVUFXDUWMam19DeeaC0IuOtA== 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=Hp4XfHXjuaFPH2SVMc06n+relXQUy17reKlpu3oGGC8=; b=HCZR325G2+AXNE3tTOcJy8Cn6UBx5ggDF+cYTkCln2q3ED5ILm8WtfVVgySJ/oTHON94r5Z/BHOnkd9Ge6L6qpqsXlV48VzHigyKGFfZCYWzi/emiQ3Wr/vPtPjM0+W8Iw0XoK9ZsGRf+d7tLcvJtXeWfao3NJt6MwmHzt2NVr4= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:05 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:05 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 11/24] xfs: make xchk_iget safer in the presence of corrupt inode btrees Date: Tue, 26 Mar 2024 17:12:20 -0700 Message-Id: <20240327001233.51675-12-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0027.namprd13.prod.outlook.com (2603:10b6:a03:180::40) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x73OzcPuBOZcb3vA5Mhpl9E5NDQ98A86BsEYDrX9/z64GLTa/uZlxtjT6CZxYbD1935cLW40YDL8JuxWZ9ll0hpSfSAwwzih2aQ200Z+/51lYy5gFCtRThSLYe7udaXiqLEQbDAT+krHkFOryBexc/lSYE2SciwQ5WVGM6Ukkcd+HgC4gXHeJtFtZc5ldQKcIq99dQ68w7+kQgbTdI8xTzdHSzuoKZLuhYCIORyGofrw44jGIVVn+CNsD9OG0XtZ36bafWm6rpj9vT+cWy3HI+5a/lm2u65mHKWCwy87ofIE65vVnd+XFwvwrXiV1OIe7PmWmtDi54aY/yt+pMC/gDHjct/Zsty9ByLwbRSSYM8IVzBgdGsaVbAPCU2uzu7ELLL3Wj09VHMROtHRkr202GWmdIdX3giR7eU0Ws0U1jKkrTvAP/bCZvBuszMOFQwhRNnOcbfjG7Xrw58TPBQmlRSkMHA0cE5Zr0HqV776ewDpgBAEkbXpYP34VupjyED4es0yOX9RLGDx8OC0BwlxlyxYjVs347V+Z/n7oqOINpiFP1QwmwCexHE16nRlnJkR6ixTKVBbBGeUSEdzniEcisC22wiJ7V6RV1ruutWztqR1ofGcZQ5kTHIusTBG7cX+odt7IjX91aGzHUKfawFycJ8tDxtG3N3p2cKXRxgA7io= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam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9pUGXPbSHYi4qiKa3x2HFqLt+yA9s8vTEMJ1O5ZN2k0pRBTJJHF7hGQN/k559E2gPQ3ng120JKGuYQ8L4qYrQpnjHWM+srQ+OWCzFCRwaOX0OFCYhDtXiVJPAfmWmOrHB/wGNncYHebmZMAPkZsUk6HQE2+0THeMfH3Ck+cEaNeSwPTzLk+gg5+GOH+I6bdL23ZwyfQ+is4DadRMb9d2dZ/vTznA+VCzzV+2un8wJT/vaGwhQOWDb86J5aKCY17Z3QHqzVR9gt47PHhCuxj4/E3kYA4yB5PLFucn6oA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c58a381e-d100-4894-ee57-08dc4df2acb5 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:05.6126 (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: JneTGRq4bh6gRvZeZu7aV75k9UCm+eXfC33GMBPMtClEn+ay0gwGAsTgOnsFPKmPtmAwpLQVZjsM5nOAC8rZseDPAf3zmisdlawMLzs0aoo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: DGptdXMuSUhOSdN8jL7SpgQ27dk9J3Y8 X-Proofpoint-ORIG-GUID: DGptdXMuSUhOSdN8jL7SpgQ27dk9J3Y8 From: "Darrick J. Wong" commit 3f113c2739b1b068854c7ffed635c2bd790d1492 upstream. When scrub is trying to iget an inode, ensure that it won't end up deadlocked on a cycle in the inode btree by using an empty transaction to store all the buffers. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/scrub/common.c | 6 ++++-- fs/xfs/scrub/common.h | 25 +++++++++++++++++++++++++ fs/xfs/scrub/inode.c | 4 ++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index de24532fe083..23944fcc1a6c 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -733,6 +733,8 @@ xchk_iget( xfs_ino_t inum, struct xfs_inode **ipp) { + ASSERT(sc->tp != NULL); + return xfs_iget(sc->mp, sc->tp, inum, XFS_IGET_UNTRUSTED, 0, ipp); } @@ -882,8 +884,8 @@ xchk_iget_for_scrubbing( if (!xfs_verify_ino(sc->mp, sc->sm->sm_ino)) return -ENOENT; - /* Try a regular untrusted iget. */ - error = xchk_iget(sc, sc->sm->sm_ino, &ip); + /* Try a safe untrusted iget. */ + error = xchk_iget_safe(sc, sc->sm->sm_ino, &ip); if (!error) return xchk_install_handle_inode(sc, ip); if (error == -ENOENT) diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h index cabdc0e16838..c83cf9e5b55f 100644 --- a/fs/xfs/scrub/common.h +++ b/fs/xfs/scrub/common.h @@ -151,12 +151,37 @@ void xchk_iunlock(struct xfs_scrub *sc, unsigned int ilock_flags); void xchk_buffer_recheck(struct xfs_scrub *sc, struct xfs_buf *bp); +/* + * Grab the inode at @inum. The caller must have created a scrub transaction + * so that we can confirm the inumber by walking the inobt and not deadlock on + * a loop in the inobt. + */ int xchk_iget(struct xfs_scrub *sc, xfs_ino_t inum, struct xfs_inode **ipp); int xchk_iget_agi(struct xfs_scrub *sc, xfs_ino_t inum, struct xfs_buf **agi_bpp, struct xfs_inode **ipp); void xchk_irele(struct xfs_scrub *sc, struct xfs_inode *ip); int xchk_install_handle_inode(struct xfs_scrub *sc, struct xfs_inode *ip); +/* + * Safe version of (untrusted) xchk_iget that uses an empty transaction to + * avoid deadlocking on loops in the inobt. This should only be used in a + * scrub or repair setup routine, and only prior to grabbing a transaction. + */ +static inline int +xchk_iget_safe(struct xfs_scrub *sc, xfs_ino_t inum, struct xfs_inode **ipp) +{ + int error; + + ASSERT(sc->tp == NULL); + + error = xchk_trans_alloc(sc, 0); + if (error) + return error; + error = xchk_iget(sc, inum, ipp); + xchk_trans_cancel(sc); + return error; +} + /* * Don't bother cross-referencing if we already found corruption or cross * referencing discrepancies. diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c index 59d7912fb75f..74b1ebb40a4c 100644 --- a/fs/xfs/scrub/inode.c +++ b/fs/xfs/scrub/inode.c @@ -94,8 +94,8 @@ xchk_setup_inode( if (!xfs_verify_ino(sc->mp, sc->sm->sm_ino)) return -ENOENT; - /* Try a regular untrusted iget. */ - error = xchk_iget(sc, sc->sm->sm_ino, &ip); + /* Try a safe untrusted iget. */ + error = xchk_iget_safe(sc, sc->sm->sm_ino, &ip); if (!error) return xchk_install_handle_iscrub(sc, ip); if (error == -ENOENT) From patchwork Wed Mar 27 00:12:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605370 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 6A3314A23; Wed, 27 Mar 2024 00:13:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498392; cv=fail; b=IGEbm7SIAhzrh8lIt10AKiv8KUWhlHDlcVlQ1FOUqS6suUT1WxXhVRo2jx/WBorCUkwVeOm3WbgVYVZC556kCo2BedqvmYfTt/0XXJcxf0FzHxI0gv6lZjrJ3LK8/VoBih1Jyr2KYCk3VrqbTkfkN848/qv96488wDCk/UsYGiA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498392; c=relaxed/simple; bh=GTc+b7VOv4+RgvKzsNW7nPd0pAXFGqxOr5T13OKO0P0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=nkzu49OQSQh05+I5Bj3jnUw6WeOl08uL9XG6k4rFd62wkqiMKCXH07COjR2YKDGSN89dwk4+uHX6E/mfpRpsH4hraRd8X6MZMWU+uAwqOv3+RZnRyyIx0CK33TEDtkGlNGy55Mn/UDZ2ZOEnpsPmzmUoWqoQyYcah88tnyNUKBQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=STYbggQb; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=deEuOTp8; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="STYbggQb"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="deEuOTp8" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLibh4032020; Wed, 27 Mar 2024 00:13:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=QT+DNcF/Ar6G2NSETgU7/hd1dVpmP2nLLa1WtoSTQR0=; b=STYbggQbnNasLhr4mahY1V6yvjPj7Vo5mhnBwkukNjM1qCfLXYkWIF24Y5Uoqz6X5dOp onrbvlBsirPTGx6Ap4fJiLeshCNkOTLwzv3RAsjs26v1z2rbNll/dQ3HOZkRYEJnllA7 MvkIB0EbYAxq76+ET4xya719Nd1zIuOdRzDcDbI1cXsbH2V8/YL+sx0xQFFwnVL4yKVB ILxCcBjH7wu0M0vdPlejTj0deqKnbT0EgghjmCVAiNbH6K5GKkEKFsV1c1JVuFIxEsVi EZmYtwdtDetlapa+b1VWBlsJ4XzYQYsLjSeHpN8mKAUWVk1iIV/ceb6LMepp5sUNY/RA 7w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x28ct5n2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:10 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R00j6Y012418; Wed, 27 Mar 2024 00:13:09 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1ref-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iwz8zHEW7kpanFTG5VCYrkEg6x0FS9yowj9fQRrtp41PK/KwUI4zAZKIhZ+9GulqHGDt5OJ2TofapZEVzoqI1ospwdg5qfrZDSJtIZZOYxFVM1feZwBt/BVLeJlSBPNiJnKjh08i/XoGRYLwWmgLO1IIzjo4O1AyzYRfQXc3bQJXa4M1jmDbiP48TshsyLH3MK2WGO5qyS+5pr36RgODf5WlzWht1aFlyxLki0Y2u2/RaJIm81qwuuF1bY4N431z8peS/SMfa8J8csyDM/ajVmfr6uSf54U5pyau5AQE1ZXifE2RYunZsQZiNZJXe6GCL5+oRnejd19SXfLAQqaEFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=QT+DNcF/Ar6G2NSETgU7/hd1dVpmP2nLLa1WtoSTQR0=; b=OzDqy9o6yjHs0L6dWcGPDc/onIZCJUN/9w0IFuJ2cBMjiQMJf6w+esLV+CXUu4ka+uA2kezM4L6pYdQdVrcfqNdd6pihKdhrwJ1PAvRwM3wxIYVmqWLe+XzloDifrHqpJdQJbC5UEONM/WjLaVa61TsCm9dKDpMj6xW2btSkYZCtSK+lX9AqdxxluKpQhwiKAR1AtnMMGC/Pt5+LmCzgD9d+R37tC933XT/g1OHoBkHykdYAhMJjZ4Vpm9a3kElCBz5E/CB32qAm9a9uW7oSJdKuPEO6Y9DEbwK6IPA83sZZJx8fL/Ykqeb9ZChvco9TN1YPr+k1l8kyhKLsiLTvTQ== 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=QT+DNcF/Ar6G2NSETgU7/hd1dVpmP2nLLa1WtoSTQR0=; b=deEuOTp8+Skx8CLllffaXNkcEiKIWTxE1XBRG5Co5j/nx0uYkvY2BEYzM8tfBlisYcnpAiTm/aT259ersLOKMPVeSgan/OS1DTKHOSqnUlLntqjN9PnBgslmnWQj73pUn0t16xO9qmfmOTfZqaZiYIIe2w38FL1bkCKaQnO/qSw= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:07 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:07 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 12/24] xfs: remove unused fields from struct xbtree_ifakeroot Date: Tue, 26 Mar 2024 17:12:21 -0700 Message-Id: <20240327001233.51675-13-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0028.namprd13.prod.outlook.com (2603:10b6:a03:180::41) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lYnWHFYOSOUfvSVnxrFNoi8+VYxTZ5jnvfv4HdxOZ4UkABpfFUdQbjvCcVfPM4evAJQ/hbPbrf5zKWyZU28+MPL9k5fHheiRsWmEAXiYmkTGqbDa5E4w68udK1Ek3IlJPkBILySzD3JbuBn6Frsw5rXINopkbGHlNOeVtYH4sylvmhRyXIuBQ9GAP0/JdWAC/QKJ0WsYvnH1o5QOvN2KjOIinb1L/CNWiIom3GQh/YGn7W1yzVQPdhv7BPgkJQuMPNZs2WkG41SfuoEswRYRPheTqDef+2aLgTJDTb0SZ6mpjGVrQTEvcjnedGsY38PJhWGfB2cpFCsBh6WrKPXgIv9qTMKP2887jASaaQ5kfolwPnl9N1S2QZ9vSkntqWE84Q9mP6pZwk+7CbNfIKxlItZGmbJo6vSRehAiNIIXM5XBaX1LYKCZe58kCIuUnlHp3NpIlyAea90+Xa7cJUmITQsjW3IBH1vKMyWld9NH5rSNM+/i4lHGGR7aWjA9kPdJf0odc59esIXItrMnYxVh2oK5NV9pigBivZSknK6XQyjoZbtHm3wYb217H/r77nhnypk+bF3Jk0PAYLxuwc8mGZL7IxzcpygaSrX8Yrd1GNuBT4ZU5aHcHyGCvBPHIbUCOFMA/A3xCr9upJxSZBTGaJbCmpIVsa1SuO+hwsff738= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-M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5DnGfa8L6XEJ3bZmiBxUqBoELS+hQY/hFs/DcqllTUfYEIfDHb3GuXZHdL7jqmtGKds8EBKfOI43ZetW9ZIx3zx26qeq6y8YRuF7hLCAMg/D08L2O2t8gJoAfjiwwyx/qAjzGcgu2mUoUVHb08eOXDodnFJWG3Kn1FOs9ev+vx1+Bpqu/wC6ZenqYgPB/Da9U5xAjhzi+n7NNzC3nS0sBO0hbe3afO1IL9I0S+NpdHHk2jO3R2ElaMiylJixp+7lVW1fVEVG/iG6yxsZBki79vHYo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 748d331b-3fe7-49e3-ad96-08dc4df2ae0e X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:07.8626 (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: mCSFSsbPpBmJc0x4wPnmbeG14lGQwiGs94gbu7KErly0ZSisH9oOsy8sKIKUVN+aOqrHp/mvfsrG+9GCa30KzMV+ZYhYvOwW3uehxy71eV8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: gWMJYAtIu3SX8rp0xExxXlKEaqfCnQMt X-Proofpoint-ORIG-GUID: gWMJYAtIu3SX8rp0xExxXlKEaqfCnQMt From: "Darrick J. Wong" commit 4c8ecd1cfdd01fb727121035014d9f654a30bdf2 upstream. Remove these unused fields since nobody uses them. They should have been removed years ago in a different cleanup series from Christoph Hellwig. Fixes: daf83964a3681 ("xfs: move the per-fork nextents fields into struct xfs_ifork") Fixes: f7e67b20ecbbc ("xfs: move the fork format fields into struct xfs_ifork") Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_btree_staging.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/xfs/libxfs/xfs_btree_staging.h b/fs/xfs/libxfs/xfs_btree_staging.h index f0d2976050ae..5f638f711246 100644 --- a/fs/xfs/libxfs/xfs_btree_staging.h +++ b/fs/xfs/libxfs/xfs_btree_staging.h @@ -37,12 +37,6 @@ struct xbtree_ifakeroot { /* Number of bytes available for this fork in the inode. */ unsigned int if_fork_size; - - /* Fork format. */ - unsigned int if_format; - - /* Number of records. */ - unsigned int if_extents; }; /* Cursor interactions with fake roots for inode-rooted btrees. */ From patchwork Wed Mar 27 00:12:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605371 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 2FA5415E9B; Wed, 27 Mar 2024 00:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498394; cv=fail; b=fSxIqIqFYPK4MakPAFpYTRLpzXYYHd3Uom1fl2ckhF1PQOzpGVUYRi52oN9nHzYuXa5Zbv+/IvTwgIkgYmrM7ErOHDCrtLANigS8VYxA/c4WPXiImA5flCwcVrWaX8nkuQI/DvHDp9xC0ZPQ6FeDlfIPtXCqX41Uhy0+X+BHBdM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498394; c=relaxed/simple; bh=oGhuoMep5aUfdRAKP+b/XkFZaj8YFVR6Vf2PTH8Wi00=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SBuOklqPc9mMZC1+6V3rTDm7SlsiaNQKgWLElIZu2qa/mzvUTzIpCrr9+xC70/gfi6s2opewH+secaDOP2Ar8d5G9MXIIeoe4LMJChzFDHJRiSIR9bh3hx08Xo/NgbORMHSTLaBDwUvgkzJXURpkF+yr0hrAGd6BgXUxzIYp3XQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=ltLivQis; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Zdr27Nnc; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="ltLivQis"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Zdr27Nnc" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLkgbs021513; Wed, 27 Mar 2024 00:13:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=vqi9SAHOyEwUrtGeoHzO75yh4+qyeNGLpEPP0LmIp3M=; b=ltLivQisylgLFEmZHVcYjzPP9EMMKVrRPE5rpfjL4rxJJkp+zCXYYBctUne+ZlVC6/QD IBondcV0vUjMySdxlH791cW/XMzN78hg6QuFGrVtThEKJK+4GX/MifPuPTe2zjbUTft5 LCVKoc7U4paibM8ldCtOPay3RihtJu4qOhQCUj/PEftNxHqEHN0heFEhqPsdl/zPFf54 GpWpdyUk2ViARBlgHNYq8symosdqsziIOJJ5QkfrUXvSc/nbCetZdJKpVo9bWOAmqB6U Cdobd5xpgt0auyHeTUoEW0SEcwDVYZKhfTkkm3otrR2DQ014an5UCYS87+l/WbN6sJxM cQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1np2ecbx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:12 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R010AK020682; Wed, 27 Mar 2024 00:13:11 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1agv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJfSnLvszhyhkzWb6warw+p4gXIvbdIREz8si4PK6hZjgNo6TKngBQs7VQWnV/1NUXph4pUo04Ambl2CXedXo1a6iYnvpbsHSuxZfU3Z8U6onGzLlcdGhEY9IOM1Z4w8+ifOmKv1l4QSLwSYps1PztwAJx0Xltsl6bSETRHTj5+IxN8mtmR3oxG09pNAHPyKrMqDAyy2kMRJ1l0amdOPR9gIzteSWGAbF0tY5R5gc+ogyrM0fL03Wrxb1V4quMMaieHpJNmmFV7HQ0/t6yotUrmOfn+y4MwPYepNsIeqPYgJi+a5Nn6u7vzK47Sf3IeoKsmjN+NVGzK27yXJUHHMXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=vqi9SAHOyEwUrtGeoHzO75yh4+qyeNGLpEPP0LmIp3M=; b=l/ec8eT0EGx0Qi0Wst/FtH1dr0O38nd+YtAv08gpuXsWlyZ5GbbGZXaymd/PW7wqjweLYM3IYE33GcAey33Pbvh8p2GXTXOOyLAeY/DQV/kWxcwGZEKz6DfUztjzSsTt7zrtHW6BnzQdPnIn+J3wAm3/TGkBGBh8xykj3CsTgL5wW8SMld85AvoYwUhDvETQUooiTo7pxAuhRQubCCj4I/rsuME2mWvdue8lR/+HHqiLrqQPyvEM6R26p/AYcYCPe92ZutVYNKpfGEp9jqNl8xdv3xRJy7rY7eeqn7zTSQ4gZ/VkhKYRwnm0HmvBgZYJMN561735sBTjQh2jnZI3rQ== 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=vqi9SAHOyEwUrtGeoHzO75yh4+qyeNGLpEPP0LmIp3M=; b=Zdr27Nnc1HOFHwve8riHJ9hZjikAI3IpKu8z2PWSUtW1B78W+coOrapnuvQiflmB45j1JSnBMXNYVbibnhpgJBxuMZt8lEg0zrtrng8eTOfjxLyHcMvuYBvUP1EGaLbRxnHeidYMmmGOgmrdgapcr+OI9P8zYYfQqsazXCcWh3o= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:09 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:09 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 13/24] xfs: recompute growfsrtfree transaction reservation while growing rt volume Date: Tue, 26 Mar 2024 17:12:22 -0700 Message-Id: <20240327001233.51675-14-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0005.namprd13.prod.outlook.com (2603:10b6:a03:180::18) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ej70H+mNBDEsBsqEveDmScew8MZPDoO9tX/X0Hc+mwZ0V2dOCW6L0EjZb0vB4BSMUuiKDngts36ulHG/fyJ3gGak8J2Q/8GTb3ioqa415zk7+RICGXREqbf4WQrsjGsvW2B9Qsfo9YwxkCT6/z8au33lr63IIa7jhUJG8BtMhoBqU1SLDmSwLL7Pu426059+ar6zQyEy1TipC6fQ8EEa1LSvJqi9FtAvEY8qj/G9yVvUwgo6rDG7WEmUPeGLEZ29uPWVndu0jWMq8I1prfojkyU+lSKVvaE6t80cy/O1xdkZ2Bke40h3GRqpMWmsuy4+g8B+T4t2j5tOS58PD6LfuP1LpcNO3HehY94XC19w6eVtwLSeJvvNVsbUvIJypSr9fcK4lVpe+8kOyUSYF4Zw/+PoRwhuQ0gMHu1qTF0OokJ6F3X+CDw5oo+8UC4KP5vJ2aOLVVrKj3RGAN1Uo8dzuwH0/bM/sp+HYsp5glnErkUY/z8nVHFE3cm6O05FV/wHbaUbmzo3WBHKRHLZzrGJkypCXADBWNPkbR0XnmcPSBIH580YZnDX6mf3ZITXUj/WC9XmPvfeiNQk61HNmyuSekvFIoFqZCuK4awMk5+yrqzpXooNuNYruRELyvlsWqsJjfu9cCMR+T4iVxVbxh5+mEQLQWGiK+4Xe3vZnPEWEVc= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7AajrLDOnNMw8YTHBT3iPqHBrolN8G9X4jJfaqF+WIlspPCnDEyVXR5yBpu4h5nkYwtXWfuCJ54aVJTQrmt13RqdnEdtYh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+fAstRKsz2rNX53M+DTyMWXdz4apu7DAASyStw5/O/DZZPQh5z/eWGbVnwqlorzrTAtWTgTd0bhF2F2lsOP6YfYICVahYzgREa51+G/irV0SK/x2NwtOIzY+L3zvD/tBpOf3FD7lk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4292157c-5928-4b97-8c5d-08dc4df2af30 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:09.8231 (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: pJ9XpKRFS4IywhuPvhtQVdn2ojIsJuMfpLHJPO4OH4U5MyG25Gd50Vfuz3VPuEVz90aRJjQfaOCtUBcny8g3JIuObIy/se/5S96R2dTB9Ec= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: 18TMvx-D-O11vBVkPR-BtX7_ljeWyunI X-Proofpoint-ORIG-GUID: 18TMvx-D-O11vBVkPR-BtX7_ljeWyunI From: "Darrick J. Wong" commit 578bd4ce7100ae34f98c6b0147fe75cfa0dadbac upstream. While playing with growfs to create a 20TB realtime section on a filesystem that didn't previously have an rt section, I noticed that growfs would occasionally shut down the log due to a transaction reservation overflow. xfs_calc_growrtfree_reservation uses the current size of the realtime summary file (m_rsumsize) to compute the transaction reservation for a growrtfree transaction. The reservations are computed at mount time, which means that m_rsumsize is zero when growfs starts "freeing" the new realtime extents into the rt volume. As a result, the transaction is undersized and fails. Fix this by recomputing the transaction reservations every time we change m_rsumsize. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/xfs_rtalloc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index e5d6031d47bb..4bec890d93d2 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -1070,6 +1070,9 @@ xfs_growfs_rt( nsbp->sb_rbmblocks; nrsumblocks = XFS_B_TO_FSB(mp, nrsumsize); nmp->m_rsumsize = nrsumsize = XFS_FSB_TO_B(mp, nrsumblocks); + /* recompute growfsrt reservation from new rsumsize */ + xfs_trans_resv_calc(nmp, &nmp->m_resv); + /* * Start a transaction, get the log reservation. */ @@ -1153,6 +1156,8 @@ xfs_growfs_rt( */ mp->m_rsumlevels = nrsumlevels; mp->m_rsumsize = nrsumsize; + /* recompute growfsrt reservation from new rsumsize */ + xfs_trans_resv_calc(mp, &mp->m_resv); error = xfs_trans_commit(tp); if (error) From patchwork Wed Mar 27 00:12:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605372 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 43961FBF6; Wed, 27 Mar 2024 00:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498397; cv=fail; b=vE2i9pyvw0X0ejpHCkTn9AeMPXAxNik3KmHzYxIeZcSylWA3Ji6vpA/G+B6dgUIAogZYQ9MV7hKXEavz9SfuTDIrYJ7FuIOJNPmexA/eTYURpuf+TJIN92Z4O+gZfHYR+I9NZMJkyJbR44geEGFrQ+HMxXuhMzSYelRZdjJrAiU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498397; c=relaxed/simple; bh=Ellp+o3JOvLg3R4yqywS4n6oGThhoe/pGJ0OKs70SaA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OYv5FRLpP2PqKT6Gbyvs8mITW26dTGWc5VVEA//gz3k6WyaXe2Lq/3GtvgpIdWRVXnJ8cmxoaGoV1aZOdaH2FZWrQ37Cnv6+8mPbXR9J5jrzaZCw0nnvgO6+h57SQ+IXxyIGAfJ4u+4zKNLRD/bk87co5jGLkVFWjcsi2ps4ruA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=Yi/YYi1G; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=FpvEK1IC; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="Yi/YYi1G"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="FpvEK1IC" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QNnmdf008836; Wed, 27 Mar 2024 00:13:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=zxqqn4ZvmGvWg65yF7/F7PKhj0KlcSw8BUj9H1A0U4M=; b=Yi/YYi1G6tbe3r1XydgOmjzjNBvtv+8/N+HS6POEPv+oib00KcHc1C3o7DNuCnTjfsA/ lKcC0G75E0iNegvXJQsroZ8gv8e39PtjZ7/geGJ/qSITcLVtqf9UBluGiBVVCa3u3icX iLr6rWR3ptaJDf/CWah3SpCFaWpULj9ndQKprmt4zcYj7mReqbz/HJ+2V4ZlABTbvRMl DlZRgf74TcVtiFLtdBinP7XM/5nUwBbLco+oyVklgl2f3saNO1BW4DyrUA8Dxk/aWJLv z1W7RX8S4kE+5dvRdFhpAMB5HO7dORPSJ9+WHNvchnKLw4YpNpIyLy1NZXbcndwWEjws 5A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvsd1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:15 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R07Lra020687; Wed, 27 Mar 2024 00:13:13 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1ajq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzXNW6QkzDvatj608yeTstnq3uzty0X3mC7CqjjG2kJu8Ndcsmzu4xQXj+E3GkpoQxuY3Xy6Z+NXhczaoaAnqKHF50lFWlUKNuC9Elh6XwiH1SMw+1Nx3m6TjpR7tt2YO47+d1kxXxrrcAePCnm8jlztR7zA6UwxPwwATxejrSFsLarA3m0NMpMSxz5Sy9T8nOJzVEoP6eR/eM1E+woMZlf30v3NUpuGcVTtE8v1GFAJC43UYmMWSkePAXeeccX+5w6DU19GmN6fVlVz/NTVWOObwdR+8VaduqcTT/a6b7OPE8G7Qjdjx22gX+pDTe084fzjqlL0U7mg4mDJppiPhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=zxqqn4ZvmGvWg65yF7/F7PKhj0KlcSw8BUj9H1A0U4M=; b=BGCyotao4lS563v7hYSTBQYe+NmA9crwor+qt27sHB7JdBGO+7HDbG+Lpx62lAT06uKLst/XNfzf9qPTBcHmuXhFGewNov0tFVRv/X3C2OH6pnLymXf5N0e8RKZ4CA950Fa+JYbkobgz1RQImTzmUOsR2Nt2YLSr5RIdnKZHtLb3iPy6fZIc476l6boIAve5c1VV9MCf2cplG87QAsW1lwV46T/BxetDUwkFM/CPDEneb9jjdjXqtdkuJmSNtzEVON2pkdgeuiPYd9HqASH9XPpYtfNOF55kyTVTF3xh7kSR7Kyj7tLMcOmygKSMS8MQNjJ+wHns4M6/1IOanWOAlw== 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=zxqqn4ZvmGvWg65yF7/F7PKhj0KlcSw8BUj9H1A0U4M=; b=FpvEK1ICOT5Dam0/9f745iLniFK7MAocdBZjyXNLXspBg5yR9k3zmgiUk0BkGd1iKvnBDwXGE+sqphsZiuXsRZTml4O57VNoVeL9nPJkz5FTWWcv78QM+E1slBmIGLo7gs3m1H9G2g8GuxCktkZmljucQRwv0xuTozxMym2MzqM= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:12 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:12 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 14/24] xfs: fix an off-by-one error in xreap_agextent_binval Date: Tue, 26 Mar 2024 17:12:23 -0700 Message-Id: <20240327001233.51675-15-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0029.namprd13.prod.outlook.com (2603:10b6:a03:180::42) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hywl3L9XjGktGnqGrGBmByWpCZ0ZWXcMSl4J986eDDPFZXcUo19GbAkHKR9deIC8btFVqgmJEsbPm8hhVVaTBwZuxVUnB3DuovEk9DFUZOqvaPI5B+BnFxqczji1MWST6AiFU+mzdXhlfSJ1JBbEr/zG1678uyD1cDzuYsP9enoKA4jfA3zZS2IA2q3wI3EadZri5/KpfsADrPzd3s854/sXT/bpvq6JuUJmGbLO5ANlwJRHhf6IivNiMSQlTeAioXZz/kt2NcKr+54QSz5So5jUhanSNRN1zc3mIH7VtyHX2MLiT0R5slZl7t419tvQTwHUf+5K3WlYSl3rubHAYVxcL6RMTUSjllr8dbHvqmAgZxsK2v0ANLBcsbWVL9nNmO2R+3sFzqpw//2HxzQEEfVWES1mwMFSubh1U9nLed8NuLQaGy9NwsJS5Eu5+PD503k5pjmKqUIQF2mZK0mGtigsytsX8rb9hsSVG0Ao6EoG3KVVHIzcNd7KzalV+27XkB1GNYFdPT6+6gwG21/diYQoRrr7TaY1CNorDeVWbcEu6JBXTYfsvpPXkuK+Jo+UrqvcMQbZnv1u8Yfg482F9uV8bBj/gmPdPbXrsii1QkUOK9pM/bBwtbCCth2Aux5BVZV7Sg8oPGsEOzvC+rNUDWh7QERD5FiZKdoS4YyKjus= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-M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raei0e2HdOnAXbt/kRW9gI5cia5LX18o372uwYw3fYuZ4yjbs+WBaQCHb8Vfj1spuYxh2cpgZ9WctSZZP/MBxF6afy5BAEOsGqN/4HbB5ETqJ9Bm2WZxjk8TYTXrJRj+qV4HRbr3ypaxMOQk5ALAGEQc7OcslKaYr6B8tX8pvQBX+6SP1VB6Z/fdSV5LdfSgvHmVKT+H94NXPIUjaWtwioyfqY/zG4Mk2TrJjqY6Y3W4au4wOLiKP/g82mkVbyHh4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ac2c94c-0d36-4279-7da1-08dc4df2b076 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:12.4978 (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: FfgUOQof+VM8c7ofI7Vq4wmIkfMRodw6JV/Asep0Cg1gvvYrBx6ZOabR1c/IePX7+xwCYjTHNwulGdMxZ6AgWn+5n4C58UZIsjmzL4ClZzk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: CO4CNwHpZoKHYsfKCOoRCCWUGD6CzM9r X-Proofpoint-ORIG-GUID: CO4CNwHpZoKHYsfKCOoRCCWUGD6CzM9r From: "Darrick J. Wong" commit c0e37f07d2bd3c1ee3fb5a650da7d8673557ed16 upstream. Overall, this function tries to find and invalidate all buffers for a given extent of space on the data device. The inner for loop in this function tries to find all xfs_bufs for a given daddr. The lengths of all possible cached buffers range from 1 fsblock to the largest needed to contain a 64k xattr value (~17fsb). The scan is capped to avoid looking at anything buffer going past the given extent. Unfortunately, the loop continuation test is wrong -- max_fsbs is the largest size we want to scan, not one past that. Put another way, this loop is actually 1-indexed, not 0-indexed. Therefore, the continuation test should use <=, not <. As a result, online repairs of btree blocks fails to stale any buffers for btrees that are being torn down, which causes later assertions in the buffer cache when another thread creates a different-sized buffer. This happens in xfs/709 when allocating an inode cluster buffer: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 3346128 at fs/xfs/xfs_message.c:104 assfail+0x3a/0x40 [xfs] CPU: 0 PID: 3346128 Comm: fsstress Not tainted 6.7.0-rc4-djwx #rc4 RIP: 0010:assfail+0x3a/0x40 [xfs] Call Trace: _xfs_buf_obj_cmp+0x4a/0x50 xfs_buf_get_map+0x191/0xba0 xfs_trans_get_buf_map+0x136/0x280 xfs_ialloc_inode_init+0x186/0x340 xfs_ialloc_ag_alloc+0x254/0x720 xfs_dialloc+0x21f/0x870 xfs_create_tmpfile+0x1a9/0x2f0 xfs_rename+0x369/0xfd0 xfs_vn_rename+0xfa/0x170 vfs_rename+0x5fb/0xc30 do_renameat2+0x52d/0x6e0 __x64_sys_renameat2+0x4b/0x60 do_syscall_64+0x3b/0xe0 entry_SYSCALL_64_after_hwframe+0x46/0x4e A later refactoring patch in the online repair series fixed this by accident, which is why I didn't notice this until I started testing only the patches that are likely to end up in 6.8. Fixes: 1c7ce115e521 ("xfs: reap large AG metadata extents when possible") Signed-off-by: "Darrick J. Wong" Reviewed-by: Dave Chinner Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/scrub/reap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/scrub/reap.c b/fs/xfs/scrub/reap.c index 86a62420e02c..822f5adf7f7c 100644 --- a/fs/xfs/scrub/reap.c +++ b/fs/xfs/scrub/reap.c @@ -247,7 +247,7 @@ xreap_agextent_binval( max_fsbs = min_t(xfs_agblock_t, agbno_next - bno, xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX)); - for (fsbcount = 1; fsbcount < max_fsbs; fsbcount++) { + for (fsbcount = 1; fsbcount <= max_fsbs; fsbcount++) { struct xfs_buf *bp = NULL; xfs_daddr_t daddr; int error; From patchwork Wed Mar 27 00:12:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605374 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 ABD7F7FF; Wed, 27 Mar 2024 00:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498406; cv=fail; b=Ckaykued3PPk1WQSLb7wr8jMm4/RTW4fOnO995MaKifuVa84HuE4Ez5/a0IedBzOx9b2XWLm0TVyyZ9exS9WM9CExdrVXJwB9hYCSwy3XNBrrrT9VSjMva+/a4uP4HcE5cBWPUJX/kB3ninnwE808XgS3/iqPx9CnZbw6ezfRzs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498406; c=relaxed/simple; bh=97YB/tKFbELBMJIlhJYUmAIMt/j8NViuaVizM7GGzTQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EcL2Pk4AxAx4nVOqGC3gUJy7UsP5v3VETBf6046p2bnw6u9IF6ktNVwca759X6eVLeVZRyqtLlVHXaGGZPMUK2J4m9Kf4T3PaYt6CwVkUR85kfL7OyFWKDfeVq3cqpG/AeIW0N+4ccE4edZV3TpYY6zH1jdfiPt/g2d981JxL9U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=a4ZXiD+H; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=DSQHrkws; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="a4ZXiD+H"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="DSQHrkws" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLjl1r019183; Wed, 27 Mar 2024 00:13:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=7r+X4fYp1b0oFbQB+2skYRg2iTmsBki/mmQiC6cQwaY=; b=a4ZXiD+HF9CkdL0XKWlYv36H+1GVMjKgAt3JHLAx+p0F+IqV3/6XrxA0zvBiq6fMWcjR EQt8EvNyrrDZA1wjzfgcx5x1YE9CfJI1ib17mzat6vm35vfAiEdfvjm/PurYcE1uSZmS il6daElsrRERoDcxCJx542tZ7rN92Hco5eZjZfrtBc35/1zH7jJcRKNtCb2NNQxuidp6 TW0EQfpFJH75JkYNee/izNRkLQIc2jfDcUuhohoAOiwmQhsNMO5OY9zXyVNifXPbIC2I RiVOBGsK3edE8NCaz2BQ2Uhwj2kcu6iE7oprR6L/KhzpEt41CP1SVlUknTmWF21F5np1 mg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1pybp8at-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:23 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05MAk020824; Wed, 27 Mar 2024 00:13:22 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1akw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aOLReXdjuncy+p9T7Y2JnGEB7akLoaAmgRZpKr6dzqCbJQmSSTPJqI3ndnXAcslvXNAEf9wE0xPWIwVFymRO1lq5++xoYYWr1rz0PHsS6i+faPcOfWcXE3LWt3kxmMlwHwGC5EqyPbgdFSO3ng857dPTmERc3gZGmOsqpRekBeZnchSaC/8lHYrocfuDIwcOCuQYRGDE4ivh1brOakN7h+S4L8jQqGxkcjsTVezmjx12KvPBLn8WdX+CTCKAMJVArTE4TjRuCJij1nnrcyGuBGVx+IrK3smGZqYhPidf/F9eQWRRL75xokD+0/cGSKXUdtDfrK79E5xUGF2rIyu0qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=7r+X4fYp1b0oFbQB+2skYRg2iTmsBki/mmQiC6cQwaY=; b=UdtLXgGL/UZeWbCMVgYb0p2FqjZB0WmBCN1F6iQyMwrJntbLsSVF6QvhKyZ9A3D0qj06bRfoO7kP8jhmh5jPEZ61rAP10C0fip+OIGdkaOt3XXc1bEyM1kQeHdUgdnllTwfW7Gn3gdWgvNDBbPGvvPBJNopg6o+52N0a50S8LHMsFbqG7isrWtcFIIa5dTHx4qzlQtni58jaxKqHTtfjkU3nDsdRzFNJ8fTbsYPXjxSM3JXyCgwXb3eRCuw94htugGBI4vf4feMjfL3pS5n0DxmPSTQIy8wDDqwJ90VTU5f9m54DbZSjggbTjaDD2JJfkoLsUdbdLpU5ZTqhSvu4sg== 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=7r+X4fYp1b0oFbQB+2skYRg2iTmsBki/mmQiC6cQwaY=; b=DSQHrkwsE2yC2NzVPQWtRQ9IBtN1vrUqxaX/Nj6aUvWdlKhlKrMgA0AkN1dzXKfNH5nbmON9l9Z8E6SVPlTLqON+E8sGNKWWVrgwjC8OSktYnc+Y2jsv5PSKsmBL3glK7pjKO6ME9BzCyDl/LrS4h15LG/XjgMKfYu2aNXJEBYs= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:14 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:14 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 15/24] xfs: force all buffers to be written during btree bulk load Date: Tue, 26 Mar 2024 17:12:24 -0700 Message-Id: <20240327001233.51675-16-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0029.namprd13.prod.outlook.com (2603:10b6:a03:180::42) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3xulnlQRU/DUG760Wd2yLUYZZrSQmJCaeaKuMDj4ruU3shkW7ehQU3heDdpZI4mOWSTA9BW9ZZTgbvPD7Uyi/fs0i9vxYzIoXhS0z2FRThud6cqWb04h/5ds3N/OCX0E0x0k3Fjzmd5vkB+Ye58Ks/1OldFq6kGD3v+j5fs9R+mVGoD+o9O8ohvZaQKPpehoa8IfdvteoqExMuVciMFc3p6KVNPEM+SeNwb9k2AC6Q989joYzfRTCZp99Jw77ci82bwkuAmjxmUvYtnLXm5APEe757BkSptUbwM0Z4Oi8ugbJUMuAxKaotQ7eyaXJKLfn2LQYwMFJAQh2CveTO2cev+tPY7iudQMp+yGznBAdY7jwf3ErsUzOKqRJy66W6MLuGZVp7ksx7K72vB4Wbnptbt3vXEXjPqAFnXi845VHbNNA5xbcHKDaaXHM2yJcN+gZwmkxLNQViNjxz6QUQ60VMjS3SxSlhjNJfnSpmHMF8je4c3+JXPnxCkWMBy56MRiDPx05dbYxOGPA1YRGrou+/3NaGR4w62NUZ/943Vk+8610uKXD/GDvBcgdD122eOC8BsRXBpByllGBL3GhEBb2gofTnrdiF8bfo7vLwAIf4zQBfFjIXwFpo0vnMNS7EjYeKz3eKzT97abNqzlHMNl24WgCj/qQwOsB4a45lWmB3A= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9Vv5BZe889pLBcY1MXmgTc6+tezkUOYXRYk3Rcanme/HmP3JX3mb8+GC7dCXt0RF6zRZN+y7SctLeEDx44QSelGCJuewDi/610lPd8WXpAE8wokBLlVih98qNodOE8Mp85DNKNuU1Pr2uhbMEPFxltc3W+bXb+W8gob4l5pEHXLUH3/6fQjmVt4lJ1YO40fJwofExOgDUeU9qRwJLI8iBdDUNEckQG9V25TX99Aj4jjr7f3vm9nQ6vDRKmNePS36Ubfimztm/Et4WZGwQl7o/bIUbX+n4H0xTYP4NQw1Mh1EGjDm5D1Z2VGoF2ywjtM5iKCIWaUp5Hotp5OVwDs20oiBSNEYKj/gfRsgQkuIUaMkGxqKkIwUoK0XtRO+/KdMh0/00/3VowRf1SdKo/wvq3Jd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JEPht8uUHxBFnP7BOMDagzhl2F10bwslcMKgOtp7wltvMQ1hV++17XtA4GxpipocqAKg/LiWiVniGOjrmwCbun5fPe1BYBeQVgTiw8JEpVQT5DRIQKnwP5n0sH73iN9Hi6J8Lb2118N6ns0hCvoqaTi3eDqf80FtdWIr/4qLm0aS8h5/zNYWJFGBWr8kjgxfm20O1NnzR0IQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2Z+AKcAZqPUU0aK9n1dzi3MA3CxjpOQXER5L+DQYNMsebCqRfS10dyBRFlpqer6flGWHDAedaxdmrKrAoK5Llblg/Bo5t6gjAHqwzsEhrYv8PVqbX1SYQBKGlbLFMA02WjjbvxMD+Aw749UVUENb73GQnUMUmz8e6d0tZNQmGUBjIZOWWHxFOV6XdUssuM/WchjJLDjqpGnkeudBc42ZyezZN+5xKOhTzJfhbFBOctVcSWiZHRzrkHRRv+7V9Rnk9Q5shnyibUZNpmGDvspCcdHaw88T5EyAJuzghYBi3L9LQ212hD6tN4PnN6RqSzPUob0yDjmep2erQb2VaNcaiiDXEcO8+HNZLQ6zj6x/iqpwE5zuvIIrk9P6U1gUi2kI/JGFrNo/14VitY9yjElBlEeXP4YqbSY3PITHg3M6T2CilnVZrjYZ0q+CmDsrShG0YhWXSfVkGHlI7aIw8tBolF2iaVpExvaOLYSrXtqKmfTEUulRDhtDi+E/b27O+PSI+C/MnYOjwb8P3gC3SxIigDXwO1ByTSixPG0A9ySklViFJUhRh5/9CjiProRQ1ZmrF4EsJ1wI7cT9dNVHHouUdoXMOxWVLPZjx38E+sZUZUM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5a086de-cf4c-40b6-49f0-08dc4df2b1ca X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:14.1939 (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: I5Ex48L4XvX/tMrnOE0IaNOXTpRbk/MdnXOGqoicc1g7wfVLMFaJsi4Np4TSjNa9wazxuJItv/2chxMg5xzzRThlV3Cl2XCWiU5wChUNQlQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: h5AI6QUesCbCQP1WMleP3HY4O9loWu4I X-Proofpoint-ORIG-GUID: h5AI6QUesCbCQP1WMleP3HY4O9loWu4I From: "Darrick J. Wong" commit 13ae04d8d45227c2ba51e188daf9fc13d08a1b12 upstream. While stress-testing online repair of btrees, I noticed periodic assertion failures from the buffer cache about buffers with incorrect DELWRI_Q state. Looking further, I observed this race between the AIL trying to write out a btree block and repair zapping a btree block after the fact: AIL: Repair0: pin buffer X delwri_queue: set DELWRI_Q add to delwri list stale buf X: clear DELWRI_Q does not clear b_list free space X commit delwri_submit # oops Worse yet, I discovered that running the same repair over and over in a tight loop can result in a second race that cause data integrity problems with the repair: AIL: Repair0: Repair1: pin buffer X delwri_queue: set DELWRI_Q add to delwri list stale buf X: clear DELWRI_Q does not clear b_list free space X commit find free space X get buffer rewrite buffer delwri_queue: set DELWRI_Q already on a list, do not add commit BAD: committed tree root before all blocks written delwri_submit # too late now I traced this to my own misunderstanding of how the delwri lists work, particularly with regards to the AIL's buffer list. If a buffer is logged and committed, the buffer can end up on that AIL buffer list. If btree repairs are run twice in rapid succession, it's possible that the first repair will invalidate the buffer and free it before the next time the AIL wakes up. Marking the buffer stale clears DELWRI_Q from the buffer state without removing the buffer from its delwri list. The buffer doesn't know which list it's on, so it cannot know which lock to take to protect the list for a removal. If the second repair allocates the same block, it will then recycle the buffer to start writing the new btree block. Meanwhile, if the AIL wakes up and walks the buffer list, it will ignore the buffer because it can't lock it, and go back to sleep. When the second repair calls delwri_queue to put the buffer on the list of buffers to write before committing the new btree, it will set DELWRI_Q again, but since the buffer hasn't been removed from the AIL's buffer list, it won't add it to the bulkload buffer's list. This is incorrect, because the bulkload caller relies on delwri_submit to ensure that all the buffers have been sent to disk /before/ committing the new btree root pointer. This ordering requirement is required for data consistency. Worse, the AIL won't clear DELWRI_Q from the buffer when it does finally drop it, so the next thread to walk through the btree will trip over a debug assertion on that flag. To fix this, create a new function that waits for the buffer to be removed from any other delwri lists before adding the buffer to the caller's delwri list. By waiting for the buffer to clear both the delwri list and any potential delwri wait list, we can be sure that repair will initiate writes of all buffers and report all write errors back to userspace instead of committing the new structure. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_btree_staging.c | 4 +-- fs/xfs/xfs_buf.c | 44 ++++++++++++++++++++++++++++--- fs/xfs/xfs_buf.h | 1 + 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/fs/xfs/libxfs/xfs_btree_staging.c b/fs/xfs/libxfs/xfs_btree_staging.c index dd75e208b543..29e3f8ccb185 100644 --- a/fs/xfs/libxfs/xfs_btree_staging.c +++ b/fs/xfs/libxfs/xfs_btree_staging.c @@ -342,9 +342,7 @@ xfs_btree_bload_drop_buf( if (*bpp == NULL) return; - if (!xfs_buf_delwri_queue(*bpp, buffers_list)) - ASSERT(0); - + xfs_buf_delwri_queue_here(*bpp, buffers_list); xfs_buf_relse(*bpp); *bpp = NULL; } diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index c1ece4a08ff4..20c1d146af1d 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -2049,6 +2049,14 @@ xfs_alloc_buftarg( return NULL; } +static inline void +xfs_buf_list_del( + struct xfs_buf *bp) +{ + list_del_init(&bp->b_list); + wake_up_var(&bp->b_list); +} + /* * Cancel a delayed write list. * @@ -2066,7 +2074,7 @@ xfs_buf_delwri_cancel( xfs_buf_lock(bp); bp->b_flags &= ~_XBF_DELWRI_Q; - list_del_init(&bp->b_list); + xfs_buf_list_del(bp); xfs_buf_relse(bp); } } @@ -2119,6 +2127,34 @@ xfs_buf_delwri_queue( return true; } +/* + * Queue a buffer to this delwri list as part of a data integrity operation. + * If the buffer is on any other delwri list, we'll wait for that to clear + * so that the caller can submit the buffer for IO and wait for the result. + * Callers must ensure the buffer is not already on the list. + */ +void +xfs_buf_delwri_queue_here( + struct xfs_buf *bp, + struct list_head *buffer_list) +{ + /* + * We need this buffer to end up on the /caller's/ delwri list, not any + * old list. This can happen if the buffer is marked stale (which + * clears DELWRI_Q) after the AIL queues the buffer to its list but + * before the AIL has a chance to submit the list. + */ + while (!list_empty(&bp->b_list)) { + xfs_buf_unlock(bp); + wait_var_event(&bp->b_list, list_empty(&bp->b_list)); + xfs_buf_lock(bp); + } + + ASSERT(!(bp->b_flags & _XBF_DELWRI_Q)); + + xfs_buf_delwri_queue(bp, buffer_list); +} + /* * Compare function is more complex than it needs to be because * the return value is only 32 bits and we are doing comparisons @@ -2181,7 +2217,7 @@ xfs_buf_delwri_submit_buffers( * reference and remove it from the list here. */ if (!(bp->b_flags & _XBF_DELWRI_Q)) { - list_del_init(&bp->b_list); + xfs_buf_list_del(bp); xfs_buf_relse(bp); continue; } @@ -2201,7 +2237,7 @@ xfs_buf_delwri_submit_buffers( list_move_tail(&bp->b_list, wait_list); } else { bp->b_flags |= XBF_ASYNC; - list_del_init(&bp->b_list); + xfs_buf_list_del(bp); } __xfs_buf_submit(bp, false); } @@ -2255,7 +2291,7 @@ xfs_buf_delwri_submit( while (!list_empty(&wait_list)) { bp = list_first_entry(&wait_list, struct xfs_buf, b_list); - list_del_init(&bp->b_list); + xfs_buf_list_del(bp); /* * Wait on the locked buffer, check for errors and unlock and diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index df8f47953bb4..5896b58c5f4d 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -318,6 +318,7 @@ extern void xfs_buf_stale(struct xfs_buf *bp); /* Delayed Write Buffer Routines */ extern void xfs_buf_delwri_cancel(struct list_head *); extern bool xfs_buf_delwri_queue(struct xfs_buf *, struct list_head *); +void xfs_buf_delwri_queue_here(struct xfs_buf *bp, struct list_head *bl); extern int xfs_buf_delwri_submit(struct list_head *); extern int xfs_buf_delwri_submit_nowait(struct list_head *); extern int xfs_buf_delwri_pushbuf(struct xfs_buf *, struct list_head *); From patchwork Wed Mar 27 00:12:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605373 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 CDBEB1C10; Wed, 27 Mar 2024 00:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498406; cv=fail; b=kikzElPcUlqCW7wYUNEFoF9sI8xrSlpVauXNQLk3kQQkX+IFie2w10AR+pDn4xCLBjtToagjryLu7Z2M0+tkzL4xDjdU6FzXHdri4pKU1dRkGHbe7f0X+g4QiworVFaUM5tq+HlNwA/xUsfEZ4+PFnvM95S53fqozabOpeYk420= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498406; c=relaxed/simple; bh=/lNuW6I9bQ66GCeG0AUVKivDJGsgnyNQqtROQdvIluw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=C/dKZlTkP7OnifOgRCC5/EYvkBVc89embupZeeLgDzZfydeNTlATt/hCF43xvDD1tVVYkLv55yQspEcXCN+J5Db7wRw6Er7iEwhIwIMoI8qnWdhCNnNVm4Bfj9d1PDWj9E4shg11CceICR0c+dY9gsXR4Vux1ceLvxqDj1Vv554= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=GbsKOIi5; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=tHaTbRbs; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="GbsKOIi5"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="tHaTbRbs" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLkgQA021526; Wed, 27 Mar 2024 00:13:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=ELuv0lHBGNL3nMP3uQqp9PUjqTrEl0sxsWB7xFqi58M=; b=GbsKOIi51CrYrEXb+oca3rdWRKmvSDEwHW2fzUbgMLnOOguhtEL9Bfmg82zWLSL/16bu hLKEy84yUjXg/+Dgu7JZtFvG4y9CsAZxLTzVAtE+30t8K8c0HuYUCLdtIzIU4RLzQSYI NYZ9XuAo6Ap/n/V6qi55w8ecQLWKHlNzTrMIFFZFu9f0bOow6Zr4AI+hYD5u0vNt7eIS PgrVCqUboaAfM+vMvikrCFBBb7wPo+tMXAS8HCOc1PwpTwDVaqJPtS93hSFYtxMHIBrg Xr6CM68EyoQqXtjqscwrshpMKh6sJ9aIBy6hKhQfa69opoFN2wupCARpX6VbHBdDc7uD yw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1np2ecc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:24 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05MAl020824; Wed, 27 Mar 2024 00:13:22 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1akw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GA1zmkxZa9ktxB4SjtbyLmi4gJc14KxcsYWNeatrWi0cwPxm6dtSTq5etXRYKbvethbu5iAJ2lPGCGaZC1JU5eSf5GgKAmq993kkUHNPRNbFYO+iOmCTtLFeCMdPoDToM8UHFiuA3Kgd/vtVpPxl0Hwx9ZsfPfSCaMsjwCTRyDwArhArqXgoQNkUMS5IgZNgV8VjUvRbWwNhe5EWeLg/s4qt4yiKhKwRyuGJ/T4/AcaIm/HnrD9HngmMxhFKehhqgUQNoA3fWhzWoYWqfSZF59TJybGeR0BwyQ7PuQe8zo4xjYI0bz2MGoh+wxf69Rq9orhQclc7WHol2HgWHPig9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ELuv0lHBGNL3nMP3uQqp9PUjqTrEl0sxsWB7xFqi58M=; b=f/4Ck5aiDN8xxgXRXh3VhlVi1HZxsxKS2NyLcWTzKuE8opmx2q/7UOGPD+crcoD1MW45PIAeTDiObmjOBgeJH/m0XHugzmHZQ8TeD7GF7TwUdtLTorlSK9STi0Rz8LDQyxud+UHQSFNzXYB8FG1dRcNG7twFTmh224dwu1SbOESug2tb22lZUfl5IoUUN5mG7cUVUnzzXh+XI/T+GMhl4A+yZ4Ld2sCttAYqW6gTVHmREy9U2FTzUqTU8lJWUvbNrXYherpKUrAyXFIiNloxYrCHmG2T3F7jENJ3FzgLaTsmX1UnV3/KYnH7HrSwKo0hstzCOS5rZeBBR0ZCT0f0Qg== 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=ELuv0lHBGNL3nMP3uQqp9PUjqTrEl0sxsWB7xFqi58M=; b=tHaTbRbsGmV9oOvSoqfM7WmZZIdYe7iey+yhL5XebjMl9tVw2wrSYhqyoFM+SEaMaWNmBvXbd4rt+7ai+hq7WyeOMqejIGWwkmZtCTWDV04xjjyCnI+14G8+yzU0L4dtUydmQUqGEmcKvAuPV9tO12FxNx2hLZMd8gkiHy+qDK0= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:16 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:16 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 16/24] xfs: add missing nrext64 inode flag check to scrub Date: Tue, 26 Mar 2024 17:12:25 -0700 Message-Id: <20240327001233.51675-17-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR13CA0012.namprd13.prod.outlook.com (2603:10b6:a03:180::25) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wzUurcuWK2mrLm1ydE7/kEzf5RZGoK6XgrYe+T9bPQTsYqonZtjJTAvnOOLqyC2PzQsKgEs73sXgc9Lf4ftCanpytEj9suDJZ3zu7seMH6+ev/0phUo4696l6Y8ZpaMxaOcX7Z2LHgv8w/0h5MwJGxXxYL6bvT4H6s9H+GK0PRI3nMp1YUi7rvCVWMTGMzbcrwJF2jlJNkNY2qIcMyhdMB9qVgBLvj+ZK9dWZkzvkjPTZKdmF4dsv6yHQNnmQ1OYo40mCHzslDwAvF8/H4yt699img6stpcIvxT4D3+hoFSMOsXIYZDusUJCaYzYSGlK85U7p3jaZWuomCfXFWOzX4yMr90l4HADBpxwX6O/Y4sfOovOmdyMIM3cNJ2BWno9QMRcSbpvr00/qMzu5s0Gqeaz6ktoHDJ8jD6L7BC0tRwPunt0RL/xGNG+GgaxaSQEaMWXEjwi2mZnJ+OqNsDeRDfaxSZUvulUUHpfkRCeQbiFhWZU+4MCPy3wvD/CGFfvPRa6lZMVz1QBx9jxyFVRJMl/uwy0oSUTEXnUS0/v8yw85Pt32HfhwfMnxHlCUJ8RXCSd14nsOWNLPaqbXzmBw2Or/38xb81e+qHWVqWYZUTG7jyT0vEePX/98aOBGFTtL5JxqwtzUHwx0l0t8P7C3942KqNf88a8WaO0ou4AUhg= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sVRgE6h91WGmQJQ9P7BdaGlFP15ja4YizSjacIcwg5/RenXGSAGgBufG9TxXmevT1AJkF9HUIhqX1GSyLdM4Tmzv5ddy8CkvhNjxFsxSe7FKUwDGd4EQiGdbFOQwWzLJol8nEYwCClJKHP4Cz+2sFn6L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qeIemb95mwBWlVnxspYFMzOSVnHAfRIqPA7iQwNKHe4DFSx1f1u7OTmRh5Zcg4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f094e911-d1a2-4741-e3da-08dc4df2b339 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:16.5528 (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: iKj6Ix3GXULqx/A6XTwZRDrgKZDoPK2tfUnczN3qbGMQce2th8d8EfS/SFTus0sjmnDopRM9BSmoP3FdzfkAsifyUDGGy4a7KV6k3QLISYU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: 3Z3Qp0McVbgZDBcaHd6kE-GapRmdXdFQ X-Proofpoint-ORIG-GUID: 3Z3Qp0McVbgZDBcaHd6kE-GapRmdXdFQ From: "Darrick J. Wong" commit 576d30ecb620ae3bc156dfb2a4e91143e7f3256d upstream. Add this missing check that the superblock nrext64 flag is set if the inode flag is set. Fixes: 9b7d16e34bbeb ("xfs: Introduce XFS_DIFLAG2_NREXT64 and associated helpers") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/scrub/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c index 74b1ebb40a4c..d03de74fd76f 100644 --- a/fs/xfs/scrub/inode.c +++ b/fs/xfs/scrub/inode.c @@ -337,6 +337,10 @@ xchk_inode_flags2( if (xfs_dinode_has_bigtime(dip) && !xfs_has_bigtime(mp)) goto bad; + /* no large extent counts without the filesystem feature */ + if ((flags2 & XFS_DIFLAG2_NREXT64) && !xfs_has_large_extent_counts(mp)) + goto bad; + return; bad: xchk_ino_set_corrupt(sc, ino); From patchwork Wed Mar 27 00:12:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605376 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 1D8211FDA; Wed, 27 Mar 2024 00:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498407; cv=fail; b=DBvq8D/E7ffq/QKzLvrSi0xsjq9VAewLv2avN/oSg1E6PDo8Bc6t1PL6qYh6C1AyIGoedexL6A3SnGivVOEG2Fdxx/XOlLHOCJguKQl960Z5yjHAiLaib5ujX/ryFGfxqihCoURWqmfDD3Ft0Vb+1My1yHHPLtpuBPanhM29A0g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498407; c=relaxed/simple; bh=HSU7HkyTVfAOcVIJr2863NlNJKuOe6bZrhr1LOqg7/I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=JIeyT+0Kqt91IZcPdE4K+l37WHLMQlvmjVGIjmt7SZhEmxPASuO2c+PBPIz5jZr025dGqs7gmX8pEjFNuT+noEMG7MqGeIFnjkwtv2af0Ta06PasWaiW2LxTPEFheS75HXkcnen3F7zv4BJlMKqIV/EQpvnCBA8Hmzx+/e6RQ5k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=UXqOAtQj; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=jOzhnqWS; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="UXqOAtQj"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="jOzhnqWS" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLiWHb026015; Wed, 27 Mar 2024 00:13:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=tovxCgrsxy9/t2Tn2Fv5+TYf5Ipg/jFugxg2ITjM6lE=; b=UXqOAtQj+2HZ5+fSMSD5XvXmvYGccg6bL77DFfEXq9ln/WDtoysaco+4fiKt1hhDprTM Ri7ZbkhXHxRouKD4Qg9VysPu2deS8zwpF+u6L7BatIO0jON91gP4X/omSMejUIVLCujn Q4OUqqEvdH8ukpOorDVgY/OHVYuTWfhlC+aSUMPgKC7Ll+MXP1o2mlAsZTg9Eld9iKj/ 4kRKmHLXZHsP9FL1m3n0hb8xdbh12vFEoWxI7mVeApaCcY0e1WjynRmctLY+hxyLaUwC AL5nmxb6seLAl0195Cf+ScgMlLtZeYtgqMdf32mZS4n8MAuhjlFrPIotV/hXyT+CpVUb qw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvsd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:24 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05MAm020824; Wed, 27 Mar 2024 00:13:22 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1akw-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HYbgdghcDoeLgtto9hkB+SgyXMrdKhBY7h3Wdsmq6uCcaImuQt2xEY/qEyU9T9HFquqbc9U0bBP9ak2Otqi3XhP2NIdHsQsuibtcNQN8giGkzslAeN2lLMAXGaWY0PVjfusUHXvsQOuRS1xpYO9DohwmrfIVVQuWsTxk4RRZ/Qifh780lJY1YmwmVvTraUtfN8y9hLhk+j2ZpSFEz80iONE4VNmi7oBKl5D//f7174KiT+LBePYDBcO6WeQ5zklV42FcYT5W9OWwj7OHxcX+5DRQrbHVj1kScrhISMCGpClKn8u3l0g74hw/aGgLoO+29JKRsVEABm1R5toK+dRq1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=tovxCgrsxy9/t2Tn2Fv5+TYf5Ipg/jFugxg2ITjM6lE=; b=flWinUw41IgvXWIacKDXJlINl+Fn7NPkQ/le69ralTMOV1hUPOIEuD8aFqHb+Oxvxh/L/VgtkMMpUqec4GJFRNrCdJ6SJ1qmdd8zSeHUwv11UoMyVayEhn7YIjXGwpSnJt8IWEVTD71nFNoxMElqm4gBFi1C/D/00zJfEa/tH54tjqNudwba8vefc0UmmB/1l/Jt/PuEf0l1hn1Bj4Bs6wTuTnc1q8C5NRngyVrl+OnvMUZHfCxECpWSG9wB9l2Y1+GC+81RwNujEciFG/ZDG2OAJ4QZh4TvQSa/5Y/MWxlcxYsGc0dvfraRivaQ1u1fr2BeKprgXARSHACCkBG3vw== 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=tovxCgrsxy9/t2Tn2Fv5+TYf5Ipg/jFugxg2ITjM6lE=; b=jOzhnqWSpXP1Y5DLmf3zG5YwIJH2yUQwdgAJ6q+nT7dNCjARqxI/6g3G0QcbCQxPhJqeThQ7SNtDX1v5EgT6/s0QX0yMA1djHnOq7x5JHe49QnRnIldlKtSRvx0KfVIjErNHrQqB2JTRgHGSnpdF8qUr9X/TZn8wJkbtVOkQJXo= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:18 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:18 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 17/24] xfs: initialise di_crc in xfs_log_dinode Date: Tue, 26 Mar 2024 17:12:26 -0700 Message-Id: <20240327001233.51675-18-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR16CA0035.namprd16.prod.outlook.com (2603:10b6:a03:1a0::48) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gn1oICuzvKi5lY7oHqwKEj2SmefoZWvw7q/EZP3OnLfrp1MPoMpsLXcvfs8K01HkS11KLDF2EHXWXjEqGhmPJqgBlybrQUT3V4RVQc8kAk8HzKyvB8wdDV9XgN5WUw5jzPJXBu7KbIgzeLoC4G1IpBpUNvrdGtLXoBBNcFs2vKrPVcq70yPPqwYDipKqsBCD8d4vbIC45j4540kKI/vi0BClhjdZY3duhzJCc7rNh8jhtB/3tNtq8FLgO6jH7m3GGQOTivfypaqbcRA7MhbU3RnAyv0C1CFA57I2h++kzdzlh8xrLCPrLjgYcKLaYTaf9DflnB3qKhan6rZqmLpgDrsScWJ/HDgtXKJYLoRxWCISxON/cgtvNZoMDz6seXPfsm99pBdPb5YqYPIANXnRkNWxR7ixmf7X48WkNOpatDc2HQY14IM368Y8YnJNPs6fq0lzJGp7NcKOdbQTmN38hpXv4nK1BCRjNUr+mbki9VZN2I01rwMb3zrxJggnprUUGx0k5dgcAtyQshhp4cJnU6ibZdpWVfvToc1yLCYRohBInT6nXLnvlVKlZv7uF8+HuVoOWS7P2kgrSXmLeYO5SObLslLE6TnhF6BkcW6ptsz7s6W4zPpaweaLezCbMmx2SIV7EksJZh1PAqgSFyBI1+NJJCyIy9q8FND5plnnsRM= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2mQZXQnIkN7g2JnMaOmipzJKy8TAixCWFTSp5PNdujDl884+MeKkzJgch5NtTfEm/ZfpAxH3NvPd8DbWRpjSVqjZ/tvwgWuUHYOWhi0BW91uagkCOcO8cS2uRbvKMVpt440na1sB5WppW0FHtClSBMccCBF37BSiWgdY283EXuiODOxnPShu8DFhSHzLC8t4MUrwYIeR1GziU1GZVnHH6U21o/eoAdFIbIGeEINi2iejoxbh2Gc4m+Grgiia+Zmn9r4QlXBxXgSNuucpSWPjMP8ZsnuHcX3LVkZoGSgFszBDdbtL42oqHjmyQJ4k+nzKkTKZTImeCg35pxPZgFlpXoLTU2Q7djcSdqno3TM/yqxjKu/v9/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NcXpCC0J7RprGSoiyTQuKxHNTYJd2M/KwQ2B+qmA4ywRtRTTv65j6MIH+CYF36MqlGxxJpr3Se0igdtIZHlt+t8baFjedaovmsnmnv9A7kP36JlttxnKW7gQ/tgWCg/NLDgP3qTvlorACBU8YSgrj41c1ry7w5U5sIH5ZJsfuObQj0gEnfO++AST/gg8x/4eiE+B1CBovPvrkVn71NQRLgAnA4dlAEDl7090VZw+/F1GQ70KEQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cz9lY+aLdq7MMyjBkYbMwU8Qf3yo/Ta9KJPIkSVZ+03Labdybb+X+NGdLM+B7C1qZC2BSIKGVDdseq/MvZsaHg064G92Wk4XPwZC3OKDucZTNt1kF3bHtqc0aPlVXVZ0ytdGGD4lK1E4LRPPraCOgVHDg/122qBgtToe8BuiJOhbUI7zeoznNcMSf0f+nt80kGiGPDVznYnSQ9DLNX86tphByk9RyFzdJT0HXl8yxLv2N/WNGNBzfCnPGQblC2gRi02GO8gfFrfu/cNXShM6K7UOIxlIbhJuqc1D3spVJnYzSGpS5iub8dpLnnEWx+xgp2cx8gnNG+e00nWOx7b2Fos0YzrQy4n9cNNFmX8DxCDIj7ZKvaXAlDeLCSSGt08U/FKlGYbk7fH95c8dgeZE25GikVKb0KuioMYLrMvIv9iytwrdZ4ovZ4WvQY7b1K6cb+5H7Qhc4ApEnt6xSijX0PJSRsUp/uyL96Vrr9ueOQdaIt6M+n/PYqYn9yVWHvLTDWHsnWx9NpanRXmnhXOElk004E1n5TWChWJtkN8KmlXkU0/+xtwjz2lKN8vb484E+FX80ukkeDsaWXwXZkiWBbGXaxTU4MRz3DfIYh23r7k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b34aedf-1200-4115-df55-08dc4df2b45f X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:18.5063 (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: ncRcS8P/UjX623eQNFw7DnIYjhNTAZlndwW7kaDsSfwGhsOKYzqebGrG4fgy8sFbRDRLgBbuJ7zPl32MOTvXvpMATSzi3JZafvpkx6MlyuE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: 3ulnwcFwV3GQZWbxVMcdZ2oCKADMkhJw X-Proofpoint-ORIG-GUID: 3ulnwcFwV3GQZWbxVMcdZ2oCKADMkhJw From: Dave Chinner commit 0573676fdde7ce3829ee6a42a8e5a56355234712 upstream. Alexander Potapenko report that KMSAN was issuing these warnings: kmalloc-ed xlog buffer of size 512 : ffff88802fc26200 kmalloc-ed xlog buffer of size 368 : ffff88802fc24a00 kmalloc-ed xlog buffer of size 648 : ffff88802b631000 kmalloc-ed xlog buffer of size 648 : ffff88802b632800 kmalloc-ed xlog buffer of size 648 : ffff88802b631c00 xlog_write_iovec: copying 12 bytes from ffff888017ddbbd8 to ffff88802c300400 xlog_write_iovec: copying 28 bytes from ffff888017ddbbe4 to ffff88802c30040c xlog_write_iovec: copying 68 bytes from ffff88802fc26274 to ffff88802c300428 xlog_write_iovec: copying 188 bytes from ffff88802fc262bc to ffff88802c30046c ===================================================== BUG: KMSAN: uninit-value in xlog_write_iovec fs/xfs/xfs_log.c:2227 BUG: KMSAN: uninit-value in xlog_write_full fs/xfs/xfs_log.c:2263 BUG: KMSAN: uninit-value in xlog_write+0x1fac/0x2600 fs/xfs/xfs_log.c:2532 xlog_write_iovec fs/xfs/xfs_log.c:2227 xlog_write_full fs/xfs/xfs_log.c:2263 xlog_write+0x1fac/0x2600 fs/xfs/xfs_log.c:2532 xlog_cil_write_chain fs/xfs/xfs_log_cil.c:918 xlog_cil_push_work+0x30f2/0x44e0 fs/xfs/xfs_log_cil.c:1263 process_one_work kernel/workqueue.c:2630 process_scheduled_works+0x1188/0x1e30 kernel/workqueue.c:2703 worker_thread+0xee5/0x14f0 kernel/workqueue.c:2784 kthread+0x391/0x500 kernel/kthread.c:388 ret_from_fork+0x66/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Uninit was created at: slab_post_alloc_hook+0x101/0xac0 mm/slab.h:768 slab_alloc_node mm/slub.c:3482 __kmem_cache_alloc_node+0x612/0xae0 mm/slub.c:3521 __do_kmalloc_node mm/slab_common.c:1006 __kmalloc+0x11a/0x410 mm/slab_common.c:1020 kmalloc ./include/linux/slab.h:604 xlog_kvmalloc fs/xfs/xfs_log_priv.h:704 xlog_cil_alloc_shadow_bufs fs/xfs/xfs_log_cil.c:343 xlog_cil_commit+0x487/0x4dc0 fs/xfs/xfs_log_cil.c:1574 __xfs_trans_commit+0x8df/0x1930 fs/xfs/xfs_trans.c:1017 xfs_trans_commit+0x30/0x40 fs/xfs/xfs_trans.c:1061 xfs_create+0x15af/0x2150 fs/xfs/xfs_inode.c:1076 xfs_generic_create+0x4cd/0x1550 fs/xfs/xfs_iops.c:199 xfs_vn_create+0x4a/0x60 fs/xfs/xfs_iops.c:275 lookup_open fs/namei.c:3477 open_last_lookups fs/namei.c:3546 path_openat+0x29ac/0x6180 fs/namei.c:3776 do_filp_open+0x24d/0x680 fs/namei.c:3809 do_sys_openat2+0x1bc/0x330 fs/open.c:1440 do_sys_open fs/open.c:1455 __do_sys_openat fs/open.c:1471 __se_sys_openat fs/open.c:1466 __x64_sys_openat+0x253/0x330 fs/open.c:1466 do_syscall_x64 arch/x86/entry/common.c:51 do_syscall_64+0x4f/0x140 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b arch/x86/entry/entry_64.S:120 Bytes 112-115 of 188 are uninitialized Memory access of size 188 starts at ffff88802fc262bc This is caused by the struct xfs_log_dinode not having the di_crc field initialised. Log recovery never uses this field (it is only present these days for on-disk format compatibility reasons) and so it's value is never checked so nothing in XFS has caught this. Further, none of the uninitialised memory access warning tools have caught this (despite catching other uninit memory accesses in the struct xfs_log_dinode back in 2017!) until recently. Alexander annotated the XFS code to get the dump of the actual bytes that were detected as uninitialised, and from that report it took me about 30s to realise what the issue was. The issue was introduced back in 2016 and every inode that is logged fails to initialise this field. This is no actual bad behaviour caused by this issue - I find it hard to even classify it as a bug... Reported-and-tested-by: Alexander Potapenko Fixes: f8d55aa0523a ("xfs: introduce inode log format object") Signed-off-by: Dave Chinner Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/xfs_inode_item.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 127b2410eb20..155a8b312875 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -556,6 +556,9 @@ xfs_inode_to_log_dinode( memset(to->di_pad2, 0, sizeof(to->di_pad2)); uuid_copy(&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid); to->di_v3_pad = 0; + + /* dummy value for initialisation */ + to->di_crc = 0; } else { to->di_version = 2; to->di_flushiter = ip->i_flushiter; From patchwork Wed Mar 27 00:12: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: 13605375 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 4CF3D28EC; Wed, 27 Mar 2024 00:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498406; cv=fail; b=IV7ZxI5JVov+LwWWfQm7HIJY4Uu9vXwPfdBqolGQj+YdzrvhSq5xTzKwVveTAx9AI3WB0yGuVK5r81XD1dKig/rhSHdRNl74RtVeDYEYFmaNc1hlfnjtfF17/UXbiix7ALGqjWs5M6RsOAi5z4CA5xgroma0Y3pzVIpfTgNSSS0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498406; c=relaxed/simple; bh=ffF7Vt9WJrn2loTAODaqeRiyULZMUsEyg/eyAol/gGM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=kMXFM4/RICja37ubhT7vy1O9zV33KPItCdaYUO76TIk2bey29ipEdYHpslMVt6yGGzR9eUMKk8d4EBz6rA+vg28F3XeVp6wgskbc9iDnIRHHLJdBkYC4zcyF0tr6/4WV2MJgythTIkrK9D4TVd0ZHGTq8ESGqAMnMk4e6w/Aiic= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=bhr8bmg5; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=xe3tIAJa; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="bhr8bmg5"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="xe3tIAJa" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QNnmdg008836; Wed, 27 Mar 2024 00:13:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=yUjFmOiV06Td2fw5JB+JBdI/KrjVB2O+jLOj6dgxbLA=; b=bhr8bmg5VixwTLYucn7vBOUVP4naIjrS/cB8OJhemqtYkU4Y60p6nlAM2QVcE11hXAmQ Y4Y189CNjTFEc7WpO1RwCcrUzA9HUnU1JVVEvqjMBOm8zs/nD42HIsmA4I2/EJvnoRhw r0EwNR6+AHTPOwg8ZkA6i/ICtRZIfC41f1aT+ToSiL1m5zjiRIVZoSMpKBwg0CCRcLy1 at5IieJmpO6CroxUklxAntfEIeUP7v77eTFbwQS1GNtXyDhVYbf8uEY4qv76vRlMset2 uc1V4EFP40pTzi7+UQs+SnHTkuEUIXIdttj+l5stGd28dLyvysupPHKKnuLwhijNAwbq 8g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x2s9gvsd4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:24 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05MAn020824; Wed, 27 Mar 2024 00:13:23 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1akw-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qrbf2zpvy6MrmiSdAw5CRVymsrZtbBv6ibgMeRJYCoruJ/K9s6y1k+kRJ6gEo/VhWw208NfDWzaduSWvPEP0/H5182MaRrY9+zDdUGmpDx9YmKZI0vceJL7Z64YFmpYk3PbDTmz9nfMmLGGcXnrI+VC726YAV+3uTi2/LkeLY2TU60e+x6pQdtfNOwjw+sWIu83Sjy2Fqi56up28vj/EEeowA3VVE+QTHjVzM9JBvyLoEg4jElOTKH2+5L1DweizrPE5qC1EPIi9LYgMBaOVVIHZsohQU/IFwWCf5H8pc1uUlFshVK2rcKnouzqQ3fo6hZM6nenDmrt9bXAMvF1kFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=yUjFmOiV06Td2fw5JB+JBdI/KrjVB2O+jLOj6dgxbLA=; b=KlWK/Y0al/EVjicrdLtKp4xsyhkBrMucWjKnNT6FtpBNJDlumo8LaUMiuDl2tEErN+8dGYssEzjGOVD0GaG5OgAv3nC1e3/VIcUTFgYqOGh0sT8dB4scxsRjYSG8tWQa0DeH7sSJNbRLJXJCmWWWtcdBnM8IiE50FsjsEAcadmcgiZpXMR6jk/8jxlaGR1mw5KyCw0FSxYi1QNItUEMYRk63fFy9IBP5MRvo4727V6SF4IYn68Z1yTnL9HyLSGOWbc0mOEobru6QNBGXsTQRm/64kac9VL7hUO3azi1RkPs6+zeDLim/pHBdv+UXb1kC4UkpyTuFA1a/KQ79N6jyXA== 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=yUjFmOiV06Td2fw5JB+JBdI/KrjVB2O+jLOj6dgxbLA=; b=xe3tIAJazQxRFK4kDpe+0EKOs2tL3YMhDU3w9KhGRBm292XOhbBCsyNhtPRaXpS9d3S9DkN5XRzXq6QXB3vVlbBSRxNgTKkjoQMJn55vno1bClqabZCTI/CIRV/LLwipqZoDDOoza2T/E3QvxXu1mPuKsUQtcOmdRIVNsQLtByE= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:20 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:20 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 18/24] xfs: short circuit xfs_growfs_data_private() if delta is zero Date: Tue, 26 Mar 2024 17:12:27 -0700 Message-Id: <20240327001233.51675-19-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR16CA0009.namprd16.prod.outlook.com (2603:10b6:a03:1a0::22) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cLal7pj76GhuDXD86L8+6bagcii5QMO3xjs/eNs7lTsxpS82O/lUdwwdmqwgHymkcK+VqaZjlNoPMW6yqATuTtH7hwbEm1v+zN8P360LtT+3BYcoDW7kqRpDwv9ZntZ7OQ8f/13ENUkPifAqeJEML8GrYYc/InInO6ItObg/4a0DLRvkdvDhxywAMIlLjaEc+trMFLMZm8KaXDIRR6JFNdpUFh/5ArDovpTsXDucdhZyUEaXqqBWtCnLNL5gLMTJHN2uMV85dUnyzuPrz2qVIacoMaLvWLCvVS4Hu9QUaj4OtwHPMpsuY+mfLL0MX4jROiYApxXP82rCTXzy23XFsXUPwT0qWmhSxhovT0yFMlAaItYgWPU3vLOA6K7zwwgbvhzw2Pkxwj5/04cKPdc3a3p0aUjl4bzOQWIXz+7Q8IPN/axqsjct/gnicL44hX0WjFpULTJiR550S43wHY8zCurDH0Zkd6KHwrJYiZzjDZg33dvkhrCBq2A8po4Dd/J89UGSNBqGS535NYxWYlBzuyAKJ9vbtUu7c3YC8H51ISrWKiIrwOd3gcuR9d+vgvgivPuZWjxPQOyI8mDApFwbqjIpyP15xeV1SbqV7JCmgYSvzpExB5/XohslHKr+XlCn/uvQ884qr5HoX5i/bgrbrxrAAJ5QP4OELNwyKekDWyk= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3u9amSFASmAsVR1R8lrKsTlwiq2n1b4pKaXejXMRzOwuFE82u4PqfagJ9geopHrTqAph7ozvrjlYUDxJX21V4vE/31fXri0N+cavMaJqLUKwLUXv0DyRc1qDvW72gUGwohvap/KNaLs0iQFqBfcuEMrnrnRCm1j5yDmbAas2e/bKA1U9oOH1nakzpZ40G1WQ/4vL04xY8K4ya4rVtadf2vrIXHMoDzSMfCEoVbQMJNwQgiQKYfOe1ygFCpxL5RUjnosfr06OUspe6ej40NC+4BegJaay//MsZtCAel3iZ7eXBZQJXn5EMfOLLmEIlsLHd9p/7OFUm5sBxLo6mHS22hfLo4QCS/GUVx4h/jgUugs8GvYsLj7CXMeTvWIwBLXNxXyJwwVZXGPUCOdoXkL7AgQO9S9bzNg98XR0c1IiZOjVW6QnhJxFRogaxwq+0PuksBtKhcGMDH5Z3qr8bpq/ZQMzxdQDgXCtqNa0JccFZyi6QxsO/TJzWySJ0dOEzDY02I5SoXQlrHJc9c6PAoRuDFXco+yNfOu93d/D7ucz4/ImT8DLPbV0EeFrcsFNci/IjyT3ih7l6/wk0lCBLwD4s7YzkCLtUNyVAv0evc8Gve78maQERRFgKXZv/cT/0ujAD7wSg4AWSDdhRrY31Tn1ZgJ2uTJez5n8dIc229UNHyGJt9Gl3I70eBxQ7itWTMYOfHrap55ksRRmeMPqDTU5p7mr3SaRMJ4z4SAZOwe6MDjDhmvR95h1TXJyOQPZln2/z9LifxC+15DGj5ccYh7cu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SswBRRwIMn40nBT/79Ya1L01CTmj6Kd7pxoyJ1eZzwQ+MOf7Ly7Etymo2gl2qG4uYVYGqGBzDF+J2M752tXZwUEiTvdta9Tj6RAlDAXfBDk9mkvDVFzJH+I7Jqa0uy9X9LbSpDL1RVqsx6Nus3LEUhuTnxK2Rl+uB9PFRIsEPS04SeiEsBU+a237lL71AxaoeVKiF0zo4T6XdUIQLtInZvpxvJ9i6ZohyZd2XcPl26s244i9DeWu5AhroqVgCISvZLz2jQ4N+XHw7SQBBavld6r1PehyR+HPUcoUj6+s/0wFGemAeeCHUP4gMKUFYGvucoxcc9PqCJ/HqQjf5NE5A9GZpFLU6MJ60cELIRbFg3RI3L2cmpqVHnpCs/kPAOtIR0kRBa9epVWBHLBqU4RZPpB9c3cIZl9VrlGFuk9Tznl+xB39dMTg0RP0gCkz0PRN/NRiC3OSrkLOIEmXiqH24ovnxnaFMnLg9cZh0Zr1lZlyWbcAHFK4EbSLM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb6558ca-de66-4df6-869e-08dc4df2b552 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:20.1445 (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: 8Ncf4HBN0JJzYTjG1+t/1C7gOT5jvBZQS4gtVYkFLoHu6LhnIlmfPFDSQTZIW5U47NQgEF2qATslmRW37z1Fz5U4MzBHXUjxdTq1xCeH/Fg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: W4rbMeoYbvEuLZx3oYnOewVW220g6oEq X-Proofpoint-ORIG-GUID: W4rbMeoYbvEuLZx3oYnOewVW220g6oEq From: Eric Sandeen commit 84712492e6dab803bf595fb8494d11098b74a652 upstream. Although xfs_growfs_data() doesn't call xfs_growfs_data_private() if in->newblocks == mp->m_sb.sb_dblocks, xfs_growfs_data_private() further massages the new block count so that we don't i.e. try to create a too-small new AG. This may lead to a delta of "0" in xfs_growfs_data_private(), so we end up in the shrink case and emit the EXPERIMENTAL warning even if we're not changing anything at all. Fix this by returning straightaway if the block delta is zero. (nb: in older kernels, the result of entering the shrink case with delta == 0 may actually let an -ENOSPC escape to userspace, which is confusing for users.) Fixes: fb2fc1720185 ("xfs: support shrinking unused space in the last AG") Signed-off-by: Eric Sandeen Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/xfs_fsops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 7cb75cb6b8e9..80811d16dde0 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -134,6 +134,10 @@ xfs_growfs_data_private( if (delta < 0 && nagcount < 2) return -EINVAL; + /* No work to do */ + if (delta == 0) + return 0; + oagcount = mp->m_sb.sb_agcount; /* allocate the new per-ag structures */ if (nagcount > oagcount) { From patchwork Wed Mar 27 00:12:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605377 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 7076CFBF3; Wed, 27 Mar 2024 00:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498408; cv=fail; b=OyKpxBzpnYU6Layvx4bSiwsXVBAFpIrh30Ro3rOVa+ElEYTUeCcqi3kSiXsheUqok/B64UfVHc7PKDTrFlAAMBVLLN4sD5MPJ4jnqW7OnN1pg0EV1vkXQSLBQSdhpfhY+1YQas6SnYlUnkZZ8jBXFWkERYMajBcRFCzxt9bX0qg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498408; c=relaxed/simple; bh=lwpe8rMi1U5ngmv665dQqwyoB7t2vsJoWILq8UFgfz8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aUd4VOx4+x6rIP7BuzrWsXv2QNgyhXRaG0NZRgcpSF7V6hB55mXyJKjp0rBwVjUZQVGkEwb0LwQtqo+pvetqc6VzdIVkFidSwVu+nciwqytE4kWDRHv/7WTHsVEG23cb+/j6euUNXQIwmi63RgT0+veLK6qVSCAnDocI+f/LE2o= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=IexYdLC7; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=J91PtL3X; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="IexYdLC7"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="J91PtL3X" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLjlFW019156; Wed, 27 Mar 2024 00:13:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=XS4o86qzlPRD4mzntIZ4BMkltkMmydbNfJOcQnkOoho=; b=IexYdLC7hMshmj9vDlFAdJSBvd2PHS29ahfLM3VoJVejA8WsuRHCHAs8Y05D0DJqnWpq j6tqmrddClG4SDLi/TtDcbH9PZKevGf2uDwe+H1zZFQ78gVtahWdSaN2E1ibsPky+CL0 IBACIGoRgwuq1gMfmn0tWd05Qbk6gUQBxHwoDPxiuAYP7dCjevfyMFFcWvOzjqncIN2o 4fJ205GpKReaa9CeN/NPpvsOWS/RRbZkzauRPhnpyX2j/thJ7NDki7fiM/bfQdmE97ea PsadhiIJG3uf9YdjCBBtT/+d+tal76PB4waar3egL9n6S6eL1zlCHYlAPbsvBnVr7mfQ /g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1pybp8au-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:24 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R05MAo020824; Wed, 27 Mar 2024 00:13:23 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1akw-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhGizZRN99hL4TCHxs6MQC7/SJPM/KucQpfFuYkmWWpvI6GBAZ4zRhvEKZzolFsJK3dzwf1LzIQ9cE6FN7tXuCXlTYrN8mIs32GO7waWAPLZSdf/aED3iA+7dhUU8UNaa/j0hfull0rjcgSNHt2/1rKAoXZad545u3wl58yPs75B6ot/UorsmYFu2s/RptXmrdDAigCZffSW+75fc4h6OudXin72KruDq0yYae/TV2snj6IZv+XPEiJwIEgwb+LK1ZRyH+Zl82/IE1YiZEknGr7z4bxZ/loetKMIKivsNsqk2QcsQByWgJSThvhnY/3TTcCR9tZw5SlJoBw+eqL1/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=XS4o86qzlPRD4mzntIZ4BMkltkMmydbNfJOcQnkOoho=; b=Yb94Ex3SJE7sMFl6eEq5IE5unP7brTA90FbDGlZS28Hbq0ZtcqX7S3d7nU6GpJQlG3XIMMQbDoGfTg0EDRjIgqGwC13b03cSWVyJr5aua+npNwvk8W+8enmIQk0anbyh/G9O96vGvPmGO/MsF8iB8Lyvb/jGImGS2qQHkZxTHf2IX0tTNerVqj5M+TB+seXtjfk0+IMAeQwKEvTPdnWL8Kj4NYZNpiTrTI0kO5ElUnlovKO0U1jTQkbaKUd1WULM0G0jdbK5WkBAuOtUJcztQRiZ+zQN2hMCAVFS3jSa2HhVjOr+OEvVGAbMsPxmeG9CABNX1GpTzMiOb1jt1M8Jiw== 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=XS4o86qzlPRD4mzntIZ4BMkltkMmydbNfJOcQnkOoho=; b=J91PtL3X3yMdvyknQUE1Y3XJOuQkwMFdx0NQmhN7xZ8uvZSJ1UnbrtyGHxXg8uaFGPps3U63dPgJNFnTgyjKTbDWmgqoOaMQEQ0eWcuuKybWJ9zhFC6hjGvgJcQ/RNB0Moal4823zbgATtVUIACz/hvsw1uEEY+nNHYdksZ/6l8= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:21 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:21 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 19/24] xfs: add lock protection when remove perag from radix tree Date: Tue, 26 Mar 2024 17:12:28 -0700 Message-Id: <20240327001233.51675-20-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR16CA0016.namprd16.prod.outlook.com (2603:10b6:a03:1a0::29) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gXrJZ2eYrm9icQ3VDwPb9XRTuOz2A0dFjjaWutBx2CLEvloE0af04Bwv09U1LLv/dOm5sK51T8IBOr+US0+GRhkUelwkxx+lT38F4dQ1Ab0XoNIQr3fnY8VFVq/g74K69g/BD6DBSCuPruZQmbMVa3sDDNGRNeP0zlbK1KTYB92CtlSxNdosVZl/heHLh1dJcYlNJP4GtQoiFc7bq1/sJVzDuvyGoLQ3Ua9lBiFv7xzrFfGZPu7LLh97bwdSNQx78uu7xPqlhtVs33LlrerDxA2HjxOuHUQPrSWdgEIg4IfriPmZVlPMkKjkeShyVcC/gPb28MCSMvFClUbCS5Bw0alpNWzDAEhBbJPWIiof+rPzImd4UAO2By7RNzoEKqMIKR3OXmXmhP1sLrwagxY12AxKvC9HWRsB99t9tQyf+26pIbIdg1lE7OsZdHPcNr8E55Ri9IAnexjGgll1yxjTntO/fJOIyjP1/mYILedpazRdyFBBb58kZJFBkwImg01KKjlqFlfjWDA2u9HU5vGQJ9DfvlNpc0wrn4NeE548CSkkWjdSbdsjq0+p6K5MYSteSyDB/5PF95bxAdtyy9UUOF+Hym/J+FhB7QL4sosdzakhLg0ms43SXbA6QekCBdCoBBOOC6sq22k89+1o6LM3AZ7DvEyVlFxQ/rasQW+5a6k= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nAvGbknPz92v/cnrwa/4XDIbh9MSm9tEdX5UWz1yCMor1HnhWHm9AClkkMFEzCjO+ng+bE/OHP5skKp9TaLO6WYwTHzgYuYPXMTtJpo7UpdE1YZDce/iDU/XRP57NYpiDEXqgkKOf58eDvIK9qOW4XWH/i+fiKh2b/a6jft+uEVyp5GdFKQlHkpc+ufY2TPg0bMmkQhNYelB1SNVWNiajCKwKaaFvbspSubyststPJUtL7WcEGyqvNew2usSmAq+DWbDZHRnUakVWBAl6YSv70Kt3xglmwvCSJi+NxBlMEXCasbBvf5sUPdNtOr7p/8MREzuRlPLjezIKYeUeZ8dTYP1g3ckzRZj+i72bHBHBrEgWSYX/Smaid4JdwHOHt5Tl5eu6miBlIaL7k/FiHZ+X5sIF/RSEwN6cg5XJV4UZ9iQwBCG3iPduXL6r+m4FBj+0b03JMrdBuQEDef040lBb/frthXfGGa1h//reAG5hsLI2iDUBHu8pN6o7uPxyf5f/5H0nFHA4iIVVbtA4L3DHzWKpygezp4+bMJ4mmx9J3q9jNHADlm69q+PN/l34VZwFQMBaU54YEuopUhmu/WNcZGan92VNCUmc5xysA6lho3UqRai0Woy71o5F4A3or16FsCpe6eEyTCHWLqNJ8NKwHZdi0OSEbD3/nqBkoV7OgnTtXNkMiWIoKsP6L5UnAeKgbZLc5UB8d6nKQ24ytq/mHs3BledJSEJ03xA3NZLfCCLCGdso+rbbngjKK5BCee737utN3HaMQrVCQSfr9xQ0o9lCUEHvvLBnDlZdAasZA1JU6yF1vSeD3ADkI9g56pSZf6jp6ZuWGxU9Wdl39IpEvuPX7lbiF4ae/U7ZtIvyGvYra56Gpyl/zj6MtyH44dn3im1Qa/6ijnOElfe1GId4PZ7KdoV+xuKUrJyj1Lpq9zR2k5r6YNQLtTOxLVVpUutza8iSlTPFsBacpZ+KDgnls5EZ2CiEaDpFvXaf912m18KwaAQoqbWfhGbKlixqmht3JmTKSkzLdwTTQ0tg8N/iK24OjdcQzHztUrIKxMiN9ixqbzNM+RgCv+Ebi3Py9hiQEgtfmA+jutDKE54AxTPHosJiyTgVVIhHVrgP/+AkY+Ti4fQCpl5B+cfdaEzmqxytx6PX+pbGEJHK7NkxoyskPNs5Uwn2X8n02Jk/MYKXp09vcIYn2kKvbAP/fAKTl/7urrOSfS/lwP9pl7BxNjO/qiVp/tikaLqaTCxIox3/B0WocTvBMT4fquqt2dKlHmfPC4pgbT0f6Y8cbftwnceFTXzBzgSv5MzpQn/+HBFS7aDdreip1lXe8cOqO7t394BIay9P+z9EIcEUHtCqRI98+XUiKP8K0zzjIeW9OKLv0UmTV10LPRQUVyiLWrvl0JigIP6fN7PIvFWNixbMP8NhObpWcUuoJIlCY42wXxNlzR8urbLHWxX0psFhAmHkrxe6DMak1htJUxY5LmWtEHNrpnue55tSSMwlGtavoSft/TGp7nDyxi3q91XMNO3IakuDq38Xq8ggLs3s9byPTOmGuju3AS88neeb693z7FCzcgDP50wxTE5Py/GSc/BU/jo65Nd0dtk/BnWMA4icMaXvJNzL1ogOPlNNzoawB5wo7CxEbqrj1efegvKWIqTcP5lhTQ0skNzHyxgjtfpv0feTg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: uu/m7yVVFB+aDJEUN5zuToSPLtWleb11B4KPMBe37rCd4/rSol+0F7dx0s71DOZaKqZrQm4X29C/dBZOL+SwDwZ4PpNZjYlLBVEp9j7gENh32lKNrg02kPFNVQ7pTZwTxdh2ztMgvqqdaQB7GAjWQFPN2atHztodRH5AA7CHRJ32NrUdRWp7HaFTULDKFfdqVDr7kltSA1KbzBl6hh4D2ubaLpIY2O9I91+f/U2VYPp9hqnW/TeEtatkCTGrV+fbqBsjdCAozSg3UIFCkcV//q2PQpQE4RhOMUhgmZUChS2mOf9APPJt9HUFGqVqtBrG/2vFyr6I4fUKTlUreJhDDVv4a//wM5Nkw8/cP1nm643w/cz/Obr0GT4WkRlxGFBkJxENkGgIscdlufUWa4Te5b/c79xJfp+ICt2jGR6ZcI4QfFSd6Dkqz0WqIn8vW3rvb44WJTPbOKPCCvdPHDRDIrZJzDI0eXUQVv9AihGm5SnGU22tETpSfCN6m9s4JNeAwLhcNg6atbMv1zQngh30+o9ydyE5NkjpJ73H4uKgJ1oa2j/DBKpkZ3h5FKn1ariUIECzCu63+4W1Ezrjvfz/3cnmHEaqegaLDhsLTlAjfls= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dbe6052-e2df-46d1-7c12-08dc4df2b644 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:21.6414 (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: vZGQUNog0xbR6KRPEnNYTrsdEjCmROQ5hnkTBbp6qh9ImnR559xbfor9Rcns8OX8IhKv/Np9Dh7PjzFlCnwGmCmX++VXSPfyF13DVez5l9w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: UT8lPYixtyhDkkh38IpQPpyFP7hZjkAJ X-Proofpoint-ORIG-GUID: UT8lPYixtyhDkkh38IpQPpyFP7hZjkAJ From: Long Li commit 07afd3173d0c6d24a47441839a835955ec6cf0d4 upstream. Take mp->m_perag_lock for deletions from the perag radix tree in xfs_initialize_perag to prevent racing with tagging operations. Lookups are fine - they are RCU protected so already deal with the tree changing shape underneath the lookup - but tagging operations require the tree to be stable while the tags are propagated back up to the root. Right now there's nothing stopping radix tree tagging from operating while a growfs operation is progress and adding/removing new entries into the radix tree. Hence we can have traversals that require a stable tree occurring at the same time we are removing unused entries from the radix tree which causes the shape of the tree to change. Likely this hasn't caused a problem in the past because we are only doing append addition and removal so the active AG part of the tree is not changing shape, but that doesn't mean it is safe. Just making the radix tree modifications serialise against each other is obviously correct. Signed-off-by: Long Li Reviewed-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_ag.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c index f9f4d694640d..cc10a3ca052f 100644 --- a/fs/xfs/libxfs/xfs_ag.c +++ b/fs/xfs/libxfs/xfs_ag.c @@ -424,13 +424,17 @@ xfs_initialize_perag( out_remove_pag: xfs_defer_drain_free(&pag->pag_intents_drain); + spin_lock(&mp->m_perag_lock); radix_tree_delete(&mp->m_perag_tree, index); + spin_unlock(&mp->m_perag_lock); out_free_pag: kmem_free(pag); out_unwind_new_pags: /* unwind any prior newly initialized pags */ for (index = first_initialised; index < agcount; index++) { + spin_lock(&mp->m_perag_lock); pag = radix_tree_delete(&mp->m_perag_tree, index); + spin_unlock(&mp->m_perag_lock); if (!pag) break; xfs_buf_hash_destroy(pag); From patchwork Wed Mar 27 00:12:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605378 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 E08801C10; Wed, 27 Mar 2024 00:13:26 +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=1711498410; cv=fail; b=ZQapCDmEYXlh8LIW4g54XJyxFmD3bQv/k0yvOcw2pQTge6c5snnvz1IQJCBlqeBJ3otKoybOWGDOfeHYNazu9TeL7pzz0FrVS7NvKuiGkoZhH3zvTTgx6xLE+x8KmE5dgDKGLELbN3cv4hQoE2+4kxt2hliWx7MIUhvppeWpaE4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498410; c=relaxed/simple; bh=UA26M63q40jup9ukC++G/r9IN9VdebchySojqlPrwCE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=rSpsYl1MT88Sidq/sW8BzJM2OSh9aJ257PXGz9n6A9ZJ3NsDUCVOXuAT7fr/VIpWUD2HW9zWJx996TXBcs3KbivaDQXjEufzga9/UkWUV9oOshsB3LQk8ir4oo/FEk2hFz1P9oVCUIadPRPV7BjUNYeyRAgfIBFK8NE8OJQ/8kk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=HRHa8Vhm; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=U3tNIxOr; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="HRHa8Vhm"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="U3tNIxOr" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLi0x1016402; Wed, 27 Mar 2024 00:13:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=lsS7R+mGl9YdTeb9A79jaiEou6PX0O76Mip93uqkDYQ=; b=HRHa8VhmUv3bOVv5UYH9/gaT6KI76PYXV2CB1s01ErPJ84CLuHUNjHzDOYY65YnL0BVE 4YUSBXTBASKVrcnHyO58Al9q2K0BO9ZYWG+n06SyDdViNt29Vapm1qA6ATjaL4gfUKye 1WowkxpiLPlag2iXKvQmwBB6/ECD/nl8YE3PEPE+6RXEWh3hrUjS4n1aN/lVLfzarb2f mnWE26iFiRXKCSCIYf11wmqnV56XqnDFmH60LYLHlnJbd/2qEfGPgnLouWrmzr6vWqVD U51x/2G/dN85nXk+7SuDvLsnlwYZWcZthoT+UwSUK+I3vbLuL5vSDdRI8aRx0txdOGfI og== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1q4dxc0s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:25 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R01oai012358; Wed, 27 Mar 2024 00:13:25 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1rnk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cfw/E3G+tn4QMIv2rHtNUifHHSMSVOYYOharcrVLn9WCVyBxPd5F6ZyRfXwNqF/A5/HYlnKwua4vhpFqGIvxZWZvOm2Lxrc1HTcYsZAb5zFZXI43KXr02RVXgD4j/Ei1Z4nFWQ74hZYq3eV1IRK/nQie/Am7iHbwSRr6v1ojlMaCvhduuZGnY9ir8NRXJAceWfs7z0lMR72nWmYuBEWp26vXUziVArf2+5Pmcw7i6uMWOgpksabWX7cFSH8RxrADDxSNAjaX1p77wrTABUSd2zqDpTMQdduuqlQVtgReF8IMJGxJhTb1BUmqYs3Z3uS9jQADP43Bu7x8PPdOKShvUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=lsS7R+mGl9YdTeb9A79jaiEou6PX0O76Mip93uqkDYQ=; b=Mk/vwtqvIimwe+oBou1irpKcBftfK4cvPHWlGOZwmgC06G8MBIBw5dG12jjY0Jm08JpVe5MDpJaFFkRICtfB+bzfUFagB9W4IXKeqx08Io0yTcxzH7AWwQzQrM4vX8DhAr6VXqs6jUQxAR9rpTSyogGRZSEJZadg059NPjxc2SBEF+fE2XFZe1LEJfgdPNqhdasn3jqhmuHI1qClg8PzcNsaK84cy6pETnkuKqX2KQUJ8Aw/ej8DRbyU6s7vrPIl8BFc0vflT2FzZYGs7BbT5KlB+hcamIkphO3hHXQHm5uu1Zep+GSDKdSeBIgQ0pR40y4zxoF2w/dY4h4UUUXHhg== 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=lsS7R+mGl9YdTeb9A79jaiEou6PX0O76Mip93uqkDYQ=; b=U3tNIxOrq1qftG5KnNMgef5p3natjc+7ipPwavXJoZomVHC3l1H6kJ3gb+N9Ibn7MI+wQXfstOOiG9sx/D8AvqDO+ZOUfBINXWMvI23ZEHg9U7ixjyATfUaJAuaFXuf37a/Ni8QS67zZIlzhw9RuaBvm+znxEilY33rJF9WYJ1s= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:23 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:23 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 20/24] xfs: fix perag leak when growfs fails Date: Tue, 26 Mar 2024 17:12:29 -0700 Message-Id: <20240327001233.51675-21-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: BY5PR16CA0014.namprd16.prod.outlook.com (2603:10b6:a03:1a0::27) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M7JiHUWeQlrHiOEpRGsZRp1RGOce3W38YBbSTqNIo1iAbYaZX8wRySULjFGQ4PS5V7QTXdhl21V/44XqYplHE2Aiu/wp5LkeQ5YomavfjzEJ2LdI9lsQ/vSnR3a8HVsJkfoX+kJrHYZzLhKdLH+CAAdfxpyJBLjHPa7jscjcEzgBjx4chQi0uiMiplmnt+k09o6Eu8JgW7DTSNw4FdDFr0zF3IN1eZVk5RNgnJFTy8PL6PjZvBJtrqfP2zL51NlQVjPvhGEQD9t9ZeEQhLJbb0u9kQgkGE5bDLW359Cyrk4IrFn3cPpWfD3PtPmcOXDUrpfv9aoe7CueV2Fh8cTIsUXMlfUJnyq1ujTr3t6/xcCFem103iKbC5nXYpM4howbx6JcSQ/rfHquHntcKK/RS/Euex4UmQfqe7OWqU7u9Thm3ziUw9S6VXglrZovF1AK8HgEeXHLRlbpwuGSh0iDTK0YTzNEl6gO6twzdbmh0hPop9BoyzDD+9QKHYD5dZaLJ9PniXUR6g0zkx1ZBS8588+/l84yvw8u52P+EPM6jbzQhLWeXuCsGBPVRXsWIgSMedfqkqUU7RzilSQgGjWDfJ70A87vG/qqyQxZwRTnutHfVq+owpDbKh2iEcAhgqTACOfGXdS7xImreKGzL6xhF5bXSwZCazFq3iXLFWuKGj0= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y6Ef8miKESmh6j2dCQcSRiXcFMKEV4yXzNdyUZgVvCRnbnRzlkuNm39BygHTmoXDk0cLBIG/2t+y5ax9ZxRQL/t/zyxW4w6OUqIx5hKrdJNEypVZumbXfkrbVjHm7SGqRysFGtGMk6ClRN4vR2FGNyTjmk9nxMJcOyq9DvPUz4rDaxSpFfcCemeMmh+M6wL7itmsQRChXCYIyAwneBOybczZYbsMzVD9nOX2j7MuRZ0nT+4OhBi17/alhSiPjfSnB3FDmpO0TYSmUeQabaxNjGtvMFnkUGnZqSbPqfo4uvWTkaVJDusreAgwifQmYjG7IDOrljeCaqsd0LEpJrOrRPwkkrTE8gAM3A/KiLt3JwKwKe7+USSdiJ6risMYlRKlWAkUog24BWx5c68jHc1lH9ScVtV0Ytl3EaTsiPUXfG6On1oWadRJfOMRT8rdr5EnqUglz77VYz31stn4GC4eV6KgxVkpFgIhez8mfiGMlxPj7rEm9KYAucvbNbaur/8lV259LykpJzADWo/TP+bbiVEHD8gcw4muP5FAvxcnrnQ+jz1FKOpW+BY+lALRp/KjMk+ZbqFazc/2YmmsW9YGhcgo0Gn8N2rpSQorq93hvYZsnYM6l+kLAoR7WHZeLyc0fbaUzg9wuPaUUA1vPg47GMhqQsefwO3JveyJXz/0MAQv+ctahWM8gm4QArX1/Q02FfCRru2iA9HOC7GpOH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EMiLU9797k1cMWvsVPHMbXJHlOzPRJHYIK/q9YI9XZrLWv1vFHr8pXN3YXk0GiC3njgvoXAsktbbPY1qre4BXBzjddT1Ea/8JSESXPONZXQQw5Xnm/jKhlFXKYfIA4F99AOQPEx+sqOuqChOXtBmJV3qc1OYhifWVUol8+FyHq5MJG2P5X1WCIzpU98760QSf6buAv3f/lbxZBdgeVkz0KXwSLg1NsUo2dG9poU3m9xnA5i1cpeKNPQd0SHJFePA+mvUyi5zdKM18T/IV1GrfqyzNaIBRgoQnaqdmZQzGunQM6qVq6qEr5wAFk3FBFrAyFs66IIPU7NxLZOMirjHop/+QO2gT7JBImE9PHUA3zNu+gZwX5H0PjJA/Dp0VRxEZnf3p1GgK8JHOJWRkPZdnSCvcYC9ClDJfrUZ2e+2TpbNu5/ibYN61gHDoQGSlWT1U8+yiS/uoKqxJ4P52YBCKHTU/iVh1X2pPx4o0aMLr1I9vJeOlfe8mWdUCyMAjaIUkIrYVlCRjfRYIwo6mxAegVPvjBeRMml7t1PHeoH8PfsEPI561tYErD6Hv9TKcDa65tNZEpG4onNeI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4955c924-a433-4bb9-734a-08dc4df2b755 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:23.4579 (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: 3H+4mqWZqzRbKoypjIxa3YM5PR5Bg6gBJJzyAM5m1ThgtKkHB4AOFesk5c799nAb5SywFMXTCn8xm43MzPp2xjzEwRWw1Y0JVgXSiJXKW50= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-ORIG-GUID: m15JDkkG0vi_zWnqidax7KHzvOCJPeiz X-Proofpoint-GUID: m15JDkkG0vi_zWnqidax7KHzvOCJPeiz From: Long Li commit 7823921887750b39d02e6b44faafdd1cc617c651 upstream. During growfs, if new ag in memory has been initialized, however sb_agcount has not been updated, if an error occurs at this time it will cause perag leaks as follows, these new AGs will not been freed during umount , because of these new AGs are not visible(that is included in mp->m_sb.sb_agcount). unreferenced object 0xffff88810be40200 (size 512): comm "xfs_growfs", pid 857, jiffies 4294909093 hex dump (first 32 bytes): 00 c0 c1 05 81 88 ff ff 04 00 00 00 00 00 00 00 ................ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc 381741e2): [] __kmalloc+0x386/0x4f0 [] kmem_alloc+0xb5/0x2f0 [] xfs_initialize_perag+0xc5/0x810 [] xfs_growfs_data+0x9bc/0xbc0 [] xfs_file_ioctl+0x5fe/0x14d0 [] __x64_sys_ioctl+0x144/0x1c0 [] do_syscall_64+0x3f/0xe0 [] entry_SYSCALL_64_after_hwframe+0x62/0x6a unreferenced object 0xffff88810be40800 (size 512): comm "xfs_growfs", pid 857, jiffies 4294909093 hex dump (first 32 bytes): 20 00 00 00 00 00 00 00 57 ef be dc 00 00 00 00 .......W....... 10 08 e4 0b 81 88 ff ff 10 08 e4 0b 81 88 ff ff ................ backtrace (crc bde50e2d): [] __kmalloc_node+0x3da/0x540 [] kvmalloc_node+0x99/0x160 [] bucket_table_alloc.isra.0+0x5f/0x400 [] rhashtable_init+0x405/0x760 [] xfs_initialize_perag+0x3a3/0x810 [] xfs_growfs_data+0x9bc/0xbc0 [] xfs_file_ioctl+0x5fe/0x14d0 [] __x64_sys_ioctl+0x144/0x1c0 [] do_syscall_64+0x3f/0xe0 [] entry_SYSCALL_64_after_hwframe+0x62/0x6a Factor out xfs_free_unused_perag_range() from xfs_initialize_perag(), used for freeing unused perag within a specified range in error handling, included in the error path of the growfs failure. Fixes: 1c1c6ebcf528 ("xfs: Replace per-ag array with a radix tree") Signed-off-by: Long Li Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_ag.c | 36 ++++++++++++++++++++++++++---------- fs/xfs/libxfs/xfs_ag.h | 2 ++ fs/xfs/xfs_fsops.c | 5 ++++- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c index cc10a3ca052f..18d9bb2ebe8e 100644 --- a/fs/xfs/libxfs/xfs_ag.c +++ b/fs/xfs/libxfs/xfs_ag.c @@ -332,6 +332,31 @@ xfs_agino_range( return __xfs_agino_range(mp, xfs_ag_block_count(mp, agno), first, last); } +/* + * Free perag within the specified AG range, it is only used to free unused + * perags under the error handling path. + */ +void +xfs_free_unused_perag_range( + struct xfs_mount *mp, + xfs_agnumber_t agstart, + xfs_agnumber_t agend) +{ + struct xfs_perag *pag; + xfs_agnumber_t index; + + for (index = agstart; index < agend; index++) { + spin_lock(&mp->m_perag_lock); + pag = radix_tree_delete(&mp->m_perag_tree, index); + spin_unlock(&mp->m_perag_lock); + if (!pag) + break; + xfs_buf_hash_destroy(pag); + xfs_defer_drain_free(&pag->pag_intents_drain); + kmem_free(pag); + } +} + int xfs_initialize_perag( struct xfs_mount *mp, @@ -431,16 +456,7 @@ xfs_initialize_perag( kmem_free(pag); out_unwind_new_pags: /* unwind any prior newly initialized pags */ - for (index = first_initialised; index < agcount; index++) { - spin_lock(&mp->m_perag_lock); - pag = radix_tree_delete(&mp->m_perag_tree, index); - spin_unlock(&mp->m_perag_lock); - if (!pag) - break; - xfs_buf_hash_destroy(pag); - xfs_defer_drain_free(&pag->pag_intents_drain); - kmem_free(pag); - } + xfs_free_unused_perag_range(mp, first_initialised, agcount); return error; } diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h index 2e0aef87d633..40d7b6427afb 100644 --- a/fs/xfs/libxfs/xfs_ag.h +++ b/fs/xfs/libxfs/xfs_ag.h @@ -133,6 +133,8 @@ __XFS_AG_OPSTATE(prefers_metadata, PREFERS_METADATA) __XFS_AG_OPSTATE(allows_inodes, ALLOWS_INODES) __XFS_AG_OPSTATE(agfl_needs_reset, AGFL_NEEDS_RESET) +void xfs_free_unused_perag_range(struct xfs_mount *mp, xfs_agnumber_t agstart, + xfs_agnumber_t agend); int xfs_initialize_perag(struct xfs_mount *mp, xfs_agnumber_t agcount, xfs_rfsblock_t dcount, xfs_agnumber_t *maxagi); int xfs_initialize_perag_data(struct xfs_mount *mp, xfs_agnumber_t agno); diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 80811d16dde0..c3f0e3cae87e 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -157,7 +157,7 @@ xfs_growfs_data_private( error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, -delta, 0, 0, &tp); if (error) - return error; + goto out_free_unused_perag; last_pag = xfs_perag_get(mp, oagcount - 1); if (delta > 0) { @@ -231,6 +231,9 @@ xfs_growfs_data_private( out_trans_cancel: xfs_trans_cancel(tp); +out_free_unused_perag: + if (nagcount > oagcount) + xfs_free_unused_perag_range(mp, oagcount, nagcount); return error; } From patchwork Wed Mar 27 00:12:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605379 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 B7426F9F7; Wed, 27 Mar 2024 00:13:28 +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=1711498410; cv=fail; b=g86ZzF4kolmBg0ALAaWJkvKcaf+PXKGT8r72tLkoozshko44iVBcsAYoHGt4UTOOH648M+XL8Z8FZVmfSQ1DhixhYw9ctrfLP7oFJ8cYlgH+IzR4/BxNQTkQPk8kI9ft8CStTB4+nZI9Ppex5EzKbrkNdpMWFy+F780tEfUKaG8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498410; c=relaxed/simple; bh=Xl3ij5vj3g3Xvjy7TGZDZkQlBo9UhYgvTFd6VlkgLnE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OfO2Yk2eTaGUpxbfcFdL9P5Xe1xR/RS6Q3/C2oS3PpQO++7OoYKxTiEz/Wu4w4Hm2kIezqGLB2Qv5MP2HW93H17OjvAN2gmq953u2tft0p69lrZMD505SwAv/w7qqkiTSPGg+J1i1wSvn2U/dtshsWStIiAS5dg9G7+o7O1O/8Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=OQEvAzIZ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=WAnKhBQG; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="OQEvAzIZ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="WAnKhBQG" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLhvna019967; Wed, 27 Mar 2024 00:13:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=s3+xY8r6U2UecYNiU8JL03T8NpVxJvCwudKQnnJJ3Lc=; b=OQEvAzIZRvT9Af5DYG8YnMdvagY/biSufetaHc2jnFymmQlSNe2w5GDYWlQ5csIF1tde rwdcLPZGWsPnywEc7UmwOm/+8aFMwYG0TaY42x8pzmvEaV2LWGeMVuDYjmV3+ZnsRvKU FKED5hjbUfXdpwCBdC+PRyWlPk4VQXxPSs10hqVDhO689UdTEzwp50uo1fXel5UuuCq8 s6WpEokxt/VXYCH8g9dgSGxNt5dM2lz9X/Z43P810UxefHXNbVu+U+wO6WNWQ17srqQb EWYi43oQ2DGw4kStb7ZbnCQEKM8OA4zKUpgmHouPkqZJSN679tMtdRN5Gfo3jlfE1zoB GQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1nv46adb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:27 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R00j6a012418; Wed, 27 Mar 2024 00:13:27 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1rpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DsyVTLKkzhTS/aG+4D0bO6HK+ABu0kUjghPg0sHIs5f8Lw881zEeL+H0JRJdxeEdVu+lPULsDxUzv0yghfALTmSdicq0R/5uglw1qZUbT65LRNSVMlyTztIcxD/g1Nmh8io9kMNkVpahxKzF3nPQg0NE9bQqMn7dlp0lMqDldabfcYHse3dCyzWLELlnBKp2VgSAF8FVMBIGoCc6SkdI6WhOn44dauaetTWOtX8lW1vdVziZK0NzjEwOrhXEPXKc0pHh+Vwmm+hErP4CAk4e/KA1E9gEwL8dqv1dna+4eotjqxlQ0Uc0O5hXCtEvCWhm7F13+3GVl7rCqDIU6/Zoaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=s3+xY8r6U2UecYNiU8JL03T8NpVxJvCwudKQnnJJ3Lc=; b=RzMHtxAvxQCdxxhsmhYE5Kfrw9EpV8JHfwvo7L9y9E70iSua4n1cMYdMIcmB3FJUI1qCeDFbrdImMlPXNqA5jPrdbqus79vtj/8GGX6a7zz+pZ+pdFYQepiO04/9We8EiIonRjkKVWbwCwnbHO7iEbNl+Al7N1id8qAkbMCIK9eQ6LTCp6RVuRkIXaenexiH608tgEkI719qCu8c7Ybq4XpR2+KtBySNOYWdg1jZmaVYXdSG1JjK+F17M46jqCqSin5v+aQCsMSq4n/vgmsmPBnvyzseI5E6DyXBipYRQUNu4iAJnp+FRj0Y2/ZBODc/MFGsk3mtq/EqssYYjiZGuA== 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=s3+xY8r6U2UecYNiU8JL03T8NpVxJvCwudKQnnJJ3Lc=; b=WAnKhBQG7rOpSXFiDieDiqqLnkZyy+rIQzmonY2REP1lFNzy5cGm4mg1QB/8Rwt4gp9QurdAPCyeIr2zBJsH+keSeH0aFRJMq5s57ZOv/xSGx78adHoI3/CAF+lk1qdwdabhfejVy6LjCBjoYdQfxG0tRsai9fBkHnibMn4+sHY= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:25 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:25 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 21/24] xfs: ensure logflagsp is initialized in xfs_bmap_del_extent_real Date: Tue, 26 Mar 2024 17:12:30 -0700 Message-Id: <20240327001233.51675-22-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: SJ0PR13CA0208.namprd13.prod.outlook.com (2603:10b6:a03:2c3::33) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jrpE6S+mZ1+E8VAP4zj5L2XHt2YfT7KgCtVIbZtuQWD+otjlUUI3ncWyaiBJDNsBQ/TKGSd4cfZWMpc9YIsbRaQhvnSa/YC5PR0pszn8wyEg684e1oODz3jJkYTQ0XAvpWe8EXXViWUVT9lTvw1FMoYWdEFGNzDcaBZju18c1DBApzSPkDkz3SN0Cx+9zdvJSh3eqtId/8Ch4ZHqQL2K+dzqQYXVwjkcJ7+Kp3nBzOcIfbAeJ2gMu6ZTQPJiqSrYKCndg/TtEzLbSjiVQ7S0cz/YeMCdjnsx7mk3aItSR4KFOLeODqpNfP2TNo8zYiOhvovjotgQk7wkyVOdoX3Pefaj+/brNRlDpyHG5rP5WmRxnmMJO9SWf2IDAN/xlvAoSIJ+joWb0M+Dy2JtkDjpyecECtqs/tL3ZaZoQEAO7htOWbJuWPu/Cvqg4aKr0KXIUjdEqcmIFsjJws6+2tCyVihlipFqPuHqKHTI68rhHObaEHmbIA5CbJEl+xuhz6pFqt2RVBo4DjhOAYINcQCb9eUfWaJnJXUiENQf8C1Zz2UPhoyFDiPe2rjcGI0xNDU5WPNUcyhotI4kPHIbfb5Z5IbwlRI84pkXL29nfjs4V3p3UxmvWmHmehXh8xG9WxCOG8JeThwQZyEnLWQjUpXr4VwYGZu4dGdjOeR9QeH1g7Y= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7alLr2lNjCRxDR+TqAG31SG6CAD+/r9A1gqJEU89HWu057neQ9BfCJPAljxBteUOKGxKKVGFCPLTUfK4gCaTPKh1rFKcGmDP3E+QnuH9EnEPcoItBWsXDgumTZNCkX8T4UOi6n6fEAlFMtx4LrBzixr8eY+lwd8E8BryaSi9NtFg695s7qXdtXIrAZjxH2K2G+uIPzQEcFX/UAvwzAt9UBlx8AMA3HttgTw76xnEhk+q5nxe6x9WVNMF83K3OuL8ayAhI83FW/XelncJhv8UUHzA6Y6B/29ZwMwmul1QGFxSR7+YvdPvHLaJWt9O/xYs5ROLhSynQ/MG5yjy73WSzSR4UpfODrfc5S7+NApZATlNzIZ/XSnHhqxFRKh3ajrif78OT2tRrTGbQKaaplEA0l4kqWrbWQtWcOtkbnzqqER7tOprOZz7KQY0HXmiMG9EafxQhdy3QduG7CFIW1oZ0BjbeAf2R+ggj57HU54G+5XTUEmRI2cVxNQRDaiShb4tFdWGFKqLkVKp1Li/3pH424JncC9D5pA7oEEq9HjV6QNAp6rlu1HBVURDIQRcoT5p5IJUpn8VVZVGWN+L/445gUfRiE2QXBMDj07hj7cEHAD1hfEhY17qGXQPf8im3QK9USEKbYaQtQVzI8K0MacX5zcEMl17Jgtyujs+03VBaiEFnu+8480OU3YMVgBgWkkMoc1MtSEptN4s/yijAe65VBePNEuU3JjIuO5Mtgwjb2gDy0T3sCEocrtY3/YxAAUTwCMaD5Q9o+P+GdrxlIUunv3I1j5bktpOHbvJDhw2aYAcq9FWY3baSQP/3kKJCDbPOX6Q/RBRj97NdFRKNHdgTH08ICs6cO11gv9r93ytl3gTBDG8IWStPIyYgOETZaqwoDx0mnDSqrIXa4aFWW+Vg8VbbFjFTPsdtrB+8+b38udQyy1KyMmQKoSZlDVJJX8OLJ2yOwKO1T6hASMkG2GmThENVoEt64sm6URZSZRa3fC19xIHZ/weR9CRSSTOx8bosA7FXro+lpI1qKlnVSDjMyVHYbfzEpFryeyj4IDB3eA/ClUPEl+IxTu9cst4L7IIej1TDE5qTC+MP3n1l4JJb8qX6UaBlK2p0uz9c6MzjNik3d2L988npydy5Q6bLSt3v2r3W/rWt4hYtVt89zFjgw1W+A8YSY3iJA64GhzasrHYSymeuBzPlQisKyTgVDKOl0WR97DbLVNJyPy/0CswmbkxWHXk6fAadzGN8+DMbwvPBbK/X/qL/DuZpfzhchfzl1/C6tyJvBCfki+jIANEm6lU7euZRmKbzU+ArBFq0iRyczopT/RBl6hndGs3ro/PVyZOgwF9Odu4mB2kRdNtE/eC+ekptcj00hZHgFr3f+hspNzs9ZriUSXXR7Ek66ryrS5Pu356IXKAHlMwTUCDyrHNJug8lkpQIyFOov/MROk+r3laYF1pZgAcR9/G0Uv+ofO93osHgrGx1RbR8d+JEqUn+J2KQWrQeJwtnExUB2RxjE+5mV8TvvxP7skdhS032m9KW9fHrLajMwLMfoavFf17MBOWyqoArm6f8vHtoTPTx5sUP9WHNEWAVz1cJJbxZq88SPx0pd6W6D1Utr91ncbC4sMoL9CztkjSkKN+Mj/JMfHJWYMvItXHsPv0u8lBVjHh8Uvgl3lWAFtPzPZauA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: C7opM6U8LRaK/RHFhe2Mk92gtau+uvOWT833Q6iJmUAMRG1SEmjEtrt2HAsNajTj0tpolvBBI7NU9wAUtpOOnt6NpOs7AneNyOBHJN/j/BX+hC1fGzCBvrOWMiy+O5mreUKi28gGwx1IhrsHBDwUI9N8JDjsNn0V7cZMnttdNvFbF2+Q3GZb6Ht6soigl3GDNk6Kt79jI3CZzGG4opSJwcUUemZUcPx0vYOYA362bk/AycNiY4Ayv1JIfMoZqpZuCC/3JMPz1OcrIheoKFCA8m/mLf/FchQHl7V4xBr7k9DB49/dmoN6SfmsxqvR9R3hA7X/c9bIIGxS73hrSAVUXX+FHJpmWPz7eXeKUhy0r6eFpia9TGjo8cRbBymzrwIuWbCLJ+P9Z9NtQ2iIAubZ7Yj77Lyh8JIqmRVZZTezz9RRq3oMJY9LW98+OsfuZwvRbIgLpT8landwPZT9IqyfT9qfIxSbzQzZUcZj2XzffBy1y0KKvbzoYoehOz1pkENILPFoYwDXsfuxyh+YMUTd6jdaCvKMoL21LoL+O08qin+mJu2o7Eysfc7r/LCbJPpyFdDwjMiZlfYRR++pCthE900+kl4LNkhyE4UcOgU8ow4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8d3e2b2-89c6-4e21-0687-08dc4df2b899 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:25.5666 (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: Vm4Ub/cCa2Ow/gVWk5szcwnPY4/mIN/kHeY6M/Y+SCO//Uf92zu8SOlU2PM/F30DVjEikrBR++2fDBmdUWSUcMBbah8RX35S6QIauB84nso= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-ORIG-GUID: sN2zaCGeRBpqid1rTKvs98tcmustxNOU X-Proofpoint-GUID: sN2zaCGeRBpqid1rTKvs98tcmustxNOU From: Jiachen Zhang commit e6af9c98cbf0164a619d95572136bfb54d482dd6 upstream. In the case of returning -ENOSPC, ensure logflagsp is initialized by 0. Otherwise the caller __xfs_bunmapi will set uninitialized illegal tmp_logflags value into xfs log, which might cause unpredictable error in the log recovery procedure. Also, remove the flags variable and set the *logflagsp directly, so that the code should be more robust in the long run. Fixes: 1b24b633aafe ("xfs: move some more code into xfs_bmap_del_extent_real") Signed-off-by: Jiachen Zhang Reviewed-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 73 +++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index a47da8d3d1bc..48f0d0698ec4 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5014,7 +5014,6 @@ xfs_bmap_del_extent_real( xfs_fileoff_t del_endoff; /* first offset past del */ int do_fx; /* free extent at end of routine */ int error; /* error return value */ - int flags = 0;/* inode logging flags */ struct xfs_bmbt_irec got; /* current extent entry */ xfs_fileoff_t got_endoff; /* first offset past got */ int i; /* temp state */ @@ -5027,6 +5026,8 @@ xfs_bmap_del_extent_real( uint32_t state = xfs_bmap_fork_to_state(whichfork); struct xfs_bmbt_irec old; + *logflagsp = 0; + mp = ip->i_mount; XFS_STATS_INC(mp, xs_del_exlist); @@ -5039,7 +5040,6 @@ xfs_bmap_del_extent_real( ASSERT(got_endoff >= del_endoff); ASSERT(!isnullstartblock(got.br_startblock)); qfield = 0; - error = 0; /* * If it's the case where the directory code is running with no block @@ -5055,13 +5055,13 @@ xfs_bmap_del_extent_real( del->br_startoff > got.br_startoff && del_endoff < got_endoff) return -ENOSPC; - flags = XFS_ILOG_CORE; + *logflagsp = XFS_ILOG_CORE; if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) { if (!(bflags & XFS_BMAPI_REMAP)) { error = xfs_rtfree_blocks(tp, del->br_startblock, del->br_blockcount); if (error) - goto done; + return error; } do_fx = 0; @@ -5076,11 +5076,9 @@ xfs_bmap_del_extent_real( if (cur) { error = xfs_bmbt_lookup_eq(cur, &got, &i); if (error) - goto done; - if (XFS_IS_CORRUPT(mp, i != 1)) { - error = -EFSCORRUPTED; - goto done; - } + return error; + if (XFS_IS_CORRUPT(mp, i != 1)) + return -EFSCORRUPTED; } if (got.br_startoff == del->br_startoff) @@ -5097,17 +5095,15 @@ xfs_bmap_del_extent_real( xfs_iext_prev(ifp, icur); ifp->if_nextents--; - flags |= XFS_ILOG_CORE; + *logflagsp |= XFS_ILOG_CORE; if (!cur) { - flags |= xfs_ilog_fext(whichfork); + *logflagsp |= xfs_ilog_fext(whichfork); break; } if ((error = xfs_btree_delete(cur, &i))) - goto done; - if (XFS_IS_CORRUPT(mp, i != 1)) { - error = -EFSCORRUPTED; - goto done; - } + return error; + if (XFS_IS_CORRUPT(mp, i != 1)) + return -EFSCORRUPTED; break; case BMAP_LEFT_FILLING: /* @@ -5118,12 +5114,12 @@ xfs_bmap_del_extent_real( got.br_blockcount -= del->br_blockcount; xfs_iext_update_extent(ip, state, icur, &got); if (!cur) { - flags |= xfs_ilog_fext(whichfork); + *logflagsp |= xfs_ilog_fext(whichfork); break; } error = xfs_bmbt_update(cur, &got); if (error) - goto done; + return error; break; case BMAP_RIGHT_FILLING: /* @@ -5132,12 +5128,12 @@ xfs_bmap_del_extent_real( got.br_blockcount -= del->br_blockcount; xfs_iext_update_extent(ip, state, icur, &got); if (!cur) { - flags |= xfs_ilog_fext(whichfork); + *logflagsp |= xfs_ilog_fext(whichfork); break; } error = xfs_bmbt_update(cur, &got); if (error) - goto done; + return error; break; case 0: /* @@ -5154,18 +5150,18 @@ xfs_bmap_del_extent_real( new.br_state = got.br_state; new.br_startblock = del_endblock; - flags |= XFS_ILOG_CORE; + *logflagsp |= XFS_ILOG_CORE; if (cur) { error = xfs_bmbt_update(cur, &got); if (error) - goto done; + return error; error = xfs_btree_increment(cur, 0, &i); if (error) - goto done; + return error; cur->bc_rec.b = new; error = xfs_btree_insert(cur, &i); if (error && error != -ENOSPC) - goto done; + return error; /* * If get no-space back from btree insert, it tried a * split, and we have a zero block reservation. Fix up @@ -5178,33 +5174,28 @@ xfs_bmap_del_extent_real( */ error = xfs_bmbt_lookup_eq(cur, &got, &i); if (error) - goto done; - if (XFS_IS_CORRUPT(mp, i != 1)) { - error = -EFSCORRUPTED; - goto done; - } + return error; + if (XFS_IS_CORRUPT(mp, i != 1)) + return -EFSCORRUPTED; /* * Update the btree record back * to the original value. */ error = xfs_bmbt_update(cur, &old); if (error) - goto done; + return error; /* * Reset the extent record back * to the original value. */ xfs_iext_update_extent(ip, state, icur, &old); - flags = 0; - error = -ENOSPC; - goto done; - } - if (XFS_IS_CORRUPT(mp, i != 1)) { - error = -EFSCORRUPTED; - goto done; + *logflagsp = 0; + return -ENOSPC; } + if (XFS_IS_CORRUPT(mp, i != 1)) + return -EFSCORRUPTED; } else - flags |= xfs_ilog_fext(whichfork); + *logflagsp |= xfs_ilog_fext(whichfork); ifp->if_nextents++; xfs_iext_next(ifp, icur); @@ -5228,7 +5219,7 @@ xfs_bmap_del_extent_real( ((bflags & XFS_BMAPI_NODISCARD) || del->br_state == XFS_EXT_UNWRITTEN)); if (error) - goto done; + return error; } } @@ -5243,9 +5234,7 @@ xfs_bmap_del_extent_real( if (qfield && !(bflags & XFS_BMAPI_REMAP)) xfs_trans_mod_dquot_byino(tp, ip, qfield, (long)-nblks); -done: - *logflagsp = flags; - return error; + return 0; } /* From patchwork Wed Mar 27 00:12:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605380 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 587521862C; Wed, 27 Mar 2024 00:13:30 +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=1711498412; cv=fail; b=EibleH1QP7XXtDYg8csvYNdzn5uG/BcdETSnuerEWkIjs1NYTaH32mB7N2sevEETHkBCeKbK8/R1BiowAUh8V/3zy2VHybwhDoanQUVIgX2OhDHHwuqXH2OiPC0yrI9IfjBFSIbWjIQwvR9fgDklHTsWAfj+x7+RQHEUYH3PD5w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498412; c=relaxed/simple; bh=ZB7qmNHpM2d03f4PdkrfVw7MMqvcWLEObr2pVYN9tEE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=G9XRPy5bluhZkFvd/TrF0IDJJqMbEbmk8/ibJQJ4b3hLuIxOrMi1vbCCMwHdZvbI8EWhaTklRd+i883oGOmyoJmnDXzie/zpsXbBNjLFd/BXTMtH9RL5cft9QizLnTK0D56dKc5yflpK5k49kaNKNJBZz5td7cCiYkcM5A1q14E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=DFCtQBFQ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=MAwmJV3z; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="DFCtQBFQ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="MAwmJV3z" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLi0x2016402; Wed, 27 Mar 2024 00:13:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=oUIOBPXVpYmMiyAjrGQYd8msJuP/7MfVTju1/Np5+UA=; b=DFCtQBFQ2uKum9y7Kanjs40ggXeq3h0uAQw5LJn+p2CFqymRQA27RSNvhH0uh8FKkNCJ KEukZL+sy/nFfGggN2DlQTMDOVCA3vwZeo4lprRrxsxg/8SAzUWF7hxzVVBTxJeLWy0L qrz4Bwdk7YhWcpXLciL0pXHk6CtoomU4ZU2P3BcRIrbWbGgcGAAlD3rxGzOXqAYsI1as 7eDt/SXoXh3kkJ2JD7FAW6lfxiaRsoKc3X7lpJ5C3sodBZzi0fvZhB3YARInATmczyIm U1vk4NcHx7EW7NbnCRHek3OR4gNErR0oODSQwVxahj0VKJ+UyjOgNOFVAbSPTAtl/yeX ug== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1q4dxc0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:29 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R03jNq012586; Wed, 27 Mar 2024 00:13:28 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nhe1rqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OsgyUAtOkPW15/xO23Hf6oScUpQgQSwswfl1e+wxZ4YjRnOHfjhzosveyQbteWLp0cuM0rwmyvmx+wkqaPrUV22Hkta+VyH2LQAJ0YuxB/rUr+0tXfW5j64kpDbwEXGAPsYJx6g7k/92s7cZEftgjmZbHGKE2ye2DP3qM0wl9tNICBuoTdSKQQk3HxfaVGGiJJQR/PM6kw5s3bEV4Eyv5b4CoQSeTi4plkZS0kO+hPff41TNYFne6pnte64o/DWvf75xI85iOd1IxLLy24W0CinLJAcUsQEu2+fuRyc0WfxUGLWKozZwKZpBEdBTLaWPi8ofoKJ5UGEBGdIOn5OGpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=oUIOBPXVpYmMiyAjrGQYd8msJuP/7MfVTju1/Np5+UA=; b=cvqh/b1gVsN4SAyKAIPtSDe3BwQiebgoMEGezAwMKAGfaaLdtZnGoNENq7sghG5i2Hll8PHolGv38UXzyj2up2WGV9CSZfW2LhPmaqcnD59s4HnNad6zwjBU2FDxmzLAgMRN5NjFWcFIuWSf+/itdx5ospQ4FMyYM3+6Eg6Gw6Mxw80pruyjUwXIcTuMsdVkzbPc+lXTaJDZMqqRisUYo3S+e1oTue/wPj/WfBWGkyg8rXJtdEZlWqiLtXHRVyiNjpLjLcfR5p1dOyteu8eEtZH/lLyKrM3ump6D9Q+Xof0ugaXfgMA0UT24G5ggUWhhxmaaiJAvaOsJN6j4FS1MPA== 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=oUIOBPXVpYmMiyAjrGQYd8msJuP/7MfVTju1/Np5+UA=; b=MAwmJV3z92qaQtzeMcA6qradXcO2NW6iBw/P4nk0sF2ncNmMDEtc2GawFpHucl2VSHsBBsfahYRe/hLVZCImZpeG6vOsXoiqaPevdAqMH3HSmGPNfDa+EYcjZ0m7QXnfERh3ppHRGLATcVS5RWbyYeEJhT1fXHA209TrrXflMUY= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:27 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:27 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 22/24] xfs: update dir3 leaf block metadata after swap Date: Tue, 26 Mar 2024 17:12:31 -0700 Message-Id: <20240327001233.51675-23-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: SJ0PR13CA0190.namprd13.prod.outlook.com (2603:10b6:a03:2c3::15) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B3l+1i3NzP88NCirNToaWjMADpfQ/P6/T782aP2wEJbdLECJgorWU67PUr8PoXKodxRz54e+bbw67fczZ2hROzES/kVoOKTqQ4dwM2LLn/+NqygiK2mJLJto0FwTU66SsDwZBmH/jLzHoi/q2RfajLZkI6Jx21E8RunBRcNYRz00m56q+qhEdIZuVlj7nsdvR4/ZQ9aba+Xy7D8zUJBqHmV6twzcJIMKhEnhT+UPmjClk7AAa9iyMOzALF6QlOHS0gRnpLkBqMw0eK8L4im7BsJy+Uqo972mhy6UFAHzzs33ANaEDjKcFGkOajUmKihgo2Lb7wyi+PheX8zBhQA4o/qWa8r8Xfd6TRoqruGaJS7AT5kAftuIV/QRI/1QM4Laz6bCCyrOrL/B30mGwYsXAW9o/0lwpo2MNqT0DrfZsufwrEN5mMOLygC8L8y2NnN2a7iIPB2Up840SsIUmg5+pxvJUrwAlnJlH3IzNSaOUlGzBQD7eCy2M16zGm4sqpKpUyIWanbH5yU0pfksYRVw/xKMERXgsGX0y26wnYPSG1iXQtOuDFtB8YLfiRv6YhRCfAWognI/oUkFaFjOLhsKvNow6ofl6F/gYYkbHSKAP17+9OWvo1bOzYA3tiRbtFYDwCg2msLBfO9GDq045HJy3YCgkKn9Eb0YtmrfdXrvGu0= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LjWfx0EG3zxcRZj1RDnIYQJKjIjwsZxvm8tXYpuNxzhBrwBVP1fNTaW3avxuVocnDi7uEBiR8Eo6sY7V+gJbR+6PURGaetMshNYtIeMaRWI8Fv8yR8Q9JLqpLhqW0AINM2Mr+9q15DRPkg7kItqbno3LlUqxld+pZCvavJPCepwmSfrkzNIgLkLLWK3mdfiNMnGk0rTcO1G6QwMzJrgjuqVF6sKarudoWqSDXbnNSTUeM1G0SN7XAJOYCPiKKmSrqx+8vNSCzLAfWAaaXgWayvF9fbSbAoASHUskA8b+ZdXv2VStd88ZF5KRgnA5aRyLuGCMDdlnVpO7KqI0ENQycsRl5vJGS+VOvH8qqetyckutWLqBHcAShnzww59Nq+OTlTc2uyKxrSjyICeJbhpILervC2eU8pqWPpcdNGXOJzPabYZevJX2jJpH3EvEEanJmVYlJ+GMpvTYT1HlXT6Y4JBXOilA7aiAQ32E7Za+0da57qncKsobKklnX89p5tynR5TUO04+07QVr+we8niiz0K71cBL395/CnoPLKxWm/CmLCR29ki3nC0YbhxghD9gusfVNz7RXHT5GZJK5uxjuXHR575SI4gZLNECbqgdZLZFaHHn1UgoBG/+uY4aSgOgbV29DNsLY6AuRdDeEBgWekRVlQv0ygd/sagnhXjP0k4IXIu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OEkP9emdAk62lvPb/YD+G5SOCnA3G4W0X3TdlJ2dRDz803mwBAlfxAXt3R1R0jHAqlpq57cEkHKSjKuFYwiLSuVcseBQNAdlM3iUBzkQqLrc6m5YFsUdSkYfpw9puymNmEViNn6P9bz6KWLX3EEjmFSF/1M/KhSDK1csd+RmSrJ51zhNLM8JIETfh9oyq7S7lCOJfg3femQtCML3to22cV+l/MfuIqmPVoX6EnmSDEZsQu1TcHJU3hYDDegY/Nc9b8I+bKHtNGraAIjs3LeMwg/i27u6RKoKrNAz9gbjMmHbfdSPKlqJKN/MMHAYh6rRsI/S4KSoyLmGteoYR0UcR8cVebC3NOp/qh67QVIphEth7BRqMyn44m4wHhONHoeNi7jks0uUKIQSyEXznVDpYSPp63grSzUESkBNYm0X7ucbPL2NbwSXHRu9tKUtDBVgzBX3Z9LXdA2u8SZ3btMcN4Pn9qr8jXdz7Wok0o2qd/LF97uzu0kw5zrwOwEakSuhlYV1gMUE4nQG0xpD/2hKuUXcFuDZMzIC1JnsjRBIWJy86aOEn4oyXmDV9NZgDluRDsFSDOcbeWvj11N+hUHvKF3FP8u/2GIthW3v5c= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5321339-0004-43c9-a164-08dc4df2b98f X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:27.1889 (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: m/Q63JX+aN6r6lcwYQ8eXu563l4YMn9yM5cNMMcpODbWyq8Vo5hc2zcGQZyLk6yEbJZA+D6UWslR2YSbq/3EhY5tq4Vflg/x1V11F4Hh7hc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-ORIG-GUID: GIsycQ1vWkvP0qBekVrS_8QJCZcmFmes X-Proofpoint-GUID: GIsycQ1vWkvP0qBekVrS_8QJCZcmFmes From: Zhang Tianci commit 5759aa4f956034b289b0ae2c99daddfc775442e1 upstream. xfs_da3_swap_lastblock() copy the last block content to the dead block, but do not update the metadata in it. We need update some metadata for some kinds of type block, such as dir3 leafn block records its blkno, we shall update it to the dead block blkno. Otherwise, before write the xfs_buf to disk, the verify_write() will fail in blk_hdr->blkno != xfs_buf->b_bn, then xfs will be shutdown. We will get this warning: XFS (dm-0): Metadata corruption detected at xfs_dir3_leaf_verify+0xa8/0xe0 [xfs], xfs_dir3_leafn block 0x178 XFS (dm-0): Unmount and run xfs_repair XFS (dm-0): First 128 bytes of corrupted metadata buffer: 00000000e80f1917: 00 80 00 0b 00 80 00 07 3d ff 00 00 00 00 00 00 ........=....... 000000009604c005: 00 00 00 00 00 00 01 a0 00 00 00 00 00 00 00 00 ................ 000000006b6fb2bf: e4 44 e3 97 b5 64 44 41 8b 84 60 0e 50 43 d9 bf .D...dDA..`.PC.. 00000000678978a2: 00 00 00 00 00 00 00 83 01 73 00 93 00 00 00 00 .........s...... 00000000b28b247c: 99 29 1d 38 00 00 00 00 99 29 1d 40 00 00 00 00 .).8.....).@.... 000000002b2a662c: 99 29 1d 48 00 00 00 00 99 49 11 00 00 00 00 00 .).H.....I...... 00000000ea2ffbb8: 99 49 11 08 00 00 45 25 99 49 11 10 00 00 48 fe .I....E%.I....H. 0000000069e86440: 99 49 11 18 00 00 4c 6b 99 49 11 20 00 00 4d 97 .I....Lk.I. ..M. XFS (dm-0): xfs_do_force_shutdown(0x8) called from line 1423 of file fs/xfs/xfs_buf.c. Return address = 00000000c0ff63c1 XFS (dm-0): Corruption of in-memory data detected. Shutting down filesystem XFS (dm-0): Please umount the filesystem and rectify the problem(s) >From the log above, we know xfs_buf->b_no is 0x178, but the block's hdr record its blkno is 0x1a0. Fixes: 24df33b45ecf ("xfs: add CRC checking to dir2 leaf blocks") Signed-off-by: Zhang Tianci Suggested-by: Dave Chinner Reviewed-by: "Darrick J. Wong" Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_da_btree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index e576560b46e9..282c7cf032f4 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -2316,10 +2316,17 @@ xfs_da3_swap_lastblock( return error; /* * Copy the last block into the dead buffer and log it. + * On CRC-enabled file systems, also update the stamped in blkno. */ memcpy(dead_buf->b_addr, last_buf->b_addr, args->geo->blksize); + if (xfs_has_crc(mp)) { + struct xfs_da3_blkinfo *da3 = dead_buf->b_addr; + + da3->blkno = cpu_to_be64(xfs_buf_daddr(dead_buf)); + } xfs_trans_log_buf(tp, dead_buf, 0, args->geo->blksize - 1); dead_info = dead_buf->b_addr; + /* * Get values from the moved block. */ From patchwork Wed Mar 27 00:12:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605381 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 911E61C10; Wed, 27 Mar 2024 00:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498416; cv=fail; b=BmCpuQr07T/+4BRp5TIGZvK9TgJ7VVpsbIs4Ril9PgaB8dBrsiCJs505B3mUcWZbHeP+DUF2NREpoIjKesBBrTNhAs7QxzXmIUsjLlPpuNVptQutGh2DByJzviZq2QifMxq7a3nQHO9JEwZ7dDHnKNme2SAs2tv5oskRKr0BrbA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498416; c=relaxed/simple; bh=DNSarES2y5yOecbp6OK7DsfHtlTAV8qg8UT/Ejzq7SA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=N0kMnIpZmNDZEg/MyTCnMHTd7z3oRzR8SR5ZImRJgMFvV50VrdmC0pvDREBdtEFC9pyIeJ++XYQpLYJQY2jqNzRixO+vh+m1EyEp5Kc9ACcFRdG4YrEzh6g16sUgSyCkhjxUdElc6fvdvEd/lQ3HeUdVvs8UrVFiYBbEdngGGB4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=kLacjjiz; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=nioDQq4z; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="kLacjjiz"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="nioDQq4z" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLkkwU021636; Wed, 27 Mar 2024 00:13:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=bShdDwvHsGs2NR3HsXWe6RilurHwTjdSm+vsM7SPlsQ=; b=kLacjjiz9BLuTP1G2QJ5aqF7LMSyqTx3kllZkdl1EBDqBDGCGWuGjucd9bPpoRbGbPW/ 8sCCttzimNOD0sjKTUnxI1DaDPlNkvLmgX5702FYhLeIFZ1E2rLWffxUGlGhs6Khj5Pg WlwUdCbwhnyOZbiGypCm9oCNisLNGOrisn9YDlwaAZOTg5HHkcZ2BdzdxMoJs8OwJBGq fNWZHKJT/Wf5A9b0TUQ1SLvHMQIb9eDbFe0aTYc1h5DoCapuJcAtPe+fuq7rA+wcXt9L Uy7lJYRs4QbxNJu5bBH4kQ4ikDm4QBEp77QFLoCP8ZmED5jWjnBvEJVTFRrc2B5/NlK/ AQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1np2ecc8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:33 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R00VYJ021951; Wed, 27 Mar 2024 00:13:33 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh80xnk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R0e01peIQBf47sTrVxf6y5wgz9P4THFI5xvCRBCKfsFqtmvMUwxPnkd7bjzfmx5lLxtpNKxPq3abXed8WlyRfxqPIXGqC2MtzDLsOxu21SvbJAZzLow388TriOQ6K5SZxlk8C64oiHhltxCtWypEFMl72eeNvybSkkH2kUACOCKt3dCZNK9UStbu2jfXXIRXD7ZRFtcjitW58ihpNo+oOO5zeAGT8L20bPTMlbAcZqebL6x+GP260P9D+dk9Sx3G8OfH/YQP4dn5x2rJKyRbf+J7p2driP/aohOvr4G7VXl+5s5B3JvxVFC4FUhTHXj6RjPwkXi6dx0bF1/+auGFZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=bShdDwvHsGs2NR3HsXWe6RilurHwTjdSm+vsM7SPlsQ=; b=lRcrXsULRV9XeqhnmbsEJtlMVrUdJ3JQfrM4Yk5NOl87mByXAibzpXjEr4moZDacERhXfXgun1KPCibU6uofEOi3ck6w3sLXHgwQFURaqLkddbzzYp5isrb/JwEIDNYwoVrpF7RaD3sDR85/Du/TDEVb4FpQg90+XTC/+p2FsWMxLhOJVQV+mmLl6vrb1VUU8AflUPxFpMrfRUmHcek7bd4zZZyFgNYP9ErnzF7isP1GlnpC2/XzPiMQTrWyv3b5LQ2G/Yslv0wSN7Eo3XigiuH1N/pzNMJlFEBkxqOuW1SA4OrOCVfIQtHNu/iC1p7Fewp0c8aFWd52PB+z8mpwYg== 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=bShdDwvHsGs2NR3HsXWe6RilurHwTjdSm+vsM7SPlsQ=; b=nioDQq4zmO3yU9/69abGLXg3ifGe41ifKoMBBEvBzRoW2Br4uPFOpN6xm7EfAA78qOHCIxwn+unc9XUqzV5g/8D2teCL/KOIPTyfRiTsrC5a7OYTyu1x5lOGVNCTblvbbM7Twvoyj4fH+wuEQCqAviTqMDZhC8oDZYU+mvCsn9s= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:29 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:29 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 23/24] xfs: reset XFS_ATTR_INCOMPLETE filter on node removal Date: Tue, 26 Mar 2024 17:12:32 -0700 Message-Id: <20240327001233.51675-24-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: SJ0PR13CA0209.namprd13.prod.outlook.com (2603:10b6:a03:2c3::34) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vD9bQ8FcAymzAQcaKpbrpf/aJlVfjowR4JnOymkwVf4PSzvLuaiMUF75F21yYn6Hwgs82jeOwQln5MSF3rCYsRW6v8/JXF0lCBmfmqggx6JxJLTReOm70BCAZzVYplQiwYPT5s+a+UkECe3zOa8n9uopi0UGrbBvDchE7h28yg85En1MpxBeWDAga9gX5A/ZQBk5FrM4HMupkCLr6eB6z32/Q3PYNxaRCWGKNkbZ7Uhmz795WtWRA3y7lSl0AtWrRo4ujuR82ZwB/k6+QXBNBSO+hj6rOJLuw5I8rsS8ZPi1qYi3yfTepVg22c8TZhjwrh6yzdK7I8faWynqZtODonxkVKWKzSstLJVYuRbqz4zz7Dvo+1s7vqEzNTXeLJiXRuH/lLHKpaR8EDgxbjJzWRARfxexToBMnQ4nUzD2uueQTSKcaf/aXFSXHCQz4NlcsWBxRl3PxW+QlBJLexeCceoMYxERa8Vf6QNt3sSH0+XInls8gL245poqyVKphrFJlWStpKcD2c0JP23TLktZ2H7eeCiB6CuTj/zL20jz4I/7hpwUIuAf2yf1qGD2A26QKVGHXMqErkqm0yd4W0v3H87NeApxd1Iao4wdB9LS50+x8B4qnRroez+D/wJPQerezp1C84egDfo7k8ZAXkj8m2ueRtLq1QVWoPi1ofXbUS8= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NSjpJBLbWQ/gIFvn1aIIvkji9w4ZiMiG7xgmxHAHRaFCgKsN0uG86ulgWu65PiGAfjMAU7MAvU8l6brO9DzHs7qjV0yXGyTiKEPaAPqddBayzrdMFXkOmjprMhvXgWrY17ysJI5s0uUEt9qkFwa01yU3jbSQKNTLA/jRJG4pd+4I3JrCvfkKgEPRAp71L132KDVQY2FDbuXis2rffy+AXQJUf+/5QfUA9VmonuXx+ppM/7wT8YKKU2HfI7sbxiaISxMWj+WzREa3z7bN2m81mWmvxFhKj+GrjD/z/2h7yIcXET54+XfGqpdWqzzjJZ+Czg0QBg+JNuMJOMy1XVfmZc16uTTlYm07WcOACvo4jGiap6wtydnvPTMRFgLHmkzocFOvtj4chlSGgoqrNAlsPPSk2oiDGCFL2WRCeQsyOy4ioC4C5OmXI0yrEAEGCFstILvKWeWB7ayrq/sRf7Hc+1iIalwfflxUiQLe8XE5EoOWFR9PniLdCbjOykIXTrzROLJ91qd5P/ty5zA0FaGBG3QimnVMReA1xnO+lLl6BDB3rHIXweYgPnYQqWjCGtFy1gz36OnsbW67q3vXyRPnM0Vn10lGFpfA7SF1HixAOMmi1tTHl0BEn56G4ZW6nyLfIp3aUiAQSbYWAmmfS0KTX+qellwO5pVxF0ZtFOtdLhEZ3IBKz8T6y5VkOloIr6xcDXsYO8hKNv0d557UCZ7tpePJEgRUEJK5D8/CumoLx/uXdU0JD/oMjL9xn7O3N9TaH4X/FkyMoaXgAlOXiKrAAB8iTwYKF1kxAI/5/Mi8Qks4Tjl7GD7O33vnPDikSi+YLWWSy8cqolSPAsv1c3FpxwkMbCRKEVYE/uYqVmp/pady/1W7rI2UO0Yi/LpWCKQVsXnR+8N/FpUmEYv+go29fvZBv4iJkNPH5zJChZIwZq0p8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Bc4V3/qKwqt8UDqHrMrFFBSnvQliwUU4HkMYjul/qWa9Ayg48x/tEn0mzaJq/fBYpPcNzqfxmGBg+0Yi/r9jommYErH3/kIdOQVm1zCUz7hwFGruTYksiXQBoV9AYG9XXB8uNk+jj5dmq1t7jY+Of2gdbHbrGjJ58Vd/BZa50Nm7M5xBOQ58P6SXSvO8XO9R7JTrOpfieGt5pKX/rnSR2L0wEsa2CorMQJmWPfqYVlK/u7CRYRMqFY401SsOnHvOrhfrxAhnSYHD47LTWA50OdhQkeMnqNxAw4/V6NbJj7L4bTzm++fv4xEwHU6+c9CEj+/1mX41IHZBasQreZK9xOS7VBr3upLFeoE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ea3e890-da45-4deb-3118-08dc4df2baf5 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:29.5535 (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: g/eW+mT1OvUE1s8qgGuKTkwACfOElO/ONr10mlS8YFDUs72fNsk2W4T6lIJhxRARnlY5yfxOIYfyG7PAnfAwQdObdCiuijkpJZCq0iXnPR0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: 0rgsKcrao-vjJAG_GrjRDXu7wwzuLTCn X-Proofpoint-ORIG-GUID: 0rgsKcrao-vjJAG_GrjRDXu7wwzuLTCn From: Andrey Albershteyn commit 82ef1a5356572219f41f9123ca047259a77bd67b upstream. In XFS_DAS_NODE_REMOVE_ATTR case, xfs_attr_mode_remove_attr() sets filter to XFS_ATTR_INCOMPLETE. The filter is then reset in xfs_attr_complete_op() if XFS_DA_OP_REPLACE operation is performed. The filter is not reset though if XFS just removes the attribute (args->value == NULL) with xfs_attr_defer_remove(). attr code goes to XFS_DAS_DONE state. Fix this by always resetting XFS_ATTR_INCOMPLETE filter. The replace operation already resets this filter in anyway and others are completed at this step hence don't need it. Fixes: fdaf1bb3cafc ("xfs: ATTR_REPLACE algorithm with LARP enabled needs rework") Signed-off-by: Andrey Albershteyn Reviewed-by: Christoph Hellwig Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index e28d93d232de..32d350e97e0f 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -421,10 +421,10 @@ xfs_attr_complete_op( bool do_replace = args->op_flags & XFS_DA_OP_REPLACE; args->op_flags &= ~XFS_DA_OP_REPLACE; - if (do_replace) { - args->attr_filter &= ~XFS_ATTR_INCOMPLETE; + args->attr_filter &= ~XFS_ATTR_INCOMPLETE; + if (do_replace) return replace_state; - } + return XFS_DAS_DONE; } From patchwork Wed Mar 27 00:12:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catherine Hoang X-Patchwork-Id: 13605382 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 221EC4A23; Wed, 27 Mar 2024 00:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498416; cv=fail; b=HvSysXGZy/3pWX+xNrPvEURTtbWjnqjLTb0v+aqV6KPlaoWpkXHqErPUzuiwG3XEP3alY7cRM3HL20n5mXpu+QdTFs9cwhLeyheP72dxt2bmzEyqshXxg03jH5bd+ZcEoH7bdAiiYKJRoYwU+bhkvVJ5GRhZBcfeav6jm1nlu8E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711498416; c=relaxed/simple; bh=RpuUoEYfHIi1Gp8txTbHTd+2fUOZfrpbaDqBFF99w+M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=JPrua+hp0aE/h+7MBO61Sm2R4Kb702cJAf8bqkbUrWF8k7RsVr4JRSAdcbBdizBnA+w3+Hd7q9TOG2qiwPjpS8uTMgYAqouSbmYLNE0uh2QNUmJs5HNWczLvSv+FRJG5iElvcLeopgn9B2DRqC6b6sBtH1Qeclsu9A/vT38EueY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none 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=LRSes6Xc; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=wZ4IW0Oj; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="LRSes6Xc"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="wZ4IW0Oj" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42QLjlFX019156; Wed, 27 Mar 2024 00:13:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=4lqzprB0ib6G0Q7ETtN3XreHQcJ2RiKJpG8b+lPu3Xg=; b=LRSes6XcJoauG0+/nV6nDo4zRn8xIFIUXwdixA4LTqz1mg+oF7hGcnB93hn32KLaUB1U hucoEYZ8hDZ/QQQgKwJnir3sKUCikZ7eLSKsTwkeWdsyDXGNttDcGj4oUzBkHEGELR43 jFwraf3oPGcMBtX2hiztbRchILMUjUqgCkqQP3EXBd2PQnDbYIC5kLMOIb9Y2D5p9P6u THGHneYydiKBrmW4EYfMaWFhOCzZLwbX4rwjStvr3L2LBGvUAeUUVgk/WQIU7Mvt1AUo Alhow+MmoEgPUSLmH7NeC5q2vEBCL+rdajZE07TGbBUPz/p+PBMJe9CXNBduT/XCgBr8 cw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x1pybp8ay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:34 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 42R00VYK021951; Wed, 27 Mar 2024 00:13:33 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3x1nh80xnk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2024 00:13:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=atzv8evM0VxZHm5+aclhInvLXRphDI20qgaQtwNUQT4zgxWtRhXpA/lfCclH53KtkWkK+6ouWlSOud64JZrUDaOZbBPthGa9fK/HbWr/NSgvt/XbURfO4dz3OqqtkPndDonzC1Gmkz/ReoI+vLTiUMKfvnPUqnH6DYO04jhOdyOfybZif241fcUEG2qifwWocV2Khg/21oyTeLVTkpSo3anVxY5cjRMHa8SpTvVzQYntMcmai8CmWxkMyUzD7lbme5PmhqIN8Uo7CMV68u7uOwpBqLT62ldNQ+EU6SmkGaAaNzs705EzBjlSXRlNjK6AtYToBCUt+5J+CLKE3oYNdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=4lqzprB0ib6G0Q7ETtN3XreHQcJ2RiKJpG8b+lPu3Xg=; b=NCTBnJ9MHcJQc7cDYdiOcKmUKRGMp2JVwz0/wRwi/7fYu83H9U4LQnpNC4CqNICvpTHVnHArTtzbVVtJlbzkaZbB2HGEweB4TaOzjkqIfUwtKRIpRfx8kutIVWjOHGZsmKR7mfHV+LUmzMWOzuj1xP7x8Ls6TOce0D84GJHEmZn9OlixExXhEkL5QgeOLA9nPXcR4d1lMNUfgEh1JcJkrDsTN+7Vqr3cgj+/PHkoJ+Lci9zYjx0QkAbdi6XxZI+jezmn5MrAw53cAXD6WDXBFcMj27qXoo9hfifHMCqYd+21Z1DqbDUbPhnB5uURcyuW37CmU5+e5YgPULO2DzYIRQ== 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=4lqzprB0ib6G0Q7ETtN3XreHQcJ2RiKJpG8b+lPu3Xg=; b=wZ4IW0OjhLbltPyKXTFy5DRVlyDZKaSkbpmsAiwe+JxUu+JqIoVWF6AoCsFUW/f4S7qYMD1y4N9PTBScaO9uFk+pJYT4qXYBUQ0g8jJTC8AOHLgcpB2/9bwkM/80UoVl3w6MPi2ihdvKshdQkdDKr6njbr0W1Ywpuih/C9/Ttt8= Received: from BLAPR10MB5316.namprd10.prod.outlook.com (2603:10b6:208:326::6) by BLAPR10MB4897.namprd10.prod.outlook.com (2603:10b6:208:30f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 00:13:31 +0000 Received: from BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a]) by BLAPR10MB5316.namprd10.prod.outlook.com ([fe80::404e:f2ff:fe2c:bd7a%4]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 00:13:31 +0000 From: Catherine Hoang To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH 6.6 24/24] xfs: remove conditional building of rt geometry validator functions Date: Tue, 26 Mar 2024 17:12:33 -0700 Message-Id: <20240327001233.51675-25-catherine.hoang@oracle.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20240327001233.51675-1-catherine.hoang@oracle.com> References: <20240327001233.51675-1-catherine.hoang@oracle.com> X-ClientProxiedBy: SJ0PR13CA0191.namprd13.prod.outlook.com (2603:10b6:a03:2c3::16) 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_|BLAPR10MB4897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sl8rGLdRysTs3N83nmwDp+ZjHZWE/vaUUPNK71jeB2HiOquKyVRtcSkXwlKKztCf2WCAW+3NUV8CtDL2LjHKhUEhH2bUMEVH4jgjBoqbzGuEFV/3Q7laJCj0tB6ePnKdtoJ8wb6Aw2zNSFaURm4tuAXgdAkmK+5y8SZbba0JkWvE71+QDtHX//qnZtqFf2DnKWUiKUdkIz5Zulioo4I5fstCFo7a2f7cExaCdoXJHajEJEah5TWPNa/iDQxYX0KUEiYOj85RyKFW5f9uh/bj12EKrb8KdBtAE7ScTjOCiGNG2OIkNN0VcEWgMK4JGYB+us3e6hYQ7ooNL1k1HKUQxoUpE02mPP8cQieHjzP7QkT0XZjTrGN7jRQ+jKr9WhBKPpInem9xgr+SoF9yLZ7EvRNzXuUomiWe4jUpCqcYsdNRqJS6we1T9/iTpamRk3978birNjLHuwllYOrWNdeGxeC8+G/Jve8FHJHRdfiGP9B4vCgGzuKzzFCoAa7g03L0XQ5llQ4xYx0/qHWcQvwKFq84L0EYGGpfyiS2xyqgSuD3LzFNsXAIYOhe9SsRV/HXA85iQLc+iQk7BZaE4oyfIFHJi+NRom6e4tHBJNTvVCPIHzNBG3vvbXWT5HC/1ME1qhzd39ldj66vgxJbsfPwqLLr+V5guyG5VfUJjB6cLEg= 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:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6L4XRu6GzP5eV/MCSbJ+5lQAE3VML/5/KfpdEHln5TrSLKugDglVCJ7GkM1DUs7WeVVvRt4N3G2JMDRFZGBc1qubQT3OBdr43Y3vuDqKYC7f5y0cgMw8I+P6OdD+1FqpMYjfyi4gtLUc8cCz9cu4+z3rhmQc80qxxx/J6pdjBURqXsd3SA69YlhzAvEZFrYiqs4Z8E7Snq+voNrVV80FNRQ1jLofnkDy3ym2+TXBpZ55kRCJdZLNCQIPdInP8yUl+HT042oSelbiR7ykfWJ0a0VeUDpeJ8Trd01fBWwJq7Yeur17pUKX2zqmru3OmkbVhh1Vm7orJfVC4aQq0paGFXvHu/7zqTVDskD1FfIDgoulTud7pw7yy2yLIFeBvN/eW8IDLrSdn4ExuxtV6Ytl/i2aYQ/WGxZkd529fKrnK+89w39ZhqJMod2mRsFNkXAsElggREj81bIzImTekOGDa9pThKnKd9ZAqIu8P+Bs8Q/u+jg6/VD7Ap4p0AnNMfInfGNkHMKGhKrt9kCX0WOYBJx1Ou+WEXvidD1JHMTTPFHfO3e87nKPKNENEyXO2lql/X7DadCPVkUdprF2zgPFxZ+e6J8gqs1lUOncHBpt831p75q4whBsofV1Z/tmB4jnjUf4SJXJVUwMKw/zKvmjHMi7UjfcMQHex5PLRmUjgzMJSV05yERk+IS91wk8xKCw6Nbneyn4Wi/l2KFkLhtO0t0IwoSXnPgXGzxg/t+ygNPMTh/jZE4uYpapY8AFObD6GmvsZhrysnVx24fmZAYNnfXI0EDQs+PCOTfX5g+v4VCR0XM+gHhN6y9k3qhku0e+gPsDUtKRrf4eNJ6RiRGi7Q3HMZA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3Y3/mPSJD4ma1/D4SUdZSuy3J9qX7l4Xzzq3Bvzdx6cKkOm+eQVOWzSJHsFU30yuY01ij8zwCvBecmlIgW0U3lvBypoal84SdWtxhGn8B8v0mNYySWS3fmE/yTFzzvYRiaiWGIHzp+T9oDbyFlFUjxiOjz4Nld7X9yXUPzMxLgD7VeazphZix3aJl6dx1gUU+laplYSmgiM9IE6NiQWKZJ4BbuqinmeNwIfmBwjYhEsg21VDBikZyf1nRFdpPIjiBaZgXuokZ/SblPtFRdD9e87CeBGpkyXCB5CSzknMCP7MkeaknzxwCweV76ZziVGQE9KAhrE7kRJ4ND/kXcALk9MDJL37dYKCvtnnqymYszE5OqXzKzWWNjSAAralN9YXeSBWTNMiwu9Lo5soi8kBew0BAfkn+9dUBnYPhfQKTxxgPq2fwBzMuys= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51866f80-c997-4ab4-54fe-08dc4df2bc3b X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5316.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 00:13:31.6514 (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: 3dRQ8rIoflPbJnWGPu8VCYsX55dFN938yBT52ZgKa3XGapvSu+EJ5PtmEzPvzi28ku7v3sKQE9H1loag8b3waP63QW2HG6lcTb7iW4Q+zb0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4897 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_10,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403270000 X-Proofpoint-GUID: Pq2WGTIubqgB13QQeT6q5gDXsEwNbFCc X-Proofpoint-ORIG-GUID: Pq2WGTIubqgB13QQeT6q5gDXsEwNbFCc From: "Darrick J. Wong" commit 881f78f472556ed05588172d5b5676b48dc48240 upstream. [backport: resolve merge conflicts due to refactoring rtbitmap/summary macros and accessors] I mistakenly turned off CONFIG_XFS_RT in the Kconfig file for arm64 variant of the djwong-wtf git branch. Unfortunately, it took me a good hour to figure out that RT wasn't built because this is what got printed to dmesg: XFS (sda2): realtime geometry sanity check failed XFS (sda2): Metadata corruption detected at xfs_sb_read_verify+0x170/0x190 [xfs], xfs_sb block 0x0 Whereas I would have expected: XFS (sda2): Not built with CONFIG_XFS_RT XFS (sda2): RT mount failed The root cause of these problems is the conditional compilation of the new functions xfs_validate_rtextents and xfs_compute_rextslog that I introduced in the two commits listed below. The !RT versions of these functions return false and 0, respectively, which causes primary superblock validation to fail, which explains the first message. Move the two functions to other parts of libxfs that are not conditionally defined by CONFIG_XFS_RT and remove the broken stubs so that validation works again. Fixes: e14293803f4e ("xfs: don't allow overly small or large realtime volumes") Fixes: a6a38f309afc ("xfs: make rextslog computation consistent with mkfs") Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_rtbitmap.c | 14 -------------- fs/xfs/libxfs/xfs_rtbitmap.h | 16 ---------------- fs/xfs/libxfs/xfs_sb.c | 14 ++++++++++++++ fs/xfs/libxfs/xfs_sb.h | 2 ++ fs/xfs/libxfs/xfs_types.h | 12 ++++++++++++ fs/xfs/scrub/rtbitmap.c | 1 + fs/xfs/scrub/rtsummary.c | 1 + 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c index 8db1243beacc..760172a65aff 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c @@ -1131,17 +1131,3 @@ xfs_rtalloc_extent_is_free( return 0; } -/* - * Compute the maximum level number of the realtime summary file, as defined by - * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct - * use of rt volumes with more than 2^32 extents. - */ -uint8_t -xfs_compute_rextslog( - xfs_rtbxlen_t rtextents) -{ - if (!rtextents) - return 0; - return xfs_highbit64(rtextents); -} - diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h index 4e49aadf0955..b89712983347 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.h +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -71,20 +71,6 @@ xfs_rtfree_extent( int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, xfs_filblks_t rtlen); -uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); - -/* Do we support an rt volume having this number of rtextents? */ -static inline bool -xfs_validate_rtextents( - xfs_rtbxlen_t rtextents) -{ - /* No runt rt volumes */ - if (rtextents == 0) - return false; - - return true; -} - #else /* CONFIG_XFS_RT */ # define xfs_rtfree_extent(t,b,l) (-ENOSYS) # define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS) @@ -92,8 +78,6 @@ xfs_validate_rtextents( # define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS) # define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS) # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS) -# define xfs_compute_rextslog(rtx) (0) -# define xfs_validate_rtextents(rtx) (false) #endif /* CONFIG_XFS_RT */ #endif /* __XFS_RTBITMAP_H__ */ diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index acba0694abf4..571bb2a770ac 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -1375,3 +1375,17 @@ xfs_validate_stripe_geometry( } return true; } + +/* + * Compute the maximum level number of the realtime summary file, as defined by + * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct + * use of rt volumes with more than 2^32 extents. + */ +uint8_t +xfs_compute_rextslog( + xfs_rtbxlen_t rtextents) +{ + if (!rtextents) + return 0; + return xfs_highbit64(rtextents); +} diff --git a/fs/xfs/libxfs/xfs_sb.h b/fs/xfs/libxfs/xfs_sb.h index 19134b23c10b..2e8e8d63d4eb 100644 --- a/fs/xfs/libxfs/xfs_sb.h +++ b/fs/xfs/libxfs/xfs_sb.h @@ -38,4 +38,6 @@ extern int xfs_sb_get_secondary(struct xfs_mount *mp, extern bool xfs_validate_stripe_geometry(struct xfs_mount *mp, __s64 sunit, __s64 swidth, int sectorsize, bool silent); +uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); + #endif /* __XFS_SB_H__ */ diff --git a/fs/xfs/libxfs/xfs_types.h b/fs/xfs/libxfs/xfs_types.h index 6b1a2e923360..311c5ee67748 100644 --- a/fs/xfs/libxfs/xfs_types.h +++ b/fs/xfs/libxfs/xfs_types.h @@ -240,4 +240,16 @@ bool xfs_verify_fileoff(struct xfs_mount *mp, xfs_fileoff_t off); bool xfs_verify_fileext(struct xfs_mount *mp, xfs_fileoff_t off, xfs_fileoff_t len); +/* Do we support an rt volume having this number of rtextents? */ +static inline bool +xfs_validate_rtextents( + xfs_rtbxlen_t rtextents) +{ + /* No runt rt volumes */ + if (rtextents == 0) + return false; + + return true; +} + #endif /* __XFS_TYPES_H__ */ diff --git a/fs/xfs/scrub/rtbitmap.c b/fs/xfs/scrub/rtbitmap.c index 2e5fd52f7af3..0f574a1d2cb1 100644 --- a/fs/xfs/scrub/rtbitmap.c +++ b/fs/xfs/scrub/rtbitmap.c @@ -14,6 +14,7 @@ #include "xfs_rtbitmap.h" #include "xfs_inode.h" #include "xfs_bmap.h" +#include "xfs_sb.h" #include "scrub/scrub.h" #include "scrub/common.h" diff --git a/fs/xfs/scrub/rtsummary.c b/fs/xfs/scrub/rtsummary.c index f4635a920470..7676718dac72 100644 --- a/fs/xfs/scrub/rtsummary.c +++ b/fs/xfs/scrub/rtsummary.c @@ -16,6 +16,7 @@ #include "xfs_rtbitmap.h" #include "xfs_bit.h" #include "xfs_bmap.h" +#include "xfs_sb.h" #include "scrub/scrub.h" #include "scrub/common.h" #include "scrub/trace.h"