Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp498773ybm; Thu, 28 May 2020 08:05:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5jwyesDuKnWb77zGyItYEjzhPMMkKmHSm4ATxCci0wnzMiFz3l0uqai6RycJqlgu+pcWe X-Received: by 2002:a05:6402:8d1:: with SMTP id d17mr3463107edz.38.1590678311164; Thu, 28 May 2020 08:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590678311; cv=none; d=google.com; s=arc-20160816; b=fiKpEOnCKfbNViZm3QL09twLx9Si3HaD5tKJ5cDU8J1X8yfj6N1FVUAfRRztUPlt0u Q2OZcaFM9SifOYlQcDg4H94lN8G7/992QfYuq+R0HViJc7b+41ezOLWnDTpO2O06wNbs imBK5gT8p+Sx603FuGa30rOS2l6p6F4gs72JXZimhGOL9TWh8e/CdGng28jROV+dOmbi wAdM34ENuOKtrjIvqs7rvr0MOPzfzJzfQ/9S1L0ukWMh/uh188ITqMOxtWz2ivVxFy6l +NkQIvZfjj6IkYBKUearb/F4II9teJ1DB+AmcfCsNSZ8NcbUuC9bLdEit6O2zcLjAH8N DcKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=vW4zS8WXlpg0pMNQTUtAtXtXhjWGUuL/MLrkuZuY0Gg=; b=dYugr5WuGo9nJKRSqftouSKsvU/UdDkzeIS7Uiie4Sy5TLaX+m+PaBzpS7h0gVfkKt yxCqt8cO+pEYdtXwDyPR2HWOWYEAL9GiQ2BG+cK0Ia3Ag4c4RLXhCVUXwqADwiYsbfLz 9leD3s9x/M+uGMsk79RjWQtLXGJ3M/svwSBUfMx+Ta78YIQdh48TS/T2JZTSrEBL1YIu vbqntGOd6j1L63W6jjiJLXfhFwweXH+cfv2EIFroq1VHNKHIbnVrbFTTM9S7ei5v+MQT vxV/ZC2EqijlZ4WJ/1iAMGMBZK3wwO8g4ty0Kb2tuvGmvT9zRainAWYJNupK4/Iu30ti 1yVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si3672236ejh.598.2020.05.28.08.04.46; Thu, 28 May 2020 08:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403769AbgE1PAU (ORCPT + 99 others); Thu, 28 May 2020 11:00:20 -0400 Received: from mga06.intel.com ([134.134.136.31]:51406 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403882AbgE1PAO (ORCPT ); Thu, 28 May 2020 11:00:14 -0400 IronPort-SDR: l6lTUHZJmNjjVY+jbZrpDZldqbXf7iIckyUB6SYorfUngYvcdYLSXU3/AjvwUfTe0zmUvBibqm h/XyWvapiTzQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2020 08:00:07 -0700 IronPort-SDR: lPth9ZfV53omOABDvcctzoYxuH/RjXHOmax1UF2rmL33N6IL2HNORetaXe5gvJXxkGF4Cpc9/L zvskHamJeNYg== X-IronPort-AV: E=Sophos;i="5.73,445,1583222400"; d="scan'208";a="469158663" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2020 08:00:07 -0700 From: ira.weiny@intel.com To: linux-ext4@vger.kernel.org, Andreas Dilger , "Theodore Y. Ts'o" , Jan Kara , Eric Biggers Cc: Ira Weiny , Al Viro , Dan Williams , Dave Chinner , Christoph Hellwig , Jeff Moyer , "Darrick J. Wong" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 2/9] fs/ext4: Disallow verity if inode is DAX Date: Thu, 28 May 2020 07:59:56 -0700 Message-Id: <20200528150003.828793-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200528150003.828793-1-ira.weiny@intel.com> References: <20200528150003.828793-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Ira Weiny Verity and DAX are incompatible. Changing the DAX mode due to a verity flag change is wrong without a corresponding address_space_operations update. Make the 2 options mutually exclusive by returning an error if DAX was set first. (Setting DAX is already disabled if Verity is set first.) Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- Changes from V2: Remove Section title 'Verity and DAX' Changes: remove WARN_ON_ONCE Add documentation for DAX/Verity exclusivity --- Documentation/filesystems/ext4/verity.rst | 3 +++ fs/ext4/verity.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Documentation/filesystems/ext4/verity.rst b/Documentation/filesystems/ext4/verity.rst index 3e4c0ee0e068..e99ff3fd09f7 100644 --- a/Documentation/filesystems/ext4/verity.rst +++ b/Documentation/filesystems/ext4/verity.rst @@ -39,3 +39,6 @@ is encrypted as well as the data itself. Verity files cannot have blocks allocated past the end of the verity metadata. + +Verity and DAX are not compatible and attempts to set both of these flags +on a file will fail. diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c index dc5ec724d889..f05a09fb2ae4 100644 --- a/fs/ext4/verity.c +++ b/fs/ext4/verity.c @@ -113,6 +113,9 @@ static int ext4_begin_enable_verity(struct file *filp) handle_t *handle; int err; + if (IS_DAX(inode)) + return -EINVAL; + if (ext4_verity_in_progress(inode)) return -EBUSY; -- 2.25.1