From patchwork Thu Apr 18 06:14:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13634188 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 B70DF3399B for ; Thu, 18 Apr 2024 06:15:23 +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=1713420925; cv=fail; b=TKzlV7MG922aFmnW0/utPBBE5EA5g5z1Ps4bf2w7IV/sh6AxZUmPi6ZxNeJyvdGCRo+cNdx/ot6ZMOxDPIuf36TH3jx3AFDiSrQ4f/ZkFS4MWrfCkKqpBtjCK1mBiI+jMnA9xQ4Irtas8bNxDWQjlwuBnT5D579HySbUgKO3PVM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713420925; c=relaxed/simple; bh=WffPq8eDTEgqVjsoJvzmKI/WJ4CIiTC05M8Zcuc3ppU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Fqo0H+QJNUozlAZucnKgXqJW4G1stydSXb5HFx+V2E7K87q82+38Hhuv8+i+Zta27V5SxsUkSsubh8hb5J1Z8eWUMO0mkAgqXXdKhLPv/DMTYH686gomOEld7LbMMQTEV4XOaU+gmDD3JZngM9m8yMKZ4f0CeKBzzBEe9+LPtwk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=LngwoW7a; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=pZu6fDKF; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="LngwoW7a"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="pZu6fDKF" 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 43I3wlgk010041; Thu, 18 Apr 2024 06:15:19 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=/+OPVLk+hZOygAIzmKNIv9Varm9U+b2mqEYKr8o7t+A=; b=LngwoW7aldPv0tAWMyChp98v8sjNvCQCxd6AxcVXOYP/5/4K8mb9AFl/DNdma5oxGR4O eqHTghmbmEb8QXTRms9sf8yaJK+4GtdY4qvU1jp5vSd2H/J70dCyFwYGNmTjYDtcQNGY TYVazHIlPZ89NxVEshXRNXbuCZfeFRVYAF39jRyqdzaYM9Qynrhbllx7m8+hLvVNNIQl inNuZYMLdBK38/pF1YdQhyVVz3wi5pvg2Ssb7tBm1aA6NYOHE8oNC0HttvfN+Ok+boTE RcyGCSFTtxP+mKi08omySMcgf4rnHb6HbV3MvboRNGevPCcCir79dxqxXl0dSTHMv5tq Qg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xfj3e9r5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Apr 2024 06:15:19 +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 43I5aAAf004283; Thu, 18 Apr 2024 06:15:18 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xfggg6hvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Apr 2024 06:15:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DQJp4JxCmZgg0Y878NTi3DLcT5QEm6ljjzKRigMBXO3jYePxyfdHd9LRzdAebzzbStZ38b2XD4L2NDiMBuYKpI3Bauz9y7UHMj433abbq7xtD+aP86NV9F5Et265H5iHztg+fAkzLF77ra/zj7wHzI+J3OzckQfb/Kda+x5UpkNhMl56zvAG3ljLkIeNy+UpZEBUd/rNLzR2eptO1tOZCVgTLe5waC2Y1Ux6U4FcxWRiFDS/Jx8Eu9H9k6beFtmx9K8EgNXYGBTXImMaLjfAAfoGPkklb6lEZ/SDhFEGfS5eNIs/XPc5XeGgViFM8xV178dOdV+9FFIEAR7Q0QGkgQ== 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=/+OPVLk+hZOygAIzmKNIv9Varm9U+b2mqEYKr8o7t+A=; b=STSct4Kmmn0v8+ZErzXeuRN9eKvkGrBdzRBhSvL4iUAS9pRdPSAOoXz+cDXxR4NW+i56XMPwki9Ns8MMoWjByR0HMF0GpLjr/VJ2GnnxKN4+f8r1I2GC/ikrqLIX8lNmgY6JpMAcKxKN02ro6xrnQ+UrKPhuWJ2+gXEe3yEMZe70Y3Tn0s3HMwZomSWkNvkWizwmui9lb674mxK5eCsRI0eDlVF/GkHYPNj2feOKsDP9Qr3O40idvYI1HoPOF4ejDgUTu4AriovQ+QIB0ihJm4aWyw7UaafQVFRRUGAnfHavsYzpACzqranIZTFYrZily4eihnMNqpf/tS0EA/L9ZQ== 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=/+OPVLk+hZOygAIzmKNIv9Varm9U+b2mqEYKr8o7t+A=; b=pZu6fDKF51chrdmNzVhje4kzC74oHdIQSrE3VOTjeEuoRpziCkfBZIghIykM/K/EQ9QO8TZTEA1YCQG3xuJzcDgFhYqZoK+ucC2E1IjDJFF0eUoIyx99vBVla8xogiLPzCRhzjMfmRGEQkN5gZ+NTxKHQz5qFK6r7NEqBkivtb8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB4463.namprd10.prod.outlook.com (2603:10b6:a03:2af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.39; Thu, 18 Apr 2024 06:15:16 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::814:3d5c:443b:17b]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::814:3d5c:443b:17b%7]) with mapi id 15.20.7472.037; Thu, 18 Apr 2024 06:15:16 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain , Josef Bacik Subject: [PATCH v2] btrfs: report filemap_fdata_range error Date: Thu, 18 Apr 2024 14:14:19 +0800 Message-ID: <1556267cd2fd5f2d560a50b4b169ec4d58c95221.1713334462.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <80c3c9ccb6e7ea366d88f0e5b2798f5bbd3b381c.1713234880.git.anand.jain@oracle.com> References: <80c3c9ccb6e7ea366d88f0e5b2798f5bbd3b381c.1713234880.git.anand.jain@oracle.com> X-ClientProxiedBy: SI1PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:1f4::13) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ0PR10MB4463:EE_ X-MS-Office365-Filtering-Correlation-Id: c26e1e68-4c2d-43a8-e518-08dc5f6eea57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: idxjsAnVBzMTe4iAR3DPqml++hNZWtdYfAbStY5tkzghBMFdAkXtL25HeIzNEVLNAB5COpN34ItRLoQV157TUFVXMCcwp3b9graQ6sPOTCjIgMTnwa7I6dX8oVghUMtvZnnd7ONu50qAlNyBWtZXkWU6TB5G69JuJs46FEJK6psbt7nS/zGk+YSUlzT6ksu7kv3n9aq8lZyRtHpQbhtulsyFqvWCdXmekvwWUh/kjJzD/IvOJvJFT3oOgf3EDmSl2CqJzNuM3Kuag0wnzg9wnYCcL+3Nfum6lPmbV5S/upFkBrNeLBkUy2oUoNTInMxLOAWB0g2+4Kv7vXtSaOGxOVInz5wgsqPI1RXXb0kJ60pyW1eTwQn3v1VUCe1HveGgAuNwgU3HibLFcezUuttYHxpoB89CxEy4EmDwpH++ekaVYVPbXtQLaR5bi+Lmu+a7ie4+YMwfFZ4NPFm6E5PBXVQT9l0hMwrnXwoB06YEUy1AbtLOQHg/5QB+niKL5/wkXGesLB0NPNMYBa3D0uN83zLLnCOnmB2j1d8T5oxu0An1uioKgQRrzF6nqKHWbH1BGH4Kn4aBMQYMjaSIdHpoBCTB797RbY2VIQE8jgAMWPvvufxdjBgs09YXrfIxE3sivGF63dA9cruFnFdHoOyVWG9qahx6cWqU1l1e1OofW54= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qRb1zqMduSTQi1456cO++6pnjzX9QNCsNnaF5iZL77Se+TOzJkSENOI0nJVrxdTUr/c0c/LYgv2ogys1gBvVvTFlqmMKFuzmJfPGdyqRImozZBXRhenKpt5y2RDjb2kGVvp+zehuGnD94z8Z+1hEewX/PDWItUSsmCbAG405v97g/xPsQSm8TgNKe2r5UoDn4eLEFGdSpbtW3js6aq2MTngx7xK8KBXloSiMRZoLp4IZH9M8GnvGsh/YvewiueHauxA/kUIehg3RYkQ7B3ozCNwB9yhpXt7J3sgdz9Y2+bRCT3aYS8zrXazEHLZKdAoCZHZeANDBmYuVJgIfxftSP5+crdYo9ladV3mSjjfmDcnQ7nRrKJwzl0UPNXkYoDFY74PyG8uxRjQl/cgCtR1mEi8ixV9PA3e53CGyM/AebycHKJKjrZRipM1VhrF1QT5w6wSpzggDj0jrTrTJ3d7SBpt0/IvhKJHTARBX5bKDKmDkm/RgrY8EOEZz9dWU30SV94A2+3yO7vBOK7e6Sv3J0UOWPE0BZNNYHaq7zPud5WrME4pCKZZmpot4pdAsTwzgxAnThzw7cunCvvTjAwFXCgq9YawM8o7gp2gJB/TDpb0Pfg1sPWNCalGe4P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Y+cY5YfanznASfwWccRNQsgEPAW5lbLgpsH899hncMaN+rOn6fE1YLyplz43IJ+9eASjRTpQ07GWS8jYHEwhU9VvqzH8E9tjBTotgCgYaEYBB2eLARfx0JyHBsik1Eg/MU2lhVHpp/gboJO6ROUVnNYY5iW0/dojUm1S7a/Mlxy8PRM1elZqQnDCVwl2Iq7It6cR8bSDi82aT85vaYOpxFI8sF3cy2JfB8/O0F8Xj3f1EYISyjdmey67D/JEKdNJVP1Q8deomOrm+cKkz7rhaOp60Ls8s+d80331zzYa3DQ6/A19pm78vHZRsgMeJxpYn0d2bjA0VH5vyRAXihS5JEo9xP0IhLlTlkH2/GZF60ZTterjlUOArE/L6RrM5MCmNyI2P4TbmSKPSD81lJcIeP0zoRGSyqs4qoSwt+HkYk7aJhc7VEy7NE4UwJlkQBF0+0AciquMn+B6OZI7eAP2X89iWpjCeiL7t0P29QKqbO/h0hAZwA1BSEG6pfZSuagJpQ9adeYFqOnFYMVBdOzqEvck5I/Ns7ze74HqQRTaUxoy/9CiCtIQv+9TLy7Cf/WSqhIoBQRig= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c26e1e68-4c2d-43a8-e518-08dc5f6eea57 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2024 06:15:16.6397 (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: uteIBbYuTNdbWM+6N5yCjHEZxE7O/ummZB0PIV35t2O4AQyBPAejrreZYAIIinRsnYKiyLCUZVJ8Uqu1hrrCJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4463 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-04-18_04,2024-04-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404180041 X-Proofpoint-GUID: 7PE80RTtb1sNLYE5BTywuDSi06ooHScj X-Proofpoint-ORIG-GUID: 7PE80RTtb1sNLYE5BTywuDSi06ooHScj In the function btrfs_write_marked_extents() and in __btrfs_wait_marked_extents() return the actual error if when filemap_fdata_range() fails. Suggested-by: Josef Bacik Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo --- v2: add __btrfs_wait_marked_extents() as well. fs/btrfs/transaction.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 3e3bcc5f64c6..8c3b3cda1390 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1156,6 +1156,8 @@ int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info, else if (wait_writeback) werr = filemap_fdatawait_range(mapping, start, end); free_extent_state(cached_state); + if (werr) + break; cached_state = NULL; cond_resched(); start = end + 1; @@ -1198,6 +1200,8 @@ static int __btrfs_wait_marked_extents(struct btrfs_fs_info *fs_info, if (err) werr = err; free_extent_state(cached_state); + if (werr) + break; cached_state = NULL; cond_resched(); start = end + 1;