From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88EE3C4321B for ; Tue, 11 Jun 2019 01:43:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A3D720652 for ; Tue, 11 Jun 2019 01:43:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390732AbfFKBny (ORCPT ); Mon, 10 Jun 2019 21:43:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:18544 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389168AbfFKBnx (ORCPT ); Mon, 10 Jun 2019 21:43:53 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 78CCC6CE4E63A440A303; Tue, 11 Jun 2019 09:43:49 +0800 (CST) Received: from [10.151.23.176] (10.151.23.176) by smtp.huawei.com (10.3.19.213) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Jun 2019 09:43:41 +0800 Subject: Re: [PATCH 1/2] staging: erofs: add requirements field in superblock To: Chao Yu CC: Greg Kroah-Hartman , , LKML , , Chao Yu , Miao Xie , , Fang Wei , References: <20190610093640.96705-1-gaoxiang25@huawei.com> From: Gao Xiang Message-ID: <6993c266-0c95-780f-56b2-97996ee3be73@huawei.com> Date: Tue, 11 Jun 2019 09:43:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.151.23.176] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chao, On 2019/6/11 9:37, Chao Yu wrote: > On 2019/6/10 17:36, Gao Xiang wrote: >> There are some backward incompatible optimizations pending >> for months, mainly due to on-disk format expensions. >> >> However, we should ensure that it cannot be mounted with >> old kernels. Otherwise, it will causes unexpected behaviors. >> >> Fixes: ba2b77a82022 ("staging: erofs: add super block operations") >> Cc: # 4.19+ >> Signed-off-by: Gao Xiang >> --- >> drivers/staging/erofs/erofs_fs.h | 11 +++++++++-- >> drivers/staging/erofs/super.c | 8 ++++++++ >> 2 files changed, 17 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h >> index fa52898df006..531821757845 100644 >> --- a/drivers/staging/erofs/erofs_fs.h >> +++ b/drivers/staging/erofs/erofs_fs.h >> @@ -17,10 +17,16 @@ >> #define EROFS_SUPER_MAGIC_V1 0xE0F5E1E2 >> #define EROFS_SUPER_OFFSET 1024 >> >> +/* >> + * Any bits that aren't in EROFS_ALL_REQUIREMENTS should be >> + * incompatible with this kernel version. >> + */ >> +#define EROFS_ALL_REQUIREMENTS 0 >> + >> struct erofs_super_block { >> /* 0 */__le32 magic; /* in the little endian */ >> /* 4 */__le32 checksum; /* crc32c(super_block) */ >> -/* 8 */__le32 features; >> +/* 8 */__le32 features; /* extra features for the image */ >> /* 12 */__u8 blkszbits; /* support block_size == PAGE_SIZE only */ >> /* 13 */__u8 reserved; >> >> @@ -34,8 +40,9 @@ struct erofs_super_block { >> /* 44 */__le32 xattr_blkaddr; >> /* 48 */__u8 uuid[16]; /* 128-bit uuid for volume */ >> /* 64 */__u8 volume_name[16]; /* volume name */ >> +/* 80 */__le32 requirements; /* all mandatory minimum requirements */ >> >> -/* 80 */__u8 reserved2[48]; /* 128 bytes */ >> +/* 84 */__u8 reserved2[44]; /* 128 bytes */ > > Xiang, > > It needs to update the comment behind reserved2, it's locating at 132 bytes. I don't get the point... the whole struct is totally 128bytes I think? > >> } __packed; >> >> /* >> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c >> index f580d4ef77a1..815e5825db59 100644 >> --- a/drivers/staging/erofs/super.c >> +++ b/drivers/staging/erofs/super.c >> @@ -104,6 +104,14 @@ static int superblock_read(struct super_block *sb) >> goto out; >> } >> >> + /* check if the kernel meets all mandatory requirements */ >> + if (le32_to_cpu(layout->requirements) & (~EROFS_ALL_REQUIREMENTS)) { >> + errln("too old to meet minimum requirements: %x supported: %x", > > It will be better to give a suggestion to user to upgrade kernel version to > match the image with new layout, otherwise it's just a little confused about > above printed message. OK, I will refine the printed message :) Thanks, Gao Xiang > > Thanks, > >> + le32_to_cpu(layout->requirements), >> + EROFS_ALL_REQUIREMENTS); >> + goto out; >> + } >> + >> sbi->blocks = le32_to_cpu(layout->blocks); >> sbi->meta_blkaddr = le32_to_cpu(layout->meta_blkaddr); >> #ifdef CONFIG_EROFS_FS_XATTR >>