Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2679919yba; Sun, 28 Apr 2019 06:39:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG/oWkyGVwOYt7O9zOERtB86HvUPXxh6uv0G7CJoNvqTK3VGDtMAIIWq35gsIKaa3iwFit X-Received: by 2002:a17:902:9a48:: with SMTP id x8mr9557886plv.133.1556458755217; Sun, 28 Apr 2019 06:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556458755; cv=none; d=google.com; s=arc-20160816; b=YkMs7VEBLSOihvPBfJosWS37Ims2pOlrfsMbKBGJ23hVt+sxCPbLe7LTSqeaexfmYL FOuUoYSW6vFfbj6Qdq30VorPXOIQI/CMvMrewwewj7rCM0x5EKBSH4EsZNfBq80FCh/V DDobyqIYwRjBfRoxLGJoPcImzYvzJXL1GqzxuU1sphNXeOgCEXLi519inNpTFafHBcZp FZD1l3YsbY4ngFS0xCr7wKPWo7oUcm7nLZNf0i3i+QTDuDlYt1MkP4DfexaERkNFy4Vk FeafxnO5DXjdMEN+xmj1AjDxjJMjMdI7Tb4qBCGI3YCA/5lIrJb/XVEXPjPQDmAmHdhU eNtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kaZHVX/u/d+1KJy2dm6J8EDLqqvd0WYoGt43ylv/FPU=; b=YD4+hrkZ22wTYVV7gqETEjMxfVI9cUSgqtxcQgv2eIoqhUXFOU13anhYhBsSvN1y8r sRN14hkG+NUw/2ch/2nm5buN1gqe8m/9zkmmiGU4idaW282p3vjbW62Op8tEdDZ6BojI TevzwewLZOdR2I2+kXHWFtaEYgo1JcI9/xoKdiVHwoK0SJrwnXVbo5cdh6iYrc9GTYA/ Fr7r+P3/9Kq8fbytfyNjezdQd2F3J07XhD3ZOQN6fKKVBBiuk2D4h4XldP7WaWzQHapU p4gQVeHo473gOXhT1cN3XMHsq23x1WuZayQn/6bgmSFgS74qKA6h1BeUTV7bloeIoUi8 NMTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EFzaStJs; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci14si32232168plb.264.2019.04.28.06.38.58; Sun, 28 Apr 2019 06:39:15 -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=@kernel.org header.s=default header.b=EFzaStJs; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726692AbfD1NiD (ORCPT + 99 others); Sun, 28 Apr 2019 09:38:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:33094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfD1NiD (ORCPT ); Sun, 28 Apr 2019 09:38:03 -0400 Received: from localhost (c-98-234-77-170.hsd1.ca.comcast.net [98.234.77.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B55FE2075D; Sun, 28 Apr 2019 13:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556458682; bh=QuDBWSOMxeWxn8rm9QLXVNTmqvyLc+6Vw04OqkVXSTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EFzaStJsh/d6K4YIMFF/XXWluWylVxWpCBUGd9AjZBJenMYywvVYMc/dKqR/mqRM+ c+v3dF+KonZwRaAM0md88W9LSIhbz0W0rICFme8v7YmsF2hzvtNOJi6e8K/gPwMaDw CXFu3vbRCLkI6zTgmWeMmW9lCvQXyqO4wDZ7KcDE= Date: Sun, 28 Apr 2019 06:38:02 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, chao@kernel.org Subject: Re: [PATCH] f2fs: fix to do sanity with enabled features in image Message-ID: <20190428133802.GB37346@jaegeuk-macbookpro.roam.corp.google.com> References: <20190424094850.118323-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190424094850.118323-1-yuchao0@huawei.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/24, Chao Yu wrote: > This patch fixes to do sanity with enabled features in image, if > there are features kernel can not recognize, just fail the mount. We need to figure out per-feature-based rejection, since some of them can be set without layout change. > > Signed-off-by: Chao Yu > --- > fs/f2fs/f2fs.h | 13 +++++++++++++ > fs/f2fs/super.c | 9 +++++++++ > 2 files changed, 22 insertions(+) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index f5ffc09705eb..15b640967e12 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -151,6 +151,19 @@ struct f2fs_mount_info { > #define F2FS_FEATURE_VERITY 0x0400 /* reserved */ > #define F2FS_FEATURE_SB_CHKSUM 0x0800 > > +#define F2FS_ALL_FEATURES (F2FS_FEATURE_ENCRYPT | \ > + F2FS_FEATURE_BLKZONED | \ > + F2FS_FEATURE_ATOMIC_WRITE | \ > + F2FS_FEATURE_EXTRA_ATTR | \ > + F2FS_FEATURE_PRJQUOTA | \ > + F2FS_FEATURE_INODE_CHKSUM | \ > + F2FS_FEATURE_FLEXIBLE_INLINE_XATTR | \ > + F2FS_FEATURE_QUOTA_INO | \ > + F2FS_FEATURE_INODE_CRTIME | \ > + F2FS_FEATURE_LOST_FOUND | \ > + F2FS_FEATURE_VERITY | \ > + F2FS_FEATURE_SB_CHKSUM) > + > #define __F2FS_HAS_FEATURE(raw_super, mask) \ > ((raw_super->feature & cpu_to_le32(mask)) != 0) > #define F2FS_HAS_FEATURE(sbi, mask) __F2FS_HAS_FEATURE(sbi->raw_super, mask) > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 4f8e9ab48b26..57f2fc6d14ba 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -2573,6 +2573,15 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, > return 1; > } > > + /* check whether kernel supports all features */ > + if (le32_to_cpu(raw_super->feature) & (~F2FS_ALL_FEATURES)) { > + f2fs_msg(sb, KERN_INFO, > + "Unsupported feature:%u: supported:%u", > + le32_to_cpu(raw_super->feature), > + F2FS_ALL_FEATURES); > + return 1; > + } > + > /* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */ > if (sanity_check_area_boundary(sbi, bh)) > return 1; > -- > 2.18.0.rc1