From patchwork Fri Mar 25 09:42:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 12791384 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECAC5C433EF for ; Fri, 25 Mar 2022 09:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354687AbiCYJoE (ORCPT ); Fri, 25 Mar 2022 05:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357904AbiCYJoD (ORCPT ); Fri, 25 Mar 2022 05:44:03 -0400 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDAB5CFBA6; Fri, 25 Mar 2022 02:42:29 -0700 (PDT) Received: from pps.filterd (m0209322.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P4kuci032355; Fri, 25 Mar 2022 09:42:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : mime-version; s=S1; bh=0jy1Q11krTW0IwSAiZvlkFDm1CwU+j4KZU7DquVCSXk=; b=ogrPfy44l6siWM08VHTOKBYcOkuQq+UQ1jhmmgltXHpUii/47jNpXy8oqoAtQdnk7T2z EK9UjAg1IE7p9K6fl1sJ9hVAnvGftg5iRwmjYLS1JMzL2wGRMCmbBr3nmuk+EufUjhwQ eW6jFVIXtoJQC/lXr7wTZZOwKm3/yrX5fFLMJtghSAX2Wf49Tu1MEy3g8RVAjjAHKfad EK1NarSiAKGTtROQvIozst5ULgUk6bzPtZ8GL2vy3FBwBPUOM5ZIqcMQDVQkQVtTErvr AsUbNjxfsFG0oFZQ8QE3pXanT8aB5AN4GCXLzflJWafi/DA9FPnf5JEVNrR//DlPp7Tf Cg== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2048.outbound.protection.outlook.com [104.47.26.48]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3f0yw3rk6g-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Mar 2022 09:42:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQi8Fjx4ipVYUtLTk7wV5zqLbXv22aV0jgHvrw46fh/YU4jDHVEdVv4tzhR+z7AY2F33/2aXIBdSjz53UvwYrQv8YTWjhRf3EZvqf4UrVbbXWjKw7aKEQKkC8LNMPPr8DKeNLVsaavorWUDWWwoEjkfuCPfZAuW6RJnQj69xiVtJOHwo2vXDeKDL5HwQI+yWeqajif88PvRr1ecsDnET/m4j172PQuU6i6EoUIBJvzKEpFcgI+fkjtlMZsleD2csPjAvE8EmZ+qrEYLFEF45grMxCyVDoOMc0/uIfwaMzKIzr2ttnLyUQ88T+woCHjKTpKtC8a6u/C14JrT35DM6KQ== 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=0jy1Q11krTW0IwSAiZvlkFDm1CwU+j4KZU7DquVCSXk=; b=E+B5XtTXSuO0UzDiKcNgU26SpXeAZzglBfLPb4ZCplj6NfXKsidXwstlwICZg3Pz86W4L5v4tYqsF4W9XlsBFoJZbr2bJCFOhzhHlLVxxLdvSLxdTdXODgd95A6ydxPdvEF/NhJLokifrIeKmb6ZarxeU1kmMceXgFv/4WTb8uObEMBcrggRRMa7r/yuy0jEpImNaM1P/+BFDvDU1S0u806kV61QMV9zJUUrEX/Pd8EWIKBBEQPaF1eTs1VFhYiEnJx5xucJ9HUREjuwCDVOrNUy6e1Gk6IRB+yILUCywWV0iJGb60xhzsxdzMXilViiqYGsI9g1C3g1ovY7GlCjrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from HK2PR04MB3891.apcprd04.prod.outlook.com (2603:1096:202:35::13) by HK0PR04MB2386.apcprd04.prod.outlook.com (2603:1096:203:4f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.16; Fri, 25 Mar 2022 09:42:08 +0000 Received: from HK2PR04MB3891.apcprd04.prod.outlook.com ([fe80::7440:bc88:211:6094]) by HK2PR04MB3891.apcprd04.prod.outlook.com ([fe80::7440:bc88:211:6094%4]) with mapi id 15.20.5102.019; Fri, 25 Mar 2022 09:42:08 +0000 From: "Yuezhang.Mo@sony.com" To: "sj1557.seo@samsung.com" , Namjae Jeon CC: "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" , "Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp" Subject: [PATCH 1/2] exfat: fix referencing wrong parent directory information after renaming Thread-Topic: [PATCH 1/2] exfat: fix referencing wrong parent directory information after renaming Thread-Index: AdhAKsEtthO71fDaRs2uNUmwvcqVmw== Date: Fri, 25 Mar 2022 09:42:08 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a345c88a-1838-40fb-a34c-08da0e43bad8 x-ms-traffictypediagnostic: HK0PR04MB2386:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fk5h0ZLSPAgaN/ZizUjBcbPe1CjqYxthxO4JpsakTYqvip3zponkw+M/rW2ZPsofKm1+QRnnKdjygHp0myYC0vu/WiytdWCgiN35hfBJp425ivTPiIopnzDTYWCAVMBmk3m4Uw/Kkv7VFr9q42QC0acSLU8th0/JMjxr2YxnjjLW+XYYstTX5Ad9rcluzpBcZT4oB27IjK+ptMueN9dv/2VjHhH+bTxJbbUr2gVcY1BWYbydSN7rkqCVlW2MZN6kBesNuHfGO8aFfes5DcElH45ULftc2TXO4psc3RAsOlEmu4oCQdiEBNcsRaEWhdQUbhefW4m5HqjnHsu/D6WQN7g1ve8fbZjWjyYAzvrS/9XphOzSt8j6SV0XvGB/d9vjPiKCxQfp3qC4QbMzkQkYP3pw2HMUl7EY8iXOtyVJp3xfriDhTtqhdJtosXX27ceeVnIbhDZBUG3HyTYMjzyyOgVms8sjp7kXnqhT/mdTFLCtyc6zL1F5hYSRFNz9WVGSLl65f49e0Lfa5zERKtp4KnyxfSgZYLJhNQUOVWEI1Y1sZxbxNevPKwAAflr8bcqYndWJoeyRrECAPpK1OqpKDXlQS/Kw0sg+7i9jsxFInRczwTNLgynXuA44ygNdLPe2NmhddqWecCW7St3U8N927tKMaWi4OeYyDu/EoqaHEIACjj8ezu8RrHqM4mGT6PBaeQyopvwJ1Ki58r7124OjNw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HK2PR04MB3891.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(4326008)(316002)(508600001)(7696005)(9686003)(64756008)(66946007)(2906002)(38070700005)(8676002)(6506007)(55016003)(71200400001)(8936002)(26005)(52536014)(76116006)(186003)(83380400001)(66476007)(110136005)(66556008)(33656002)(66446008)(5660300002)(54906003)(38100700002)(122000001)(86362001)(99936003)(82960400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?nplz8Qz7Ki0smPXV0vmdGY5PR7HO?= =?utf-8?q?bUhL0js+GUvnXn2fq+k1W+SBoldcF+x1j4yTpF8cQq2XrOYczBA3CiLQfxVc7sgxf?= =?utf-8?q?oHLwTeXL9fCS/Z3I3XEJz/d3CZa7RabbOTMnDNpIRcIFkp8Evxgg5dIHNY1yk388Q?= =?utf-8?q?VgzsVsj1jycZ1kJUr2fHx07CtblqX1Hc60/wtcrmxcud1W9e2B8cG6OHm597q9Y/R?= =?utf-8?q?HhLpOkpVyD95e43bFi42xc+Zih3ENVMRB/zwyiQ9buF2G3PKsDN/hi6DfiuUBr/U6?= =?utf-8?q?BlutoWhQxkwOn1xT4UDM7FM9aYAcqvqHEquYWFtGGOCIvGp77R+Fbw2X8ipbQa02Z?= =?utf-8?q?Xl1q9dAI33mzttl0ogsvuWGmY8IFwbNycMnSAnVdNAVzlHveDTxHP8xjXqIqWv5SG?= =?utf-8?q?1lrAMOvKreZlFpueLRNWaxF22kljGfK/DLrWNbXPGQI3cMvn/FNaw/REEFDSutlnv?= =?utf-8?q?uO/vEOXZ6nwpCYf9Em5qR4+sIOYXyPO4tmNPr+7u6ZOodXXpV5+2jLTlkMdUKL32I?= =?utf-8?q?zAQc1ts9nAa7v/TVH/E1BEjFyVBjaaiNhzAMNSXw5w26D3kiZeZxJUlQEXeY/HLTn?= =?utf-8?q?EklQy3xqGw8ym3/Jyy9w9hmLeLUmRX1mpPK2JcBDbXGLoTgdOh6fuC8ZzFTpE8oX5?= =?utf-8?q?nd8R9qamJFnoKxU34ujHVI736O/kUPjoRWOjTU2+zq57OoYSlnP/q/jvuplN/rVOl?= =?utf-8?q?G1vcbSCabxlCsDAxlZ/PY9kl8dqFcMimH2MfOCjtf8aqZxZH+N6rksJVwe1smbcc0?= =?utf-8?q?9AuH5FhGeu3aAI6Z54pVvkWGzOBiNyD6u0VFO1mlKmbRldipeq4k+Veub5dVnlTMg?= =?utf-8?q?R1bPzCkkqCuWBb0I7L9X28qIGGix2ZrNHldo29ZsLpRSuT5UCQUvsz+Ay8K37cSLm?= =?utf-8?q?Zqwt9CLRj5nNMaJ1wNd8fEMfNSyfYwEeoiBjZSrwrGsPje++Gn4MomNsz34/O35q3?= =?utf-8?q?e6QXHh5w4r/KeoY/m16eHTQdu2XrxQj8lxIXsCKsX0wa10+yUErb/Qt5bMfov4xkw?= =?utf-8?q?+6ILSoYl/t4LBh/oXDHACR/DaYsZVEUcybDmm0QhBoyij0/QDPeWMx5yZ9SubBKil?= =?utf-8?q?Mi/F9UzNd6nALHHz6uR97tF3r9xncghuqTSvyFf+MHWTVxJhoI4hdt8rbpTblrLFx?= =?utf-8?q?dt9y4tiSfPXtmo2bI/QOjwFgKNaTzqNr3HmT14h3bdHRhi5+OTAE4o1FPCkxHZJ7w?= =?utf-8?q?Hku2dq9lO5U01Ufiu3+wbPQCJQ8ZrILbWBlKCv4e1CTsnvh+OWr/Eb2UJGQCNlSXa?= =?utf-8?q?siKObfFYuSMLozOMldWYeLd3Syj0s289NBi1N+fl3Bhe01+iEqjVH0CVfKNaFu5q9?= =?utf-8?q?uxaK+KEkqGy8g9+6uHuA0mUGb1sd58yz7khV0kJKJyNb3oqoIi63rQ79H/0crLDgK?= =?utf-8?q?p8dPxtne2WSq22?= MIME-Version: 1.0 X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: HK2PR04MB3891.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a345c88a-1838-40fb-a34c-08da0e43bad8 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2022 09:42:08.5922 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: m41cA1jW0mF1UoafSeTWFqlcn/H1IfW1NEK554BIxpj0zzzigsBtdbfDVxA5SmLSE384dlDWpwHlwKWhGxZ95w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK0PR04MB2386 X-Proofpoint-GUID: R-mx-bLXHbbd9taD3GWx715hZc_2ZWn0 X-Proofpoint-ORIG-GUID: R-mx-bLXHbbd9taD3GWx715hZc_2ZWn0 X-Sony-Outbound-GUID: R-mx-bLXHbbd9taD3GWx715hZc_2ZWn0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-25_02,2022-03-24_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203250054 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org During renaming, the parent directory information maybe updated. But the file/directory still references to the old parent directory information. This bug will cause 2 problems. (1) The renamed file can not be written. [10768.175172] exFAT-fs (sda1): error, failed to bmap (inode : 7afd50e4 iblock : 0, err : -5) [10768.184285] exFAT-fs (sda1): Filesystem has been set read-only ash: write error: Input/output error (2) Some dentries of the renamed file/directory are not set to deleted after removing the file/directory. fixes: 5f2aa075070c ("exfat: add inode operations") Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer Reviewed-by: Sungjong Seo --- fs/exfat/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index a02a04a993bf..e7adb6bfd9d5 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -1080,6 +1080,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, exfat_remove_entries(inode, p_dir, oldentry, 0, num_old_entries); + ei->dir = *p_dir; ei->entry = newentry; } else { if (exfat_get_entry_type(epold) == TYPE_FILE) {