Skip to contentSkip to conversation

fs/xfs: fix large extent counters incompat feature support

PATCH In review Eric Sandeen 5 participants 8 messages Dec 4, 2024 – Apr 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/xfs: fix large extent counters incompat feature support

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")

---

grub-core/fs/xfs.c +2 -2
index 8e02ab4a3..92046f9bd 100644
@@ -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--;
Reviewed-by Anthony Iliopoulos on v1 1/1
#1 lore raw
Quoted 8 lines · Eric Sandeen

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
Quoted 2 lines
Fixes aa7c1322671e ("fs/xfs: Add large extent counters incompat feature support")

Thanks for catching this,

Regards,
Anthony

Reviewed-by on v1 1/1
#2 lore raw
In reply to Eric Sandeen
Quoted 11 lines · Eric Sandeen

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")

Good catch.

Signature · 8 lines
Jon
Doge Wrangler
X(7): A program for managing terminal windows. See also screen(1) and tmux(1).

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw
In reply to Eric Sandeen

Grub folks, ping on this? It has 2 reviews and testing but I don't see it merged yet.

Thanks,
-Eric

Quoted 37 lines · Eric Sandeen

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")

---

grub-core/fs/xfs.c +2 -2
index 8e02ab4a3..92046f9bd 100644
@@ -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--;
#4 lore raw

Can I bribe someone to merge this fix, perhaps? ;)

Quoted 46 lines · Eric Sandeen

Grub folks, ping on this? It has 2 reviews and testing but I don't see it merged yet.

Thanks,
-Eric

Quoted 37 lines · Eric Sandeen

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")

---

grub-core/fs/xfs.c +2 -2
index 8e02ab4a3..92046f9bd 100644
@@ -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--;
Reviewed-by
#5 lore raw
Quoted 5 lines · Eric Sandeen via Grub-devel

Can I bribe someone to merge this fix, perhaps? ;)

Quoted 2 lines · Eric Sandeen

Grub folks, ping on this? It has 2 reviews and testing but I don't see it merged yet.

Huh! This somehow fallen through the cracks. Sorry about that...

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#6 lore raw
Quoted 4 lines · Daniel Kiper
Quoted 3 lines · Eric Sandeen via Grub-devel

Can I bribe someone to merge this fix, perhaps? ;)

On 3/27/25 2:48 PM, Eric Sandeen wrote:

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines

Grub folks, ping on this? It has 2 reviews and testing but I don't see it merged yet.

Huh! This somehow fallen through the cracks. Sorry about that...

Daniel

Thanks Daniel!

-Eric

Reviewed-by on v1 1/1
#7 lore raw
In reply to Eric Sandeen
Quoted 42 lines · Eric Sandeen

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")

---

grub-core/fs/xfs.c +0 -0
index 8e02ab4a3..92046f9bd 100644
@@ -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.
*/

grub-core/fs/xfs.c +1 -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);

grub-core/fs/xfs.c +0 -0
@@ -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--;
Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel