Received: by 10.213.65.68 with SMTP id h4csp2121799imn; Sun, 8 Apr 2018 20:14:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx483A5krBg/iQqwHZlTD0ZoMkhH8VF6iysOmbJn8ldLqykLwad4RWqgMx7sI480lp2PNisJi X-Received: by 10.99.172.86 with SMTP id z22mr803691pgn.35.1523243663851; Sun, 08 Apr 2018 20:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243663; cv=none; d=google.com; s=arc-20160816; b=zRYYcAIv7KeG6k52B3HqYYLcS3CX85wtjOwZBcS50xeQ+nRnA5BkD3K+crXqVU6WXq WcYy/keqLVeHcRclyfU1CzLNMLX4aV7J2Lawl3gO1JoyCWI5olTs2T+XlkLbxahn4PIV c8QrfaNfYZ+Xo0jJsD5S0O7nMujREGEpld3iILHqUm43XRkWFCXXnGq2GALM1OhItkQJ T7YnhsXGI4ZRLDNA5d8bFvv+RKcuyjRuk6/mNlj0w+jjNnc1avJzLU5uwvcaJs6V17No QuZXWVkU0wpizbxX6zMOlhFjs+GafS56RBoosn9JoG277Nys9w0rSKn65Z6L87D8Xutx sEyw== 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=pZ3S254qET6mXJ6+QdMtAWternZYbesjswGJlANb/ng=; b=JRKyzrPSlvXRHumCP5ZnnCWhD6AHISk9hm9LOzpUOklBTtyNDl9a+yh/66ChyDb+lQ 4C6N1SNQccwKvPTsx5VIhLGc0cTYc5mw4QjPTmu6I0JcJ4SURLGftyc35ygBxYrAgh5T Va2K5z1aDLBtisdvQ/qJHJ5VJtXhY+Ol+kx5sHNCO+mw9WRTh0dBpVFLF1otlENuV7e3 6hRSz7ryOKkxJytsBqhD/Rn0Kql13VQxdo5rh1137nnBYWu3WsfL0MLa1PWH1+drGkXP Osm+KYunnvL+NkEK5zQY0mx00727vOoSubvyXCh0DAEJnqtksbHR+gfXJCWqnxs+bO2E ZLEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=EeXZ7QDR; 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 v23si11999305pfk.116.2018.04.08.20.13.47; Sun, 08 Apr 2018 20:14:23 -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=EeXZ7QDR; 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 S1753767AbeDIDGo (ORCPT + 99 others); Sun, 8 Apr 2018 23:06:44 -0400 Received: from mail-sn1nam02on0121.outbound.protection.outlook.com ([104.47.36.121]:44416 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932069AbeDIAYi (ORCPT ); Sun, 8 Apr 2018 20:24:38 -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=pZ3S254qET6mXJ6+QdMtAWternZYbesjswGJlANb/ng=; b=EeXZ7QDRo7nFvE+x2+g+XFQ0BCKdwpV6T8UHJBvCsVfGIrkfp3OIq1eyafSbKH3OXOtuBsIw5T+wrCYloy5vl+egc8c7V1XHALcRRZ7IfrPMcp9is/VctLidJoHKHS/hxqcqzw9FEa7cb1mVQ/W2SKxii/MlEuulN3f2ywPagTo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0983.namprd21.prod.outlook.com (52.132.133.29) 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:24:36 +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:24:36 +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.14 096/161] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Thread-Topic: [PATCH AUTOSEL for 4.14 096/161] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Thread-Index: AQHTz5inARkqSP/JcEKjfkzGzmBtoA== Date: Mon, 9 Apr 2018 00:21:07 +0000 Message-ID: <20180409001936.162706-96-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-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;DM5PR2101MB0983;7:vTtaJ9UAZUolWvuI0jzLjqPvtAqHGZ/cLtSqVIxpO6qYjMhARUvTJSF4Ny6Ohz7C51avlUezLFLtD6PiRhFI5upNbYmyqhqZmI6JNdK/4vQ24+EzJIp18Opiz98BYFZDiWUGfLvLnSCwH1QsoIqRZbOrrP9NOzhIzkoDTOeIpxkDUYt3Ljzx6z8sz2mtlPhFbBGNM19n6Bj8JeJTaSRSuKmMsmGUADBx0sJZQtCGKJvlVHcUGBhdgiASPistpA6u;20:kvuT8xO2OedQaJgd9BEK9DfnPylVSHF9ZXl2+YzYcRAkfH41Jk3vtjZmqklV95h2sCA1sgJgnXQ++Ft5giBI1Y3lLfEhxioNAUTd0QpxK3m6oI65rJrPiriJHx5RDIY08fS62Fj8qxf1w/LhnU/b9/I7Azm4mggnCCstFWfEJrI= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: d2622db9-8b5e-45b7-2029-08d59db04678 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0983; x-ms-traffictypediagnostic: DM5PR2101MB0983: 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)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0983;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0983; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(346002)(376002)(39380400002)(366004)(199004)(189003)(478600001)(59450400001)(72206003)(10290500003)(3846002)(102836004)(6506007)(6116002)(25786009)(6436002)(66066001)(99286004)(54906003)(86612001)(6666003)(105586002)(53936002)(76176011)(316002)(486006)(7736002)(22452003)(3660700001)(86362001)(97736004)(106356001)(8936002)(110136005)(5660300001)(11346002)(446003)(81166006)(81156014)(2906002)(8676002)(2900100001)(1076002)(476003)(2616005)(10090500001)(6486002)(107886003)(36756003)(4326008)(966005)(2501003)(68736007)(186003)(305945005)(3280700002)(5250100002)(6306002)(6512007)(26005)(14454004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0983;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: OPU6cpVxHggDd21nbCE7ySAipdGw22GVwa+G4sQix7kahYJRHulJCHiRGwE/9a7LQ+OvRr6AURZBs+1+V5tWXyzL8nybUGd0gHRIknpZoaSJYxW2EL1MRwGMZ8/fh/+UevmeDQ+PJtwQRzeBTXymlFplZo2bNB0oOhy+Bpj2fkvWoZBt4itYvqu3vU9bqfT0I0mj3bOkLEFF0cBAxy9TCl5313h/4qtJG9NT/zijkNwilTsQ9BD98Mj4KMPSQHb1KAuUc+s9+Nlfki/IT/Us4zasw10bJ7clvTwHBUQnAFStaWWpm/eSCj+rrIJB7PPJ65rwul6P52rhI0E1KvSWC5QM0x89kPQ+dBnTa86iyUgVLBqnkvrn16ueYxjcCOmg/uzGa13yIH6R4udA59ruGDS7uuBHPF59pOrmEEkLPs8= 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: d2622db9-8b5e-45b7-2029-08d59db04678 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:21:07.5501 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0983 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 80733496b22a..24ab735d91dd 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