From patchwork Tue Dec 4 09:56:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 10711437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 841E71057 for ; Tue, 4 Dec 2018 09:57:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7785A2B3DA for ; Tue, 4 Dec 2018 09:57:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BB3A2B3F7; Tue, 4 Dec 2018 09:57:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F32272B3E4 for ; Tue, 4 Dec 2018 09:57:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbeLDJ5w (ORCPT ); Tue, 4 Dec 2018 04:57:52 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59404 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726001AbeLDJ5v (ORCPT ); Tue, 4 Dec 2018 04:57:51 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB49rw5K135763 for ; Tue, 4 Dec 2018 04:57:50 -0500 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0b-001b2d01.pphosted.com with ESMTP id 2p5npb54mk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 04 Dec 2018 04:57:50 -0500 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Dec 2018 09:57:49 -0000 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 4 Dec 2018 09:57:43 -0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wB49vfxb20119780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Dec 2018 09:57:41 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21CE0AC062; Tue, 4 Dec 2018 09:57:41 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4DF0BAC05E; Tue, 4 Dec 2018 09:57:35 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.71]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 4 Dec 2018 09:57:34 +0000 (GMT) From: Chandan Rajendra To: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-doc@vger.kernel.org, linux-mips@linux-mips.org, linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Chandan Rajendra , tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, jaegeuk@kernel.org, yuchao0@huawei.com, corbet@lwn.net, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, green.hu@gmail.com, deanbo422@gmail.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, richard@nod.at, dedekind1@gmail.com, adrian.hunter@intel.com, viro@zeniv.linux.org.uk Subject: [PATCH V2 6/7] f2fs: use IS_VERITY() to check inode's fsverity status Date: Tue, 4 Dec 2018 15:26:49 +0530 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181204095650.12562-1-chandan@linux.vnet.ibm.com> References: <20181204095650.12562-1-chandan@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18120409-0072-0000-0000-000003D3A8CC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010169; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01126789; UDB=6.00582089; IPR=6.00906923; MB=3.00024437; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-04 09:57:48 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18120409-0073-0000-0000-00004A5367D4 Message-Id: <20181204095650.12562-7-chandan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-04_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812040087 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This commit now uses IS_VERITY() macro to check if fsverity is enabled on an inode. Acked-by: Chao Yu Signed-off-by: Chandan Rajendra --- fs/f2fs/file.c | 6 +++--- fs/f2fs/inode.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 6c7ad15000b9..2eb4821d95d1 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -491,7 +491,7 @@ static int f2fs_file_open(struct inode *inode, struct file *filp) if (err) return err; - if (f2fs_verity_file(inode)) { + if (IS_VERITY(inode)) { err = fsverity_file_open(inode, filp); if (err) return err; @@ -701,7 +701,7 @@ int f2fs_getattr(const struct path *path, struct kstat *stat, struct f2fs_inode *ri; unsigned int flags; - if (f2fs_verity_file(inode)) { + if (IS_VERITY(inode)) { /* * For fs-verity we need to override i_size with the original * data i_size. This requires I/O to the file which with @@ -800,7 +800,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) if (err) return err; - if (f2fs_verity_file(inode)) { + if (IS_VERITY(inode)) { err = fsverity_prepare_setattr(dentry, attr); if (err) return err; diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index ddef483ad689..02806feed64c 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -45,9 +45,11 @@ void f2fs_set_inode_flags(struct inode *inode) new_fl |= S_DIRSYNC; if (f2fs_encrypted_inode(inode)) new_fl |= S_ENCRYPTED; + if (f2fs_verity_file(inode)) + new_fl |= S_VERITY; inode_set_flags(inode, new_fl, S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC| - S_ENCRYPTED); + S_ENCRYPTED|S_VERITY); } static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)