Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp55740imu; Thu, 8 Nov 2018 14:42:20 -0800 (PST) X-Google-Smtp-Source: AJdET5eFgD4wa9o+eiJzGsmzZcbpAXUdJ7XSB6S4nTAFeNf54PkCEiIRJtLZxnJMbuENFZbmVW22 X-Received: by 2002:a63:ff62:: with SMTP id s34mr5339691pgk.325.1541716940198; Thu, 08 Nov 2018 14:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716940; cv=none; d=google.com; s=arc-20160816; b=Ae5ByvjYuHVcvoA2XbzAvwXjbljJuCUMbufwR26kGPJUTXKJJ4FhSTYJBfy5GvF+4Y /KSGumynI2u+jOlsbcWyUKSMEYcdqgkGhIyS4MzrecbUu6YVp1C1mULoaoSwnSkZwW9S SEIsEou3jPrheD84KB34UhTmAK4g6G7WmxDezPLr6kogBx0c0R+C0YRdYtP4wTxwh+sj HGC7Srql1wXh/r+smy7DYCfKo05FY0W9hNVAr2Zze9ZDQluP0UY6RFk6mcBCQFIZkTaM mlIHB2kjNoS0on+DITnMoz3+85EH818k3Yz/KhKtbrij5zqeURvdS5c+Ri1k9J1kbRoh bZSA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c/G0A6OIemKHiOPB0y1E8fvk4EWbw6XD66/j55KDv1I=; b=fhmPz9iQTAiE0kAdopFoZO5GLFoMXclnq8zMgWpfRu/Poms1nYCUDgguioKw3dbxkA LyJB2lNvr7BCIGpa+exNNTo1V1ytt15/F1pRgTLDcqb9PE0oq8ad3pl+/WvvnM1Nx+Gl qhGr8LDIhaB6okbIrmhL7ob045uB5R6sEA5Pb0SXB9CuGkc2bxGNKVv9fZl2q0N0TXJi ANSk9TweINOPmo/SCB5ikOcsfS6WM7D50Rdqjm1FtnefSfNDPk/IuVtIEIe0ecR+C9hA AkQOeTp7pTqhywSYYSWuij05pDtuP4lMYGdG4o2raVF4VfsM7yM+NwHsN6OOaPkCz1SV OLTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cuODYlNJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si3014401pgh.565.2018.11.08.14.42.04; Thu, 08 Nov 2018 14:42:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cuODYlNJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729024AbeKIHdk (ORCPT + 99 others); Fri, 9 Nov 2018 02:33:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:49544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728976AbeKIHdj (ORCPT ); Fri, 9 Nov 2018 02:33:39 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 015C72089F; Thu, 8 Nov 2018 21:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714172; bh=hpD44BghX5qk7nOh1wQvPqgLthst28TmI6j5YydykJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cuODYlNJtKVULKbcPhb1DepTPM4otff/AK5c4IKbzzVSEpEaZwtbggtoHnH4+bOB3 Ky1EvXEVLZHQzrqWiUpSWXrQ1BYqhM95OT23f3Fam4YSMCRpOBic68fDHfHoZyF9m7 irBDNgOC4kISCbB3mp2f5zzpiyNcwlfub1Y8Tt2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Whitney , Theodore Tso , Sasha Levin Subject: [PATCH 3.18 095/144] ext4: fix an ext3 collapse range regression in xfstests Date: Thu, 8 Nov 2018 13:51:06 -0800 Message-Id: <20181108215104.487718721@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit b9576fc3624eb9fc88bec0d0ae883fd78be86239 ] The xfstests test suite assumes that an attempt to collapse range on the range (0, 1) will return EOPNOTSUPP if the file system does not support collapse range. Commit 280227a75b56: "ext4: move check under lock scope to close a race" broke this, and this caused xfstests to fail when run when testing file systems that did not have the extents feature enabled. Reported-by: Eric Whitney Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/extents.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 6dbfa92bf78a..1e51008e237f 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -5400,6 +5400,14 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) loff_t new_size, ioffset; int ret; + /* + * We need to test this early because xfstests assumes that a + * collapse range of (0, 1) will return EOPNOTSUPP if the file + * system does not support collapse range. + */ + if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) + return -EOPNOTSUPP; + /* Collapse range works only on fs block size aligned offsets. */ if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) || len & (EXT4_CLUSTER_SIZE(sb) - 1)) -- 2.17.1