From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 223E713BC0C; Mon, 23 Dec 2024 16:10:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734970242; cv=none; b=PMoXyc6JIUJB13AlVROG3vXnHZPNJqG1hW048bOO+uA32S/y2KIulgJOswYEQlR4gMWbxnafoTOIbrE3N2EHX8rOkzi00uD8ryr3M6kOxOsfgX/lHzRKTd+2R4h4MvFajH3GtOPPOnyRH/eXUvcw6/M//O3GdUDjHwuzXH7ML9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734970242; c=relaxed/simple; bh=1JXWG+53I5UOYZfXXM27f6QJqNqIFWYyzR99HKjM0bg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r5G87J6I7D4+HE7bNZjVvneVnJnK0tk/xM7cUtWqbb3dwEPSHDp3qflM7s20UtwVGCmv9GMjrwGyWQ4wZ8hdSl3f/Xvn6uVuTa9hnxUwBkYFnfcmKaDQ4FwKGtAGALTCD4JtyLpVypZmHTp3/6ezPRD3g/7vamForEjrpeElSU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tkxr8sg2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tkxr8sg2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8103DC4CED3; Mon, 23 Dec 2024 16:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734970242; bh=1JXWG+53I5UOYZfXXM27f6QJqNqIFWYyzR99HKjM0bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tkxr8sg2XKW4DgIM9Y9uYv95RssmZjKS5I8vS4nc2ty8fOWojgIzvsDjt3dv6dIgC hBcw/YiRWlUjZ1C9QFgQQW4hzzGc6FGUgY/UUd3+CtBX7LVs/yvOOeohysRWX0G/ph 7era/ZQlY0NpGQ5nHFtJ+VCvdWd0ORqS7i3725ko= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , "Darrick J. Wong" , John Garry , Chandan Babu R , Catherine Hoang , Sasha Levin Subject: [PATCH 6.6 025/116] xfs: Fix xfs_prepare_shift() range for RT Date: Mon, 23 Dec 2024 16:58:15 +0100 Message-ID: <20241223155400.540797524@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241223155359.534468176@linuxfoundation.org> References: <20241223155359.534468176@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: John Garry commit f23660f059470ec7043748da7641e84183c23bc8 upstream. The RT extent range must be considered in the xfs_flush_unmap_range() call to stabilize the boundary. This code change is originally from Dave Chinner. Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: John Garry Signed-off-by: Chandan Babu R Signed-off-by: Catherine Hoang Acked-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_bmap_util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 7336402f1efa..1fa10a83da0b 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1059,7 +1059,7 @@ xfs_prepare_shift( struct xfs_inode *ip, loff_t offset) { - struct xfs_mount *mp = ip->i_mount; + unsigned int rounding; int error; /* @@ -1077,11 +1077,13 @@ xfs_prepare_shift( * with the full range of the operation. If we don't, a COW writeback * completion could race with an insert, front merge with the start * extent (after split) during the shift and corrupt the file. Start - * with the block just prior to the start to stabilize the boundary. + * with the allocation unit just prior to the start to stabilize the + * boundary. */ - offset = round_down(offset, mp->m_sb.sb_blocksize); + rounding = xfs_inode_alloc_unitsize(ip); + offset = rounddown_64(offset, rounding); if (offset) - offset -= mp->m_sb.sb_blocksize; + offset -= rounding; /* * Writeback and invalidate cache for the remainder of the file as we're -- 2.39.5