Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1101010ybk; Wed, 13 May 2020 23:55:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoYwtwjc19iZwa8ZotsDgBUdcGjzQmFVvba+2+XwTxtjv67yg5lsRNAFVBeY672yeF/yuz X-Received: by 2002:aa7:d78a:: with SMTP id s10mr2716768edq.319.1589439339852; Wed, 13 May 2020 23:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589439339; cv=none; d=google.com; s=arc-20160816; b=f8Om+x/u+GuSmY+B/XdhT2MAKIEChwpxD+3k5KocxYpV1KEUqPA3kHJPcCgK3Saymq v4uaWRH3Gav2rcUH7a3YpVVRhIxNSRSTNdppUwn8p30c+KvQQCPgywMKGE+frwmtpnvc kNU4MwN4nVtxDFs10IxoOw+9pUAuYDbQwfbNwb5FNAkPcL4vpdq6lANLN1CS4BbHx6UH QHUaFutblhh66AWXOsSYLgEfOk8zD1JmKokDvdFWSlh8MT5SYNpiSNPGSIktgWCEs+Bl PuyWCj3V2lX/45cqAcyscDMQ3JDs6Q6n/mBKmqbiOzTQpcIZZQWGLO8+g7TqwqQEUosL c9QA== 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=GiDgr5dpNlrMy/QZlsb83PYSZB6fWgBSbyKiB6xlWcg=; b=NcwBoo3dzVylVCiDZcwW+M3ihOuZZfIbCeu1w+WJzWFeWrgb6PomHG1JbDw8DQVpf2 xf+TORvbRQk+zgIM9etMSrKeljFkgWLn7sIkLkGexRBn4sYiMNTHjAYP53EQn2dWVmt1 yzZ3eIo9CmSy5avUSqd7NbV1UHjfI/JdQ2ppLnVbNXmt/STFat9Db7drhv8dXeP6uo3E qFLqHgVgPs25T8nLTayWvfiKgnZ/C3bP3ZG6oW3c4n4i5SMitBI3owj8rUtBpx7Cs5ry hDDH9UHJu3gGIthZuB5db05iSglOnRSzeqUTausXb24zwbidlQ8QTvKcyWkOklo9VxDa 4vHQ== 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 s19si1232785ejz.320.2020.05.13.23.55.16; Wed, 13 May 2020 23:55:39 -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 S1726614AbgENGx5 (ORCPT + 99 others); Thu, 14 May 2020 02:53:57 -0400 Received: from mga07.intel.com ([134.134.136.100]:24100 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgENGxV (ORCPT ); Thu, 14 May 2020 02:53:21 -0400 IronPort-SDR: umbg94bAomxyBiYfb35fxpqDOJQRiU/MfLwnxlZ4tzWB3hv3XAH8OpLyq1+0GOIFykn30lvQF2 pegeQ6uUWYDw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 23:53:20 -0700 IronPort-SDR: CoA/uy7sbXze7imXWR7ydgQ0P4Is3UOhFPWglk63t2c+7NwhmPaBBESk82Mk2xQUBWg3U7Ad1v u4OeNWSqJGag== X-IronPort-AV: E=Sophos;i="5.73,390,1583222400"; d="scan'208";a="298613492" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 23:53:20 -0700 From: ira.weiny@intel.com To: linux-ext4@vger.kernel.org, Andreas Dilger , "Theodore Y. Ts'o" , Jan Kara 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 V1 2/9] fs/ext4: Disallow verity if inode is DAX Date: Wed, 13 May 2020 23:53:08 -0700 Message-Id: <20200514065316.2500078-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514065316.2500078-1-ira.weiny@intel.com> References: <20200514065316.2500078-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.) Signed-off-by: Ira Weiny --- Changes: remove WARN_ON_ONCE Add documentation for DAX/Verity exclusivity --- Documentation/filesystems/ext4/verity.rst | 7 +++++++ fs/ext4/verity.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Documentation/filesystems/ext4/verity.rst b/Documentation/filesystems/ext4/verity.rst index 3e4c0ee0e068..51ab1aa17e59 100644 --- a/Documentation/filesystems/ext4/verity.rst +++ b/Documentation/filesystems/ext4/verity.rst @@ -39,3 +39,10 @@ is encrypted as well as the data itself. Verity files cannot have blocks allocated past the end of the verity metadata. + +Verity and DAX +-------------- + +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