Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9978873ybi; Wed, 24 Jul 2019 13:26:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAzm9HJzyRbng0ZzktWL4jvNAx/sm3zuXbnqWWhz31WviCgOr67Q0DuznbYcqToWLZbXU2 X-Received: by 2002:a63:784c:: with SMTP id t73mr85358244pgc.268.1563999966012; Wed, 24 Jul 2019 13:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563999966; cv=none; d=google.com; s=arc-20160816; b=ISB4ka9t4b4knncJNX3GIIZco6FT8QBFdDXvtLZ5gB3PZI4KjftQm0671+IyXMoevV jyAZC2lSLZWKJnA0Fe4b94W340Y3O+d13SqT4SnY9M7w8RRWIUxIuT4l0r9ZlgkjJNCf ir6HNtZJ4WierqmwgH6UNHDX6Xl1d+zC7CDthZAj9px/WVp7ifQ3OKZwL8ZpULicCfXw 72vW2gxG+iSpYPat6F4RnfTAnEKxjFr9xN+0eRg9XIFVggjjtMB3vsfrN8GWJOpd+aDM 3fkJk+eNGuJbJCQoIP1wEGBbhxtTupHGXFU9RdIGMRlAOEpZaxM+lDE+tnXCA2DpyHWm NDZg== 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=ZqFBIpiRD6wzI7ccYSxYQBYa/WAWwLv4JE0kaXSkTsg=; b=QeIlY2qzwmkomTJqJFdwy+uYZ70w6/Bh2JjqAlZ0E99jGZuxLeUjw5AGRPJ1ejlHgy 2+e2sytNV4NAZ1O5Ifsr8QMdpmCgxhoekTjnqPRq2mtkWYYsdOHku4vr6I80R07fNebO YpIt6SahjfEcx82uNRsIO0jwmVP0B3fbYK+aLaQ3rfRwxU4fbzwJLCG/WuWvGf0bZcz3 9+4SIUbRZotOPNv5obXEPYGE0ilR74rQXT/5xRIEsTz2gu8mfTJi8YbHLQbBKI7ZLyRX y/2zlWBwQ5/bR1gUKn2n9W8ffh9QjpZNtXnxLIEMvokmZHZEZYezJtHmC4Z3blDzcPjl 8DOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z7FViWDN; 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 g13si17018659pgk.369.2019.07.24.13.25.51; Wed, 24 Jul 2019 13:26:06 -0700 (PDT) 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=Z7FViWDN; 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 S2389620AbfGXTks (ORCPT + 99 others); Wed, 24 Jul 2019 15:40:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:42000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390076AbfGXTkp (ORCPT ); Wed, 24 Jul 2019 15:40:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 F422F217D4; Wed, 24 Jul 2019 19:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997245; bh=sJxehLS+fkKkpj9Yb9H6zpCA9UHzzXe2pzM8y9oENow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z7FViWDNiyqZD93lQxV1BL8F5oNanHMLgZEL0I/uIbFu5ucfAH1jGGM4THM10Ytqc /bcWKh3TfSBL8fMyd0+1Ks9WO7+FBai0ONnjoGzPWJiKjThAnoGm5qfY8I946P0CYZ MVw2ccUZKfivEam0wXjLw0fw2x0vwWSn9mliBKJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba Subject: [PATCH 5.2 370/413] Btrfs: add missing inode version, ctime and mtime updates when punching hole Date: Wed, 24 Jul 2019 21:21:01 +0200 Message-Id: <20190724191801.788096540@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Filipe Manana commit 179006688a7e888cbff39577189f2e034786d06a upstream. If the range for which we are punching a hole covers only part of a page, we end up updating the inode item but we skip the update of the inode's iversion, mtime and ctime. Fix that by ensuring we update those properties of the inode. A patch for fstests test case generic/059 that tests this as been sent along with this fix. Fixes: 2aaa66558172b0 ("Btrfs: add hole punching") Fixes: e8c1c76e804b18 ("Btrfs: add missing inode update when punching hole") CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/file.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2721,6 +2721,11 @@ out_only_mutex: * for detecting, at fsync time, if the inode isn't yet in the * log tree or it's there but not up to date. */ + struct timespec64 now = current_time(inode); + + inode_inc_iversion(inode); + inode->i_mtime = now; + inode->i_ctime = now; trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) { err = PTR_ERR(trans);