Received: by 10.213.65.68 with SMTP id h4csp2117174imn; Sun, 8 Apr 2018 20:08:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/zffjlSgIlw8PdEFgrwkQPvyNdMKDldzIld/4/riy0l73qaxkERagEBkyG7gBcebYQjCZy X-Received: by 2002:a17:902:a50d:: with SMTP id s13-v6mr2332607plq.228.1523243291537; Sun, 08 Apr 2018 20:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243291; cv=none; d=google.com; s=arc-20160816; b=j5fg9PZbHar9AwvrdkFnoVI5UeTyuw7rKc6R0qobhskb0bFLDgc4c/6bRlKkwZP+QJ KDQPDRSEI94kCl3++ePBB0Ywqc7HlIlcUxL8SoHxXtF8qGZGnUv2KBDtzcL/QBiXVGCq qcAwjQR40TpVDtlPbIVTQD5q+sDVnq0YBnxGLbhfA8ESRhINc+6JNDX33QIK8YlXdvCO /zFRMdWiiARaVrK02//zz2O7sDKd9IH/uZGEFwVk8QCQ92m3NWTFQR1ysqMnl1MhiaxS NlcRJK5KJxQGohdFkjXc1Oqp9rVqNYAFRJwmeG5zXB8NEVzL8C232qZpmnNsb9PYN0LN DMfQ== 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=uzwqB+jJ+qqZ1NI1KDJl0eBC8tW4kWY8v7vHVc4aWpo=; b=E3N69ttsKUge6XKC0IFvYhXRyihZpnjGnmTRv74Esd783jMA/jeLhpe0tx+tMs6nbD zMs5EZxkHwUv3iAS+VSL1TDKd8D8tT86sWI+MgbY6YS0xPjjbw+femZjRXZ/ZjJMHXHT bwURKQp3VrcFbs9L/H8lducFQKMykGCBQDrarIVLatdHaSvZLQ5caZTENAtRoWLVxv1a u/9T6rm1nA8YhxEc1/E7fIiUfUmXpTmVeRJcc7MsmhvxqL5VNms7L/QHFEmycLAevoUn UZwmHFbMsaVW/A824/LBtqbzgzyJbuxPTshv5+yjIlc3xJgOCu40Eg30xzj9DOIFz3+v cPpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=L81HSrpm; 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 s10si10742539pge.41.2018.04.08.20.07.34; Sun, 08 Apr 2018 20:08:11 -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=L81HSrpm; 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 S932435AbeDIBu0 (ORCPT + 99 others); Sun, 8 Apr 2018 21:50:26 -0400 Received: from mail-by2nam01on0130.outbound.protection.outlook.com ([104.47.34.130]:18358 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932362AbeDIAdy (ORCPT ); Sun, 8 Apr 2018 20:33:54 -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=uzwqB+jJ+qqZ1NI1KDJl0eBC8tW4kWY8v7vHVc4aWpo=; b=L81HSrpmm3OQCJfbwod9E2m1XDqJDNnq+Ht5MwRvKto8SxbwLF+5Ksuzx1wPpGHALW2JhuPJ7TIkGZ2mA5Lsm0baeqC+YK/CDMMSnsZX8nWHSdsEhp3qqAKTowXFgrXoIT4PFssk+OU9EwNSA8JcSKMgjdNFEzL9InchfFysp3o= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0806.namprd21.prod.outlook.com (10.167.107.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:33:50 +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:33:50 +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.9 254/293] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Thread-Topic: [PATCH AUTOSEL for 4.9 254/293] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Thread-Index: AQHTz5lc7y3BvHcHckefqAJBPB9tbA== Date: Mon, 9 Apr 2018 00:26:10 +0000 Message-ID: <20180409002239.163177-254-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0806;7:56lRjWYwX68SrXwRKkt2PPNva3p6z0SwU2ljBDoj44cYvzH7YYY/klUSoP4Opx6ar4FPlTy5O3oQJ4gS7C77CDixiq5S78d5GkGksCNPOGQEjsTWOQkfJugrwhFPibRoswBLISBPzUdTXWWE8p8mfqDi8fQ9MucTlOpUy8wmtAiq+9roFUwYETyuj3JgBFLE2gXJH+SYG4feMlWAxWRAdjY73EZIyxvoIIct6TxiWUdCJbTZDue+cO8kSq/d1Zqe;20:6dQp7Mb2pHou9kzcF2x4YQVoP60kwu9ND/EWPEtIWzb+z7/J7FHSZ920a5+MG/FvFuqKIXrRJttKMi1BbCTqAzd/S8m1JkX/Tho/INovbdpJwySTVa+Hmh/0U2nEs0hbltxU5SenqlkOAXeKRca7zVgJpHJNAAmgTBMEEoGCTi0= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 47ee9d31-ac34-4003-0e99-08d59db19087 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0806; x-ms-traffictypediagnostic: DM5PR2101MB0806: 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)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0806;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0806; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(39380400002)(199004)(189003)(2906002)(25786009)(2501003)(10290500003)(476003)(11346002)(446003)(97736004)(5250100002)(68736007)(2616005)(102836004)(6506007)(59450400001)(3846002)(3660700001)(486006)(3280700002)(305945005)(6666003)(99286004)(5660300001)(76176011)(1076002)(186003)(26005)(7736002)(6116002)(81156014)(81166006)(86612001)(4326008)(105586002)(10090500001)(2900100001)(54906003)(22452003)(316002)(36756003)(110136005)(107886003)(8676002)(6436002)(478600001)(53936002)(66066001)(6486002)(6512007)(6306002)(86362001)(966005)(14454004)(72206003)(8936002)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0806;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: cPvg8aPjysnsP6Zm1mdPiVh/d6xUYgCBhWT/izg2wbqZ1U7yMozy4AcY996NN9bshatM5NWnkmoISTtBs17NmmC7vTyfoMkCUBTChqoF8wbTc+yfacclMAWKIqmwrru3+AVQLhC0w6GxQPldR6SbmAd6URODTPd3nGPq8BwfUHVxAkrBosvRGXvYhXPte8h05D8q+sHes64VP4XSIyOxdU/DzwYrSgtlK3FopZMx3YQFozXXsFmRUJIa39lCdLzv4LfV0Xxt1UegQYwHL6tbdrnccXX9upRBoFtPTtmeTqTGZdpaE5fsXN1WntXhFhcbb48bFSxjehjTwxVBOpQKHi5J7N87pkF7rcdWIYnuk1Rwk/zrpDDqyDtgN6etElRBpTcPvFT6uFa81FEszLBZVan81udQiVhUyDqF+Je7s7I= 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: 47ee9d31-ac34-4003-0e99-08d59db19087 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:10.8944 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0806 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 f56fe39fab04..64dfbe5755da 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -473,9 +473,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; @@ -504,7 +503,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