Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp215000ybk; Thu, 14 May 2020 21:43:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy83SLdIWoKNX5EIHgajS14DImc4I8pxIz6ZKrBs1U5qUEZbvcvUSyKxTwqOV1A4nKwKzU7 X-Received: by 2002:a5d:4b0a:: with SMTP id v10mr1842921wrq.33.1589517826003; Thu, 14 May 2020 21:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589517825; cv=none; d=google.com; s=arc-20160816; b=VU1ZpR6fBST27pAq3BzEEbYp5si7GIFGv+u6FSxImUGMaj+FZCkfMUnwMqK9Ki2cWO acVCGlPgNLveVophZsYzt1qctD8wPk7xIByI7p2JOVOtJt0xjkRffiO0QYxFTQ8idrvX oVcTbkwyal316w+AVjXWQD5c75Fmo3vJ4MoIdDhWPGk6FMXtjX8KIyWj8aIhk9cvK38B Guuf06jQNtXc7RekFKWrWwDfnnBygaj61FRgIXjeoRmvE2wsl7dOwl2g4O8cfrqEK3cZ uycOs3MgTHr76XknQtkg5KSMKnTdqzohh+K+9TvYW19gVwv45UjwY2UuILVNmIeDuybs YmxA== 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=Kqh8J8W7bo92E2x2nSEB6HwoIeaDwR8ZzQuc2j9pXMA=; b=rVPWP7dJLtI+IlRo91vCP5KzisXxPf9/701ct3eEwuzEIqseXBIv0HDgWLk3mmsf7k cKhaF2+3y0pCa7C6ZPKQmPScUHDYWcOHKwRN2kzMKUr7RMcpec6tn2pK9o8zIIJBX/Pg KWUeK7pEYlfONDLIEZsPtOqqszvAOlHV3qw1HrF0UVs25VCjwPxwnPf9yVX7EtVf2HTd Ul7o8FiH6rYG+AtbnsGXYqRT48AmAISrIkbvSEtI3J5u5fhB+nv5zpMggZ1JDvueQrA3 yd6SRkihnd65Q1PjHJ1NKVSqC+TDdfXCaVjTpEIG337yoFEBLaRY+XBmNclWmcz+xdW0 2Zgg== 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 pw5si560728ejb.354.2020.05.14.21.43.22; Thu, 14 May 2020 21:43:45 -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 S1726665AbgEOEmG (ORCPT + 99 others); Fri, 15 May 2020 00:42:06 -0400 Received: from mga09.intel.com ([134.134.136.24]:14758 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgEOEl1 (ORCPT ); Fri, 15 May 2020 00:41:27 -0400 IronPort-SDR: PLNerIxd+1+148hztX+l65E4DwI8OLrSpNoNBDJOj5bXqTD/g2xzSv8VZYWc5QLPYgGouAyeoo Tn5JpbAKQJXw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2020 21:41:27 -0700 IronPort-SDR: oj0y3Ftz/O+KUXaXmCj1JEMLNjqitpMfToxOJcRJ5eTtWNO1d+1XkofQxM8WIYcdsLGpnKjTc4 5D/QOfNmPkOg== X-IronPort-AV: E=Sophos;i="5.73,394,1583222400"; d="scan'208";a="253687729" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2020 21:41:26 -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 v2 2/9] fs/ext4: Disallow verity if inode is DAX Date: Thu, 14 May 2020 21:41:14 -0700 Message-Id: <20200515044121.2987940-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200515044121.2987940-1-ira.weiny@intel.com> References: <20200515044121.2987940-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: 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