Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3653817pxb; Mon, 24 Jan 2022 14:31:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwduIohTsCB8AneVaAaembTmBARGismWUICApKsZLDGKijHbcZ9FWAaRg24CYLODhyyRv3m X-Received: by 2002:a63:804a:: with SMTP id j71mr13265692pgd.48.1643063506958; Mon, 24 Jan 2022 14:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063506; cv=none; d=google.com; s=arc-20160816; b=kDFHRBPZqVKw3S1ZPgiHp4zghUCznmuZMH/mbpf61tyUQzaS8C6RB0rWmfVorNYvfC ursNFAABHGA4xSvIE29SY4ke3ohGVnUfBxznsKob/5EIgGJQGcmVRK5goZ2TS9bFpyd4 ZHtf25z/X5D3D0SYzNOd1LRGJZLU7XezunY2aVe6a6Wm3DOtqHrTSJ9Zl5DYxSz0T1jS RKvpzmXCx/NNKyLdyJeoJyyDgxFt1hEzkyp5to4aT1Qwc/4kXlh8mHtQv9HK+dMNOe8g Ep6+hNeHzr+CEzu/lGeG7aK657wZS0ux/lQuMtgGBeKc7YBlhlg161MCTi8CpnJhS7EF sz6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CMZIGUV7ZcQDz4IHB4rAooJfNHu0A3V+Z1Ix1HC/urY=; b=RcOUvev3VwiFkoXyaSPzL9cyG6XkcXG/qX5pAJLz3aj7yKjom8+LRZe9wgNWdvOnq7 BxdXBmrkvPxsbnYSCqq/87sbG9BVeCPVdZGjbMsxcARfjuT3gMTw8JjyTNVFPt1CdLDn At5yIrdHPY0I15UljGYpGm8/TMhTnfuH9m8OawOTkOm7u4p4xdcNlDCCGv2mgwzJEUlu Al+SnW6w+eOGyh4Twk2IQOQJGsCJJryFabqTRJM1tEgJkhiCnZ8ChNirrP3sph3VSOfM nU+6eUhK547MxY34fwYEaJT7oZ0dVy+8K1qNbAIFeNqFxj6WieW7UvYs2C74cDtjPpPK pQ3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JY+v3yxP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rj6si518459pjb.103.2022.01.24.14.31.34; Mon, 24 Jan 2022 14:31:46 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JY+v3yxP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587916AbiAXWaH (ORCPT + 99 others); Mon, 24 Jan 2022 17:30:07 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49570 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456203AbiAXViF (ORCPT ); Mon, 24 Jan 2022 16:38:05 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AB51B811FC; Mon, 24 Jan 2022 21:38:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F62C340E4; Mon, 24 Jan 2022 21:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060282; bh=bl+wpAOxajNfbCxXMpblGOpg6qSCBaOLrG8Yk4M8wXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JY+v3yxPnR2AmIXHIpuxiGvdG6BcQ21bxBVir9ry/KSWdGiYdaKn+/E5OxeEHYU5j iZuh3Ccmyba6mgbAHzDLNMFzDoZQtXk3PDjmUem6PggMfy8E8gYBp9bzDs8xWb1IJx TP3WiflPrpDuVsVnm47trNPVc+bPZB1VQeVgeptg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Yin , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.16 0897/1039] ext4: fast commit may miss tracking unwritten range during ftruncate Date: Mon, 24 Jan 2022 19:44:46 +0100 Message-Id: <20220124184155.437667012@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Yin commit 9725958bb75cdfa10f2ec11526fdb23e7485e8e4 upstream. If use FALLOC_FL_KEEP_SIZE to alloc unwritten range at bottom, the inode->i_size will not include the unwritten range. When call ftruncate with fast commit enabled, it will miss to track the unwritten range. Change to trace the full range during ftruncate. Signed-off-by: Xin Yin Reviewed-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211223032337.5198-3-yinxin.x@bytedance.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5428,8 +5428,7 @@ int ext4_setattr(struct user_namespace * ext4_fc_track_range(handle, inode, (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >> inode->i_sb->s_blocksize_bits, - (oldsize > 0 ? oldsize - 1 : 0) >> - inode->i_sb->s_blocksize_bits); + EXT_MAX_BLOCKS - 1); else ext4_fc_track_range( handle, inode,