diff mbox series

[GRUB] fs/xfs: fix large extent counters incompat feature support

Message ID 985816b8-35e6-4083-994f-ec9138bd35d2@redhat.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [GRUB] fs/xfs: fix large extent counters incompat feature support | expand

Commit Message

Eric Sandeen Dec. 4, 2024, 1:50 p.m. UTC
When large extent counter / NREXT64 support was added to grub, it missed
a couple of direct reads of nextents which need to be changed to the new
NREXT64-aware helper as well. Without this, we'll have mis-reads of some
directories with this feature enabled.

(The large extent counter fix likely raced on merge with
07318ee7e ("fs/xfs: Fix XFS directory extent parsing") which added the new
direct nextents reads just prior, causing this issue.)

Fixes: aa7c1322671e ("fs/xfs: Add large extent counters incompat feature support")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Anthony Iliopoulos Dec. 4, 2024, 8:13 p.m. UTC | #1
On Wed, Dec 04, 2024 at 07:50:28AM -0600, Eric Sandeen wrote:
> When large extent counter / NREXT64 support was added to grub, it missed
> a couple of direct reads of nextents which need to be changed to the new
> NREXT64-aware helper as well. Without this, we'll have mis-reads of some
> directories with this feature enabled.
> 
> (The large extent counter fix likely raced on merge with
> 07318ee7e ("fs/xfs: Fix XFS directory extent parsing") which added the new
> direct nextents reads just prior, causing this issue.)

Indeed 07318ee7e11a has a commit-date after the author-date of aa7c1322671e,
so it wasn't applied to the tree yet when I submitted the patch:

$ git show -s --pretty="%h %aI %cI" 07318ee7e aa7c1322671e
07318ee7e11a 2023-10-17T23:03:47-04:00 2023-10-30T18:01:22+01:00
aa7c1322671e 2023-10-26T11:53:39+02:00 2023-11-22T19:13:46+01:00

> Fixes: aa7c1322671e ("fs/xfs: Add large extent counters incompat feature support")
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Thanks for catching this,

Reviewed-by: Anthony Iliopoulos <ailiop@suse.com>

Regards,
Anthony
Jon DeVree Dec. 13, 2024, 2:22 a.m. UTC | #2
On Wed, Dec 04, 2024 at 07:50:28 -0600, Eric Sandeen wrote:
> When large extent counter / NREXT64 support was added to grub, it missed
> a couple of direct reads of nextents which need to be changed to the new
> NREXT64-aware helper as well. Without this, we'll have mis-reads of some
> directories with this feature enabled.
> 
> (The large extent counter fix likely raced on merge with
> 07318ee7e ("fs/xfs: Fix XFS directory extent parsing") which added the new
> direct nextents reads just prior, causing this issue.)
> 
> Fixes: aa7c1322671e ("fs/xfs: Add large extent counters incompat feature support")
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Good catch.

Reviewed-by: Jon DeVree <nuxi@vault24.org>
diff mbox series

Patch

diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
index 8e02ab4a3..92046f9bd 100644
--- a/grub-core/fs/xfs.c
+++ b/grub-core/fs/xfs.c
@@ -926,7 +926,7 @@  grub_xfs_iterate_dir (grub_fshelp_node_t dir,
 	     * Leaf and tail information are only in the data block if the number
 	     * of extents is 1.
 	     */
-	    if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1))
+	    if (grub_xfs_get_inode_nextents(&dir->inode) == 1)
 	      {
 		struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock);
 
@@ -980,7 +980,7 @@  grub_xfs_iterate_dir (grub_fshelp_node_t dir,
 		 * The expected number of directory entries is only tracked for the
 		 * single extent case.
 		 */
-		if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1))
+		if (grub_xfs_get_inode_nextents(&dir->inode) == 1)
 		  {
 		    /* Check if last direntry in this block is reached. */
 		    entries--;