Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3617750pxb; Mon, 24 Jan 2022 13:37:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwg6lwrO+uqnxoQ3ni57UFbEibSZ9OUPrt/oXPbIx7sw+xfLQxrQTrBRq3vHR9jeGKfXDQE X-Received: by 2002:a63:5010:: with SMTP id e16mr13273859pgb.529.1643060263233; Mon, 24 Jan 2022 13:37:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060263; cv=none; d=google.com; s=arc-20160816; b=RWIFVckSoAPiR6FgDynFBhsk4LEruvIa54jOBpuj9A6walCSC+ZZHtOSVDhsy9st0S 1ykRjFEZN2vR1tyqdh+g48EGjBBZGc7s4yJKteOWFEd34ecczP3DUTk9B7vtwtaBRjTJ W/039dyBr5KpNFK0C8OELAVPQ974tsTqDsSnTh182hLcrNfoUkHRyA7IYbw7DW2V17jw f3fsYJGXC4PEm/O3/Crn6OZGEMO4tHMCdNAo8sAU/yXjBMi0J09Dua3jsqYsxqxZ7Ub8 HXYKkfknOlMMy192a8Bo5DeMvDT2XJ67Fwy0OuamovCdifBLhuwrhpdhJxDs/oQNt6FX LpXA== 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=cRQTjSGghHdBnP4Ffi4AF2STXxTL0LCrDsXU+gEpYIw=; b=mMM6BA8TWKrQQgm4EfwWg0Xj3bt8OA/Rf/loOR9H5wjNqpbpt9eJ/5J9YGjWHf/ys0 rq0ojYiFzdRry0E1aMmoKP9XZJUhd/5w5HH0jWCvuaCHJZzaENhKIvE29ax13T05yawp 29i7MZjjIB5wCgWW14v325uNEicbCJJYzhWd5MZzC+T9/UNkLLVqaVSoA9cR92s5nbap SZnhTtSfck0RbeDQdCsHvQRBuW7IwIMCUHhKpjWt+lk/nlcU5ujIpQ07xBlPpD9sNwdN 9QE2bvN7roOzdkUy3ylGE2uaW/4zdjaSfqcxr56wcFSE6/oACwDSo4A+jYQsHuBq3DnV 9zjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0Xw6HLPR; 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 w31si14944850pgk.389.2022.01.24.13.37.31; Mon, 24 Jan 2022 13:37:43 -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=0Xw6HLPR; 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 S1449237AbiAXVPH (ORCPT + 99 others); Mon, 24 Jan 2022 16:15:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:41888 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391418AbiAXUrn (ORCPT ); Mon, 24 Jan 2022 15:47:43 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5136A60C13; Mon, 24 Jan 2022 20:47:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB93C340E5; Mon, 24 Jan 2022 20:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057261; bh=9mf3EP2FFGL21FYhRGtSiDPke0nxmISoiIGuIKuqdFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Xw6HLPRNOBQNoFvXRMv9mfKa99ISim7xKw0b1cder/EQWBKl3PDFvLPrgfiALwa9 QrSklFyBdVQ3yHvK6Lyi7bJa6j9/GwE3YiSCv4KJNT/n+GC6Xa7GrL1CF5at0U3r9u mt0i4AhROuF4O2Ewj4FMDj2fx1IA1Lv8ZMcK883s= 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.15 721/846] ext4: fast commit may miss tracking unwritten range during ftruncate Date: Mon, 24 Jan 2022 19:43:58 +0100 Message-Id: <20220124184125.887304707@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 @@ -5414,8 +5414,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,