From patchwork Mon May 28 14:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changwei Ge X-Patchwork-Id: 10433077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46FDC60327 for ; Mon, 28 May 2018 14:42:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33A08287D2 for ; Mon, 28 May 2018 14:42:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22CE8289BC; Mon, 28 May 2018 14:42:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) (using TLSv1.2 with cipher AES256-SHA256 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1AE7E287D2 for ; Mon, 28 May 2018 14:42:19 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4SEeoYX124619; Mon, 28 May 2018 14:41:16 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2j6w42dvcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 May 2018 14:41:16 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4SEfBKb030904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 May 2018 14:41:12 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1fNJKh-0001Cn-HH; Mon, 28 May 2018 07:41:11 -0700 Received: from aserv0021.oracle.com ([141.146.126.233]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1fNJJv-0001BF-Kd for ocfs2-devel@oss.oracle.com; Mon, 28 May 2018 07:40:23 -0700 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4SEeMZd024203 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=FAIL) for ; Mon, 28 May 2018 14:40:23 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4SEdCjp029149 for ; Mon, 28 May 2018 14:40:22 GMT Received: from apc01-hk2-obe.outbound.protection.outlook.com (mail-oln040092255088.outbound.protection.outlook.com [40.92.255.88]) by userp2030.oracle.com with ESMTP id 2j8eh8cgxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=OK) for ; Mon, 28 May 2018 14:40:16 +0000 Received: from HK2APC01FT062.eop-APC01.prod.protection.outlook.com (10.152.248.56) by HK2APC01HT195.eop-APC01.prod.protection.outlook.com (10.152.249.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Mon, 28 May 2018 14:40:11 +0000 Received: from HK2PR06MB0452.apcprd06.prod.outlook.com (10.152.248.59) by HK2APC01FT062.mail.protection.outlook.com (10.152.249.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11 via Frontend Transport; Mon, 28 May 2018 14:40:11 +0000 Received: from HK2PR06MB0452.apcprd06.prod.outlook.com ([fe80::54f:c47d:f84b:5d1e]) by HK2PR06MB0452.apcprd06.prod.outlook.com ([fe80::54f:c47d:f84b:5d1e%5]) with mapi id 15.20.0797.017; Mon, 28 May 2018 14:40:11 +0000 From: Changwei Ge To: Andrew Morton , "ocfs2-devel@oss.oracle.com" , "junxiao.bi@oracle.com" , "jiangqi903@gmail.com" Thread-Topic: [PATCH RESEND] ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry Thread-Index: AQHT9pHIZx9Pu+haLE2yp2wIYpW5nw== Date: Mon, 28 May 2018 14:40:11 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR04CA0070.apcprd04.prod.outlook.com (2603:1096:202:15::14) To HK2PR06MB0452.apcprd06.prod.outlook.com (2a01:111:e400:a41b::18) x-incomingtopheadermarker: OriginalChecksum:36A0C39650ECF230D1568731472F94144C37AD66226DBC97DD527C72751B9E11; UpperCasedChecksum:3991CD0D5B9BF1C5B2BE5A1A14AF5EC742863F6378E77D323A9E90CE99BA6ECE; SizeAsReceived:7589; Count:48 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Bw8U0sL/A0YZcxPzcDRyrssmzJihzWDvVasqIKyUv8g=] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HK2APC01HT195; 7:jOcH+IIZ0MrEAN9LPPMbb7IpfWJAyhrRj7ZgPVKB7MHDlERC/EMBnZOPG/JzamKLAABmhm9Uk7hbTjj8t1w2/ZiwJPaX6OYRtW0UJIzQcTJwdFelF++g7mNDeH3Pby8eRI+DL+7MdgiSfT9lUCL8ekCvZ8Wuk/ItfF0OvKl5mlJI2gjM3cdMqOiPtui9wdKxx4E2F/dgWW4/ljHR0r27z2vGoIqlUZAS3Q1VxovVtC1dRgJLXWVwmhHLdqTOnh17 x-incomingheadercount: 48 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125466)(1701031045); SRVR:HK2APC01HT195; x-ms-traffictypediagnostic: HK2APC01HT195: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:HK2APC01HT195; BCL:0; PCL:0; RULEID:; SRVR:HK2APC01HT195; x-forefront-prvs: 06860EDC7B x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(199004)(189003)(2900100001)(105586002)(99286004)(110136005)(106356001)(305945005)(25786009)(68736007)(3660700001)(5660300001)(3280700002)(15760500003)(81612004)(104016004)(86362001)(2201001)(74482002)(8676002)(54906003)(81156014)(97736004)(74316002)(8936002)(39060400002)(33656002)(9686003)(476003)(55016002)(82202002)(4326008)(26005)(2501003)(6436002)(102836004)(6346003)(7696005)(14454004)(486006)(5250100002)(59450400001)(386003)(6506007); DIR:OUT; SFP:1901; SCL:1; SRVR:HK2APC01HT195; H:HK2PR06MB0452.apcprd06.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:; received-spf: None (protection.outlook.com: live.cn does not designate permitted sender hosts) x-microsoft-antispam-message-info: AnsOVlIzM8FDCoR3tsRGjkxBOqDrQ/FvSPPKTrEwa6UORo1oFa1MWoAH3Za/rMZrhc0YzTUYJHPmrv5gH1dPU+7NmIDPf+l06j+276j8/Edzs/ICdd0+yZJsUBaoWi0VUQ6qwnl2QJCR/rAzJhJAMt8ETCXU6KTj7IFAnSkLrcoU3G8Pb9q0HUoMY+4lQU+S MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: fb4eb30b-ba9f-46f7-07eb-08d5c4a8ea42 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-Network-Message-Id: fb4eb30b-ba9f-46f7-07eb-08d5c4a8ea42 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 May 2018 14:40:11.3694 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT195 X-CLX-Shades: MLX X-CLX-Response: 1TFkXGxMcEQpMehcaEQpZTRdnZnIRCllJFxpxGhAadwYbHRxxHx0QGncGGBo GGhEKWV4XaG55EQpJRhdFWEtJRk91WlhFTl9JXkNFRBl1T0sRCkNOF0RFB0NnE2sddVtPfBMSel 54B2EaYmRIelJOcmhcEnt5EQpYXBcfBBoEGxkfB0kaHhNOHBJJBRsaBBsaGgQeEgQbEBseGh8aE QpeWRd5e0hGUhEKTVwXHxkSEQpMWhdpQk17EQpMRhdjaxEKQ1oXHhoEExgEGB8fBBISEQpCXhcb EQpEXhcdEQpESRcZEQpCRhdoQwFdU3JdE3kbRhEKQlwXGhEKQkUXYUZYax1hUBJvaE8RCkJOF2B 4HltSWlt/HX5AEQpCTBdvXBl8BUV6UB1ISBEKQmwXZGFPS2BCSBJ4HWcRCkJAF2cSAVgTZGwBGF scEQpCWBdifW95AU8YGXBwexEKWlgXGBEKcGcXb2EcWWdSH3oSbBgQHhIRCnBoF2FdGVpHHh5ZH XgZEBkaEQpwaBdmbFl4YlkaeFJCfxAZGhEKcGgXaVNoXV9gGUBOSXkQGRoRCnBoF298f11fZlxp R2djEBkaEQpwaBdkWnJNeWZCTX5nUxAZGhEKcGcXbV8dSRoYTX9abHMQGRoRCnBnF2VgRVBoYX0 YbWVzEBsYEhEKcGwXbU4bb1MBR1JIHXMQGRoRCm1+FxoRClhNF0sRIA== X-PDR: PASS X-Source-IP: 40.92.255.88 X-ServerName: mail-oln040092255088.outbound.protection.outlook.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 include:spf-a.hotmail.com include:spf-b.hotmail.com include:spf-c.hotmail.com include:spf-d.hotmail.com ~all X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8906 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=196 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805280177 X-Spam: Clean Cc: "stable@vger.kernel.org" Subject: [Ocfs2-devel] [PATCH RESEND] ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8906 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805280177 X-Virus-Scanned: ClamAV using ClamSMTP From: Changwei Ge Somehow, file system metadata was corrupted, which causes ocfs2_check_dir_entry() to fail in function ocfs2_dir_foreach_blk_el(). According to the original design intention, if above happens we should skip the problematic block and continue to retrieve dir entry. But there is obviouse misuse of brelse around related code. After failure of ocfs2_check_dir_entry(), currunt code just moves to next position and uses the problematic buffer head again and again during which the problematic buffer head is released for multiple times. I suppose, this a serious issue which is long-lived in ocfs2. This may cause other file systems which is also used in a the same host insane. So we should also consider about bakcporting this patch into linux -stable. Suggested-by: Changkuo Shi Cc: stable@vger.kernel.org Signed-off-by: Changwei Ge --- fs/ocfs2/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index b048d4f..c121abb 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1897,8 +1897,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, /* On error, skip the f_pos to the next block. */ ctx->pos = (ctx->pos | (sb->s_blocksize - 1)) + 1; - brelse(bh); - continue; + break; } if (le64_to_cpu(de->inode)) { unsigned char d_type = DT_UNKNOWN;