From patchwork Mon Nov 19 05:23:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 999643 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42yy2l70sRz9s3q for ; Mon, 19 Nov 2018 16:25:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725981AbeKSPrc (ORCPT ); Mon, 19 Nov 2018 10:47:32 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35556 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbeKSPrc (ORCPT ); Mon, 19 Nov 2018 10:47:32 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAJ5P1aq096770 for ; Mon, 19 Nov 2018 00:25:02 -0500 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nujcasrr0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Nov 2018 00:25:01 -0500 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Nov 2018 05:23:56 -0000 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 19 Nov 2018 05:23:52 -0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAJ5NpL925559196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 19 Nov 2018 05:23:51 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 929996A04D; Mon, 19 Nov 2018 05:23:51 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8E086A051; Mon, 19 Nov 2018 05:23:49 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.101]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 19 Nov 2018 05:23:49 +0000 (GMT) From: Chandan Rajendra To: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Chandan Rajendra , ebiggers@kernel.org, tytso@mit.edu Subject: [PATCH 6/7] f2fs: use IS_VERITY() to check inode's fsverity status Date: Mon, 19 Nov 2018 10:53:23 +0530 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119052324.31456-1-chandan@linux.vnet.ibm.com> References: <20181119052324.31456-1-chandan@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18111905-0004-0000-0000-000014B47499 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010077; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01119549; UDB=6.00580865; IPR=6.00899671; MB=3.00024223; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-19 05:23:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111905-0005-0000-0000-0000898E8C2D Message-Id: <20181119052324.31456-7-chandan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-19_02:, , 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-1811190050 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This commit now uses IS_VERITY() macro to check if fsverity is enabled on an inode. Signed-off-by: Chandan Rajendra Acked-by: Chao Yu --- 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)