Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10428134ybi; Wed, 24 Jul 2019 23:02:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgKi9L7WEC4mQsGmTNSiu6AdVIytxDMivUSlBDDlmDZbLQ0Nus6H1p8qMjDyKI656Di6oR X-Received: by 2002:a17:902:e30d:: with SMTP id cg13mr88963444plb.173.1564034573526; Wed, 24 Jul 2019 23:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034573; cv=none; d=google.com; s=arc-20160816; b=WR+OP5fbKsJ2q0EiOOhs1LAkKsoCDyuafPRLSHzfv1IHkNps0B8RJ3MxaVExJHKcVs YDRCqKDRZ1Hjd0uCoRR4UbJN+XYgoEGajngDTsFnTmKaP9mzXiHzGkV8l7IA76TASmyU ot7XY/3LR+RugIsNoiBhUzSZKVHMRVCWYi+ndh03HVM7AD7CKDAI8rF9wGP6ovyx5CE5 M0olc4LmfyEmczCWX93mQQuzLjvrdaxqmQlPgC0O+7cZrd5r5gc9/IVSnmc8Bwu1KTcJ 4KpbGrTVlf96/q9BIjRGDZRkmcxpZp5qY4PpqM6siStdd7Jdx3DBf8cv0ADROMUcsu4H D0tQ== 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=9V0D4T5b8YQl7bngY00U8Kcf3Z/NMYHBs+RgAuIJ72g=; b=naq+VMFmZKtGXK3o22zA401Ou71UfFavQ68ryY4kb2HRXzbJ/OmQ2Ken5BCI7b9HKU xUdyipQxA9EjyvMh92KRinrzP3c3EvzDNpDU7eJ+PX9/B2z3OrlijxG7uTGg8kUdK4/i zssf8EJlVoM+hpD+02/QagFzVxdvM/eafhwLTQe81MOyj74KMGgjtK4w34mZCyMK718K Dt4v5E4LpjTOVXbr0oNP2gfk15rUpX+u+eOdtUwvg/xLHH+cT6HGRIimHjgs6QvXoIl7 FFU/DUMuA21bHT8N/CsFbtVVELnKodO5jZWeDzxnHprmq3a7hqHFiTqLEHk3Bq51lR+W YPlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JvkmS4lM; 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 d39si13943829pla.371.2019.07.24.23.02.36; Wed, 24 Jul 2019 23:02:53 -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=JvkmS4lM; 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 S2391303AbfGYFpP (ORCPT + 99 others); Thu, 25 Jul 2019 01:45:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:60664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405133AbfGYFpN (ORCPT ); Thu, 25 Jul 2019 01:45:13 -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 55B1922C7C; Thu, 25 Jul 2019 05:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033512; bh=LjIDZqtXK5w0WHul7K81AazFzJyfDclnAICa0fHRd5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JvkmS4lMWN6xmtm7ckcqBFJX3+VlOzg5WGrsH83iXy2qGxZAo8zhbPm9v0ZSzeF+y qqD9dIy7IPaXYvgjwINEsdFxwxg6eXfmkT0si1/wa1tuqRDmim8XDYUQbNnPEDFnRs 0LUxcc9xhH7y5fhIDAtrwWurd5iP0gT6ByDXYzFs= 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.19 234/271] Btrfs: add missing inode version, ctime and mtime updates when punching hole Date: Wed, 24 Jul 2019 21:21:43 +0200 Message-Id: <20190724191715.211811475@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 @@ -2732,6 +2732,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);