Received: by 10.213.65.68 with SMTP id h4csp2198366imn; Sun, 8 Apr 2018 22:17:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx48BY50C7rR3mYbflvSuLCCZaZ2g4JqM2y3f1V4nQc3sQBEx1JRk2b//PoD4VVGfJQgh7YuY X-Received: by 10.99.3.216 with SMTP id 207mr24151599pgd.163.1523251044280; Sun, 08 Apr 2018 22:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523251044; cv=none; d=google.com; s=arc-20160816; b=cGqRC5sYIB2fRN3NEeRVfuQyzi3MJbdQW3A6IqcOWoZta/mAIf6Jecoiart/8OyqUl X9bCnCx4plEgQuAwcJ6LMXbAI7tHMBohaea/5Cdx28lJJvvCey0nF+cVCMP+XaNx5obV 8Q0Q0uYAFzItKRWypfPgNT2A4RMswp/gPafAdgws5AGJjQLY7qnYhdn5T6Y3aXdVJZnM AI4kKGINymG29FJuwNArfrLT1Di6qAOB7ieE9mnyH91cQCiO5wA+PQP6w9+4Zg6aYGYH XYJbkj6Bx9ZcL2lDsZzbjQbwbntw1kt2c0Bdc19tomJct0RlwmQPH+uKB26C1AyAWyAF +QPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=O991OOqxSzxj0CB5vh1kWmChg/sdU5oZ0snSDJWDdD0=; b=YCRYGlZhsLanCSSVsScWyzwr7i6pjwvZuGms7XAfQFxxAF/T5CL1BABHirS8eHmGjW THvyQCfYD243HLWSH1x+0wnr+SklVFXa9l+hMKc84AD8am9gCrCGIL0sINoQLqWWff8I EzVmkzDnvaYhqU57epMo2so7d9SzDEdYn9oeO0/+zmq36t0jwkVY8ZH3lWqvXU9ukYZg pGAzS7Re8pF0BbtDyLM18kUAdJnQQdb/7ctRdevsWVjM/33AMIpIjKEiOIk4tlw1OmUf gkpxCUvcyN+aXWe8qAI3jYymTq0PgFw9nVgPlrcHHIBGSYnQ/ot16s+aozdz8pdJCQll Zdsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=U270ST96; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3-v6si14245957pld.2.2018.04.08.22.16.47; Sun, 08 Apr 2018 22:17:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=U270ST96; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754203AbeDIAUS (ORCPT + 99 others); Sun, 8 Apr 2018 20:20:18 -0400 Received: from mail-sn1nam02on0102.outbound.protection.outlook.com ([104.47.36.102]:30848 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753783AbeDIATe (ORCPT ); Sun, 8 Apr 2018 20:19:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=O991OOqxSzxj0CB5vh1kWmChg/sdU5oZ0snSDJWDdD0=; b=U270ST96qUTOizJHOX5LVmFkYGPc2F2N9vUBRWtTJV9RemSCb0Wd+zN0LFuZTQTinqqZz8pOpZpP2rfZGM6O28UtSgC61rvq80ej82gvvvO+WkValA25EkuCBwXIxG8p0wfPSpCti9CNr3inDk4FFiAzq75U90zx95tSwIyAl88= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0726.namprd21.prod.outlook.com (10.167.108.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:19:28 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:19:28 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: piaojun , Mark Fasheh , Joel Becker , Junxiao Bi , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 116/189] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Thread-Topic: [PATCH AUTOSEL for 4.15 116/189] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Thread-Index: AQHTz5hCov3Rx7RT70+np3kCS6m82g== Date: Mon, 9 Apr 2018 00:18:17 +0000 Message-ID: <20180409001637.162453-116-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0726;7:aCYpRbl+OQ7sE3ugLzvpK/QBCxCau2sxvZ9ZcBwLRSdWb/Nou1EYMnqasNjyJGrvUS+XSiwT36iThHaGRd8lVwTcf9Ru+06ooda1sDqa+88aWP2FjL5j14gYk2clcL6rEU5TWgH2LN5ve/s8tIQtz51OWmWcpd3SHEsLakVG+0T/+GJNBYkQEchZ/DCx7L5bn9KMDz5NLejTpdLwVBFtIQAIZXSH5RND/LrQ77Wr86rSEBt+aDWeHaZm1bMQa1p6;20:d9ZrKLg4NBJJwO+jVEzInlQ0ugAlB+Rd7Y1oCCZPlQTgB1tqLNzMuXilC2AHf3gPAmI4BW3W0n0u5zsAKC8cO6LkOXioX27yNbuYsh1UjXmWW2k2RIv4n0a0tUdJMttI3BN6RK5f5hXOmWKAIXEmEmlRruInEmzczC9ywt2epoE= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 9368d0d7-9346-44ca-f0a0-08d59daf8eab x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0726; x-ms-traffictypediagnostic: DM5PR2101MB0726: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(85827821059158)(42068640409301)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0726;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0726; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(39380400002)(39860400002)(396003)(376002)(199004)(189003)(6306002)(6486002)(26005)(6512007)(4326008)(81166006)(6666003)(6436002)(81156014)(8676002)(97736004)(186003)(36756003)(72206003)(53936002)(107886003)(2906002)(966005)(86362001)(76176011)(110136005)(305945005)(10090500001)(486006)(3660700001)(102836004)(5660300001)(14454004)(476003)(86612001)(446003)(99286004)(68736007)(66066001)(11346002)(54906003)(2616005)(1076002)(7736002)(5250100002)(25786009)(8936002)(478600001)(2900100001)(2501003)(3280700002)(105586002)(59450400001)(316002)(106356001)(22452003)(6506007)(3846002)(10290500003)(6116002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0726;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: yROJ1VWJ4sfcfBaHbAApBlNLl0pXnuYoYaubP8+fKMV4LOHLQKdDqcimds/WjaFla0o3hsmybIEC4znAlVkzYskTZOArfYMHEkBml3H/mrIDWQ1kqINkCzWjmIHUdyUy2c4JomcwcS/exWn2wY2rYtNA1Qj5dvqF2SvXZI13j3FJFIAo7M0xHj437iSrjVE0JSjftt4+W1YFckFXMlK7bDwQi7RbLkIaryTz90eTUxPpYplFlCssFY/AROw3GdkTTtkgGtAAGk3i67EeKq+81Z2oTHCzaazso44cj0xKCq/2LriDItJH+Eo1KyPher/m+LODf3ULxSOoF/aC3DYflorAwIrraVma1RmeTl4tXtWlooZyjVg/H6v1fF8+w6VeZWKucySbss4bVV/j3hGp0w5eXQC3uBJN1HJVfpNONb8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9368d0d7-9346-44ca-f0a0-08d59daf8eab X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:18:17.7870 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0726 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: piaojun [ Upstream commit 025bcbde3634b2c9b316f227fed13ad6ad6817fb ] If metadata is corrupted such as 'invalid inode block', we will get failed by calling 'mount()' and then set filesystem readonly as below: ocfs2_mount ocfs2_initialize_super ocfs2_init_global_system_inodes ocfs2_iget ocfs2_read_locked_inode ocfs2_validate_inode_block ocfs2_error ocfs2_handle_error ocfs2_set_ro_flag(osb, 0); // set readonly In this situation we need return -EROFS to 'mount.ocfs2', so that user can fix it by fsck. And then mount again. In addition, 'mount.ocfs2' should be updated correspondingly as it only return 1 for all errno. And I will post a patch for 'mount.ocfs2' too. Link: http://lkml.kernel.org/r/5A4302FA.2010606@huawei.com Signed-off-by: Jun Piao Reviewed-by: Alex Chen Reviewed-by: Joseph Qi Reviewed-by: Changwei Ge Reviewed-by: Gang He Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/ocfs2/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 80efa5699fb0..63b3fa519758 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -474,9 +474,8 @@ static int ocfs2_init_global_system_inodes(struct ocfs2= _super *osb) new =3D ocfs2_get_system_file_inode(osb, i, osb->slot_num); if (!new) { ocfs2_release_system_inodes(osb); - status =3D -EINVAL; + status =3D ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL; mlog_errno(status); - /* FIXME: Should ERROR_RO_FS */ mlog(ML_ERROR, "Unable to load system inode %d, " "possibly corrupt fs?", i); goto bail; @@ -505,7 +504,7 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_= super *osb) new =3D ocfs2_get_system_file_inode(osb, i, osb->slot_num); if (!new) { ocfs2_release_system_inodes(osb); - status =3D -EINVAL; + status =3D ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL; mlog(ML_ERROR, "status=3D%d, sysfile=3D%d, slot=3D%d\n", status, i, osb->slot_num); goto bail; --=20 2.15.1