Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp149777imm; Tue, 28 Aug 2018 18:45:40 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda16CQHUHIX/hAdvUiHIxtux2xqPzDhja4GKIA82U1gIp11Fb8gMqZrYu+uV9FgF8UGZWxr X-Received: by 2002:a17:902:da4:: with SMTP id 33-v6mr3855817plv.193.1535507140027; Tue, 28 Aug 2018 18:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535507139; cv=none; d=google.com; s=arc-20160816; b=ox/mLjNIOUZ21jmE6YQdk0KNHcnfV5gHvboFrryO+O1ze8CxTWdmb/PFcLs8Da3cev hv+XmvXe0s+T7xTmYZAia86maT6WYhUcgUVnZyzuoGGazZTXBNCBSRZwTTLWgKT+vN7t KPVfKbLHNSrY7x6zG4/0c+0CYcSCkIlhCj9yzimmuqovmXR3PHeMDUVplLe8Hoo0Z3EY o8X6dVKTWP/PWcoiUCGBQRPLpEzUXNLhhCXTFfuCMfSSwyDI5t7x9+RmmFzggau/lW84 YZSniAOLw+kKf+w5dDake/Qdx58OQVu37joXkIUEHOonC8Y9c21x69CGiU4Zvdr3BxVA UpwQ== 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:arc-authentication-results; bh=BOEdTjCLF72eW9x9fqmx/EYQDNv6YwhdxpoVbFSJvCo=; b=D8xQZqB1xM738TAu+oUZd3g1Ll7obuv9D3s0jEVlY3al7Nb4mfo+Hs0PJsPSqta5Dw hLSTzYWYPp2U+UMdmBosbRMrZePl2Osn6k3b1Sjd6zk9/xR7Ojb/Dw2UmgCp5LydH5Ee GUvp9MHb/JGg3A1zb9jgaLyIp+LzaXcbnSJF2M7N0Dzk3p5+I8/Chc0dyaTKVQ7e7nTH iBdBC/WOq7bfokEj1sawMmnQUU15ZkOFSq5dQQaN3TfYWpu3wJ+/Krx9fimoQyR4XW/6 KjP8J4g/h2Pj3vYYYYVXkC9Yv4CbW7uedAgS/rR9VOT09NGMEU3HSS2YOcE5Z0W7/zzR DlRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oqO+krfY; 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 u64-v6si2402709pfd.297.2018.08.28.18.45.24; Tue, 28 Aug 2018 18:45:39 -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=oqO+krfY; 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 S1727207AbeH2FiN (ORCPT + 99 others); Wed, 29 Aug 2018 01:38:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:44044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725199AbeH2FiN (ORCPT ); Wed, 29 Aug 2018 01:38:13 -0400 Received: from localhost (unknown [104.132.1.88]) (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 8299820846; Wed, 29 Aug 2018 01:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535507028; bh=fPTG1FHoFxza2ITx4F9+e4FMFnXOkumNgAKGeV31Gzc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oqO+krfYgxNy3dM9OcAPlN0l1HL6xcL7NBF41tUMxvXqcQP/F5IEtPm97teseyFCe ECBtxmFM+h1A86QgDcCe4L4RSPd2/5qOSe7+Thm+E3zLlI4GIzTxk5QRd2j60SHynE YaIMhby+G6NpOK2KaDkyB1aebiu/+ZWeWf5q+46w= Date: Tue, 28 Aug 2018 18:43:47 -0700 From: Jaegeuk Kim To: Chao Yu Cc: Chao Yu , Eric Biggers , Dmitry Kasatkin , Michael Halcrow , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-ext4@vger.kernel.org, Mimi Zohar , Victor Hsieh Subject: Re: [f2fs-dev] [RFC PATCH 10/10] f2fs: fs-verity support Message-ID: <20180829014347.GA27219@jaegeuk-macbookpro.roam.corp.google.com> References: <20180824161642.1144-1-ebiggers@kernel.org> <20180824161642.1144-11-ebiggers@kernel.org> <20180826173507.GC728@sol.localdomain> <20180828072756.GC29049@jaegeuk-macbookpro.roam.corp.google.com> <63a19512-e938-d239-9e3c-f6ecc479478c@huawei.com> <20180828170142.GB62482@jaegeuk-macbookpro.roam.corp.google.com> <8b7f83db-810a-bdd6-85b0-1248dc14f8d7@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b7f83db-810a-bdd6-85b0-1248dc14f8d7@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 08/29, Chao Yu wrote: > On 2018/8/29 1:01, Jaegeuk Kim wrote: > > On 08/28, Chao Yu wrote: > >> On 2018/8/28 15:27, Jaegeuk Kim wrote: > >>> On 08/27, Chao Yu wrote: > >>>> Hi Eric, > >>>> > >>>> On 2018/8/27 1:35, Eric Biggers wrote: > >>>>> Hi Chao, > >>>>> > >>>>> On Sat, Aug 25, 2018 at 01:54:08PM +0800, Chao Yu wrote: > >>>>>> On 2018/8/25 0:16, Eric Biggers wrote: > >>>>>>> From: Eric Biggers > >>>>>>> #ifdef CONFIG_F2FS_CHECK_FS > >>>>>>> #define f2fs_bug_on(sbi, condition) BUG_ON(condition) > >>>>>>> #else > >>>>>>> @@ -146,7 +149,7 @@ struct f2fs_mount_info { > >>>>>>> #define F2FS_FEATURE_QUOTA_INO 0x0080 > >>>>>>> #define F2FS_FEATURE_INODE_CRTIME 0x0100 > >>>>>>> #define F2FS_FEATURE_LOST_FOUND 0x0200 > >>>>>>> -#define F2FS_FEATURE_VERITY 0x0400 /* reserved */ > >>>>>>> +#define F2FS_FEATURE_VERITY 0x0400 > >>>>>>> > >>>>>>> #define F2FS_HAS_FEATURE(sb, mask) \ > >>>>>>> ((F2FS_SB(sb)->raw_super->feature & cpu_to_le32(mask)) != 0) > >>>>>>> @@ -598,7 +601,7 @@ enum { > >>>>>>> #define FADVISE_ENC_NAME_BIT 0x08 > >>>>>>> #define FADVISE_KEEP_SIZE_BIT 0x10 > >>>>>>> #define FADVISE_HOT_BIT 0x20 > >>>>>>> -#define FADVISE_VERITY_BIT 0x40 /* reserved */ > >>>>>>> +#define FADVISE_VERITY_BIT 0x40 > >>>>>> > >>>>>> As I suggested before, how about moving f2fs' verity_bit from i_fadvise to more > >>>>>> generic i_flags field like ext4, so we can a) remaining more bits for those > >>>>>> demands which really need file advise fields. b) using i_flags bits keeping line > >>>>>> with ext4. Not sure, if user want to know whether the file is verity one, it > >>>>>> will be easy for f2fs to export the status through FS_IOC_SETFLAGS. > >>>>>> > >>>>>> #define EXT4_VERITY_FL 0x00100000 /* Verity protected inode */ > >>>>>> > >>>>>> #define F2FS_VERITY_FL 0x00100000 /* Verity protected inode */ > >>>>>> > >>>>> > >>>>> I don't like using i_advise much either, but I actually don't see either > >>>>> location being much better than the other at the moment. The real problem is an > >>>>> artificial one: the i_flags in f2fs's on-disk format are being assumed to use > >>>> > >>>> Yeah, but since most copied flags from vfs/ext4 are not actually used in f2fs, > >>>> also 0x00100000 bit is not used now, so we can just define it now directly for > >>>> verity bit. > >>>> > >>>> Cleanup and remapping in ioctl interface for those unused flags, we can do it > >>>> latter? > >>> > >>> No, it was reserved by f2fs-tools, > >> > >> That's not a problem, since we didn't use that reserved bit in any of images > >> now, there is no backward compatibility issue. > > > > We're using that. > > Oops, if it was in production, I agree to keep it in i_advice, otherwise, we > still can discuss its location. > > > > >> > >>> and I think this should be aligned to the encryption bit. > >> > >> Alright, we could, but if so, i_advise will run out of space earlier, after that > >> we have to add real advice bit into i_inline or i_flags, that would be a little > >> weird. > >> > >> For encryption bit, as a common vfs feature flag, in the beginning of encryption > >> development, it will be better to set it into i_flags, IMO, but now, we have to > >> keep it as it was. > >> > >>> Moreover, we guarantee i_flags less strictly from power-cut than i_advise. > >> > >> IMO, in power-cut scenario, it needs to keep both i_flags and i_advise being > >> recoverable strictly. Any condition that we can not recover i_flags? > > > > In __f2fs_ioc_setflags, f2fs_mark_inode_dirty_sync(inode, false); > > Ah, that's right, do you remember why we treat them with different recoverable > level? Since I thought that such the flags wouln't be critical on power cuts, but be enough for us to guarantee by write_inode() or fsync(). > > Thanks, > > > > >> > >> Thanks, > >> > >>> > >>>> > >>>> Thanks, > >>>> > >>>>> the same numbering scheme as ext4's on-disk format, which makes it seem that > >>>>> they have to be in sync, and that all new ext4 flags (say, EA_INODE) also > >>>>> reserve bits in f2fs and vice versa, when they in fact do not. Instead, f2fs > >>>>> should use its own numbering for its i_flags, and it should map them to/from > >>>>> whatever is needed for common APIs like FS_IOC_{GET,SET}FLAGS and > >>>>> FS_IOC_FS{GET,SET}XATTR. > >>>>> > >>>>> So putting the verity flag in *either* location (i_advise or i_flags) is just > >>>>> kicking the can down the road. If I get around to it I will send a patch that > >>>>> cleans up the f2fs flags properly...> > >>>>> Thanks, > >>>>> > >>>>> - Eric > >>>>> > >>>>> ------------------------------------------------------------------------------ > >>>>> Check out the vibrant tech community on one of the world's most > >>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot > >>>>> _______________________________________________ > >>>>> Linux-f2fs-devel mailing list > >>>>> Linux-f2fs-devel@lists.sourceforge.net > >>>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel > >>>>> > >>> > >>> . > >>> > > > > . > >