Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp265061ybk; Tue, 12 May 2020 22:45:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF7dzFIkqcxHcAcPVFjSY7fqW6vNAtiscnpq0m0nP7hl3GYIRPSQbYjiU1COgGdFGCKT9o X-Received: by 2002:aa7:d850:: with SMTP id f16mr8740800eds.365.1589348759682; Tue, 12 May 2020 22:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589348759; cv=none; d=google.com; s=arc-20160816; b=DCrKl6yaxjYxM5ED2W7mSzpUtaRO8KswOD68vOQipmIKDi7KQQY3jJlGOYw0m4rQx6 hItz/sc66zdBHRfXaFUVtwuieNOkcYpHqBku7w5zd3pODJnSYJKfqayIDzDeTYiQXGaa qblc179ORBANQzWLN16pIE0Kn2lxfr4x9fhvNjPKdrXhuiVgNO1OlnlZIPxyKjKY+8/N clnY4k4dHxO6U40j8CPLdcvUI36lYxzggf8RqkFTQ/UN1yIvsPb5u/ITlCB/518ap0k2 PvNo/ii10Cpt9Z+eSup/AzAgTNZtAvd83N17EiBCVKRoJxhdzn3KkpBZOVRTzAiw7bU/ H/hA== 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=z9D4eJ3ul478D3cTVB+ONTl4fK0tH/uVfmKT1zj5VsXfudREyegucLsPmfjcmRADhH Stw5X/c5lboDNszArUchbWPlSQtOei1StbU0v6ScN3rUgWn6Jyv/v78cGQOurerLgct7 we98aTsNSfDeq1dNbLtoujEvkWI0npoll1Tals5BOjKKsjfH8vtW/MWr1QwX1XEc7eV7 RPfI3swb/BHcytbU45cnjFgfsUyfOOv2sUm0/NKxRwh3G0kW0SZLaqQc1Y07MADkDTVs cYj9A6lHWqorW/ORHTk/lfMQQhR0vKk3ZiftoM+dweE7cvjXJtJ6Ak/QMwQejc3vO8Zb S7/g== 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 b23si367542edw.116.2020.05.12.22.45.36; Tue, 12 May 2020 22:45:59 -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 S1729035AbgEMFna (ORCPT + 99 others); Wed, 13 May 2020 01:43:30 -0400 Received: from mga17.intel.com ([192.55.52.151]:48154 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728784AbgEMFn3 (ORCPT ); Wed, 13 May 2020 01:43:29 -0400 IronPort-SDR: a/xDlrz1Eka5xdLuonVeLLiMYVEoLpXO6SLZGFmurMX+AuLbqFGbjfGejYQ6RQIp7jmKPl4E0S zjCSWKjxu3cg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 22:43:29 -0700 IronPort-SDR: w1DYE8OUIPfH7tS3pzTdHdDDocTZdB/eL7KMVsCO7j50Kc/lYK1D5/BTNEtKZcUZ+9sHzFEqGc Pux7gbFtsTOg== X-IronPort-AV: E=Sophos;i="5.73,386,1583222400"; d="scan'208";a="464010649" 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; 12 May 2020 22:43:29 -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 2/9] fs/ext4: Disallow verity if inode is DAX Date: Tue, 12 May 2020 22:43:17 -0700 Message-Id: <20200513054324.2138483-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200513054324.2138483-1-ira.weiny@intel.com> References: <20200513054324.2138483-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