Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp288629ybk; Tue, 19 May 2020 22:59:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLilo6jH7ozWBR5F4AC71CGy/vh8+EeARh0d75LcZXBTDPrZh3mC9XqkaEmWEQ7v+yXjrk X-Received: by 2002:a05:6402:308f:: with SMTP id de15mr1974980edb.108.1589954386953; Tue, 19 May 2020 22:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589954386; cv=none; d=google.com; s=arc-20160816; b=BitW23bfcARX3tLLV3D7MXD+DdVxlZuJi1p+WCwf8ZEVo+XDzU1W4fnLpzDAskugnY Ngi/agYoNwCDUrKGYfVbY64zf9JXyZCt0wwu9pR9L2Q6QMLBHsdoQtoIJmwHfEPsy8/0 haibWYSKaR6ZLzEZzPiLu0pkRFracEpzutBfkY9ZT+0jcscR74hSf9lEkwFNqFhgxUmw 3IvYzwRH61G88m5QoHB0N+Pc/7KhYd/7L26vlfgXjdx1Mmtu0TVwRO/ClcBzsqxVqxrD 3ZsAKdAW36+a3YxIwTs6KMY8t8MEr2FJ582QD1G6qvhsPmKhTRpi7oMNdXk2R10hNVxP S7xg== 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=mRRXNXg8Sd47mxmmkrbzZMmfLoW6Pux4HvJ5nYWQvc2ncB5IczHdBQ/yGg06xrNlaL PzoYFhWckmmp/nOY4vFJz69l5xJESnb6qYyu7uuS58A+9NRO8NfgxSk00yxQNbk84qdp h1m8f2WHgwsxBWVCckJwX1rSmi+2EgWIT5g2AS0RR0p3nrYxNHCkzRx6dybXmAFH1uTy I9Nr6BxBDQ5W6ysjiEg+Xikr2OtgM1JjmV6KSknRZCtT2hQY3zYzEDv5F//ISetjhv1P klR6h+rMWLeP1yEi0xWW3pn6785p/e5Bk3UjQ+86cLpnMYypQnIrJiU6aiD0Kmz1HAJq HN+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 jz19si1211673ejb.668.2020.05.19.22.59.22; Tue, 19 May 2020 22:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726621AbgETF57 (ORCPT + 99 others); Wed, 20 May 2020 01:57:59 -0400 Received: from mga18.intel.com ([134.134.136.126]:59338 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbgETF55 (ORCPT ); Wed, 20 May 2020 01:57:57 -0400 IronPort-SDR: 4Fr+zpFCzFwT+91qVHqKzivzOCLEhPnta2yeP4y+3abCEK/krNx/kbm2JsgZJ/YXAHsUMFeMl8 sOI7mD7Wr/Jg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 22:57:57 -0700 IronPort-SDR: 7d50L2gyKm3sz/CYaV8LjzPWn2Xgp0Rqc70h0jGpfoF7jBmPbROnGI23lf0K9+9wdBmLiE0Vdl LROUOQdGLycA== X-IronPort-AV: E=Sophos;i="5.73,412,1583222400"; d="scan'208";a="299824204" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 22:57:56 -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 V3 2/8] fs/ext4: Disallow verity if inode is DAX Date: Tue, 19 May 2020 22:57:47 -0700 Message-Id: <20200520055753.3733520-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200520055753.3733520-1-ira.weiny@intel.com> References: <20200520055753.3733520-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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