From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:44808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727456AbeK0LbM (ORCPT ); Tue, 27 Nov 2018 06:31:12 -0500 Date: Mon, 26 Nov 2018 16:35:11 -0800 From: Eric Biggers Subject: Re: [PATCH 1/7] ext4: use IS_ENCRYPTED() to check encryption status Message-ID: <20181127003510.GD11663@gmail.com> References: <20181119052324.31456-1-chandan@linux.vnet.ibm.com> <20181119052324.31456-2-chandan@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119052324.31456-2-chandan@linux.vnet.ibm.com> Sender: linux-fscrypt-owner@vger.kernel.org To: Chandan Rajendra Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, tytso@mit.edu List-ID: Hi Chandan, On Mon, Nov 19, 2018 at 10:53:18AM +0530, Chandan Rajendra wrote: > @@ -4724,7 +4724,7 @@ static bool ext4_should_use_dax(struct inode *inode) > return false; > if (ext4_has_inline_data(inode)) > return false; > - if (ext4_encrypted_inode(inode)) > + if (IS_ENCRYPTED(inode)) > return false; > if (ext4_verity_inode(inode)) > return false; I think this part is wrong. See how ext4_should_use_dax() is called from ext4_set_inode_flags(), from ext4_set_context(). In this case, ext4_set_inode_flags() should set S_ENCRYPTED and clear S_DAX. However, you've changed ext4_should_use_dax() to check S_ENCRYPTED instead of EXT4_ENCRYPT_FL; but S_ENCRYPTED isn't set until later in ext4_set_inode_flags(), so S_DAX won't be cleared anymore. So I think you need to use ext4_test_inode_flag() here instead. Similarly for the verity check. - Eric From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Biggers Subject: Re: [PATCH 1/7] ext4: use IS_ENCRYPTED() to check encryption status Date: Mon, 26 Nov 2018 16:35:11 -0800 Message-ID: <20181127003510.GD11663@gmail.com> References: <20181119052324.31456-1-chandan@linux.vnet.ibm.com> <20181119052324.31456-2-chandan@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gRRLU-0003n3-18 for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Nov 2018 00:35:20 +0000 Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1gRRLS-00GXka-Of for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Nov 2018 00:35:19 +0000 Content-Disposition: inline In-Reply-To: <20181119052324.31456-2-chandan@linux.vnet.ibm.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Chandan Rajendra Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, tytso@mit.edu, linux-f2fs-devel@lists.sourceforge.net Hi Chandan, On Mon, Nov 19, 2018 at 10:53:18AM +0530, Chandan Rajendra wrote: > @@ -4724,7 +4724,7 @@ static bool ext4_should_use_dax(struct inode *inode) > return false; > if (ext4_has_inline_data(inode)) > return false; > - if (ext4_encrypted_inode(inode)) > + if (IS_ENCRYPTED(inode)) > return false; > if (ext4_verity_inode(inode)) > return false; I think this part is wrong. See how ext4_should_use_dax() is called from ext4_set_inode_flags(), from ext4_set_context(). In this case, ext4_set_inode_flags() should set S_ENCRYPTED and clear S_DAX. However, you've changed ext4_should_use_dax() to check S_ENCRYPTED instead of EXT4_ENCRYPT_FL; but S_ENCRYPTED isn't set until later in ext4_set_inode_flags(), so S_DAX won't be cleared anymore. So I think you need to use ext4_test_inode_flag() here instead. Similarly for the verity check. - Eric