Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3904609ybi; Mon, 29 Jul 2019 15:03:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKfJYEXrlY8XKjyL0aofY/8yLc1oWPkBPaQwikFhrrIkt6FoVOdNA66SzH48cw+NMPqjuW X-Received: by 2002:a17:902:54d:: with SMTP id 71mr109528028plf.140.1564437792507; Mon, 29 Jul 2019 15:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564437792; cv=none; d=google.com; s=arc-20160816; b=P912V4DX4cyu7CXsiIcaCg3LYCgfC5Lg5pCP2hqrkuGs03sl//c0TUnnaqxvVLIhLE ZHoNedDsXsBLj5rGdU0ehSAlYHOqdJ+h3OWMz8i4ifvpeGnBVPXFA6NFbcEkUfjMQGD7 6o+zjgraoSYky+RWWtQqzIjKCvJRIuPMxSmdQb09FUitiN/mCLZoA296mLrtUy+hUk2v sLjWkw/+yfzATr5w7gPwAeRJM0Z9QLyExWs9YtkUmmQlG8qId4yMuWw/Ad5rmKjzXdob PB9rfbf6B6U0OyZ/7M0i54pPUXRM4pTBb21t26vdTccWzs9y3K90+tIiaRsrwFBO/49V Wf9A== 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=DGCDKfxvgImfskCAx9T3gw/J/kqrf95QcIJWlDt0xd4=; b=r47SxX2IMs8b3n7ZPSXYuNIKhYt/FEauVV6f4rWGx2yaKpeEgqy7S4jJEazlgtv7zW ZjKS+4mU7y0RHMq52IKCy3QwBBwaTl0ujHBPX2OZ207tZRQDP7tyNn1Ol/ZQmVfmBc9+ 7W1tWppzq5h0aoUWflXcqXZIL7mwHxFPlfoj/ytSQTEf0Qmj7WOd+cbDAyisJUNYjQeU Q3LiLTppurpC1cSfn6Dx0JhtJfGUFP0Mct7avrxPaxekiW5v3gasDyMZqXS5/t86p2hE +0mAUjk97iJtMxLnJBA2UGp8UJjz0Pz7gQepoYX6gYWiuV+PmisbiTdXD3F2/rPl1OM3 gPUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w2u1LnzY; 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 q187si27034209pfb.51.2019.07.29.15.02.57; Mon, 29 Jul 2019 15:03:12 -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=w2u1LnzY; 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 S1730186AbfG2Tbp (ORCPT + 99 others); Mon, 29 Jul 2019 15:31:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728931AbfG2Tbj (ORCPT ); Mon, 29 Jul 2019 15:31:39 -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 B3C242070B; Mon, 29 Jul 2019 19:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428698; bh=bW1U4CuDnSX+m9qq7oDT1Ab0rj2wLfUzFhX/s30R79A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w2u1LnzYU/hfnpamfy8zR5fc7vbFS4Nj9SksgdUN4XLp2zLtM2QqAIdw1bmFenV7q xi4FhoLn8CCbS9vQ4jKmAtKrrUGZ/ZXWjDCxQ9BxVv/DIcdATXL+FVLSQ/lu9Nh3WL neEbwTKhWU9ij+dE2AKMD3FFrK2s//jzUOhHgH5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba Subject: [PATCH 4.14 159/293] Btrfs: add missing inode version, ctime and mtime updates when punching hole Date: Mon, 29 Jul 2019 21:20:50 +0200 Message-Id: <20190729190836.737755799@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 @@ -2784,6 +2784,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 timespec 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);