Received: by 10.192.165.148 with SMTP id m20csp543193imm; Wed, 25 Apr 2018 04:01:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx49LDwYpgdeLfl7U8uXoTJQnsNVHhZhHnyGZ5vV0KUxdhsF+NZ2+u8SYXUiScMZPspSaUamb X-Received: by 10.99.97.151 with SMTP id v145mr23794079pgb.35.1524654070245; Wed, 25 Apr 2018 04:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524654070; cv=none; d=google.com; s=arc-20160816; b=c6AH65UKf02Kwhwb3eRafye6s4r1GjuB18NKsJJyqbpkZWiggeySSKSik2udXNA4RS wePXx2k9H2KkUwZ8s9r5NB6+jhEC3HfyXJIxc+Pjp07wK2EK4+5WwssgrZY38KL70BQX /CfdSTebMgVNrg+kB7FKrBaMzIEa7VDX4ndCiYaOg1TR307R2YvvzFkFSSQVSPjuPpyx 7U1Cy9a9hOCqF149U4HoRl/18SiYO0QdWHPX3Lxei0JWB1DcMwzpEBc5ZUuGcK8dP9uL 5K6OMgSLGN4KcG1TjGnhtdCzu2LFDUHhb13QrbIw2t/IziwR5wY3iyIlvcP6ie5lvQpR whhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=mPCMXBmZNfp7GpPJIiW8ZtY8ccDrX+wDqPJnu2zp61M=; b=pdN0j1/SKhVyumd1f5vVdBKSLa0EpDd2x282ZShFJsK5uxcEM643VYT7zZ8b2PWaqC m2Q5/WJtLUVGWYAPSgzOTTLDQLq/KwmqtxgeGs3ch/eYnlcxrjdLE6+FYhTV8hgJLhbl 04xSgiDJ7HSwB+U91tGUjNR4QRjYcmafOc89HhWItD96J7TQr9BNaK9xh+05m9m2q9XU Ya5a1rqbG09177zifksyoVkhuqoj5/lnb7Ic8F42XY/rm7GobFCAjKNjx3wLLRjY5QXJ Sf54V9sM0EHZ+JCyQKJD5VUemvVQQrNtIABYAxzXIGUeAO+xSieqO3dyJtbaq0FjQ5Bu SCow== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si14779496plp.221.2018.04.25.04.00.55; Wed, 25 Apr 2018 04:01:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754132AbeDYK7x (ORCPT + 99 others); Wed, 25 Apr 2018 06:59:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52750 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754120AbeDYKmr (ORCPT ); Wed, 25 Apr 2018 06:42:47 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 275D8480; Wed, 25 Apr 2018 10:42:46 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jun Piao , Alex Chen , Joseph Qi , Changwei Ge , Gang He , Mark Fasheh , Joel Becker , Junxiao Bi , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 108/183] ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid Date: Wed, 25 Apr 2018 12:35:28 +0200 Message-Id: <20180425103246.794868956@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -474,9 +474,8 @@ static int ocfs2_init_global_system_inod new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); if (!new) { ocfs2_release_system_inodes(osb); - status = -EINVAL; + status = 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_inode new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); if (!new) { ocfs2_release_system_inodes(osb); - status = -EINVAL; + status = ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL; mlog(ML_ERROR, "status=%d, sysfile=%d, slot=%d\n", status, i, osb->slot_num); goto bail;