public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
@ 2024-12-04 13:50 Eric Sandeen
  2024-12-04 20:13 ` Anthony Iliopoulos
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Eric Sandeen @ 2024-12-04 13:50 UTC (permalink / raw)
  To: grub-devel
  Cc: linux-xfs@vger.kernel.org, Anthony Iliopoulos, Marta Lewandowska,
	Andrey Albershteyn, Jon DeVree

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

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--;


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
  2024-12-04 13:50 [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support Eric Sandeen
@ 2024-12-04 20:13 ` Anthony Iliopoulos
  2024-12-13  2:22 ` Jon DeVree
  2025-03-27 19:48 ` Eric Sandeen
  2 siblings, 0 replies; 7+ messages in thread
From: Anthony Iliopoulos @ 2024-12-04 20:13 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: grub-devel, linux-xfs@vger.kernel.org, Marta Lewandowska,
	Andrey Albershteyn, Jon DeVree

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
  2024-12-04 13:50 [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support Eric Sandeen
  2024-12-04 20:13 ` Anthony Iliopoulos
@ 2024-12-13  2:22 ` Jon DeVree
  2025-03-27 19:48 ` Eric Sandeen
  2 siblings, 0 replies; 7+ messages in thread
From: Jon DeVree @ 2024-12-13  2:22 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: grub-devel, linux-xfs@vger.kernel.org, Anthony Iliopoulos,
	Marta Lewandowska, Andrey Albershteyn

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>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
  2024-12-04 13:50 [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support Eric Sandeen
  2024-12-04 20:13 ` Anthony Iliopoulos
  2024-12-13  2:22 ` Jon DeVree
@ 2025-03-27 19:48 ` Eric Sandeen
  2025-04-16  1:08   ` Eric Sandeen
  2 siblings, 1 reply; 7+ messages in thread
From: Eric Sandeen @ 2025-03-27 19:48 UTC (permalink / raw)
  To: grub-devel
  Cc: linux-xfs@vger.kernel.org, Anthony Iliopoulos, Marta Lewandowska,
	Jon DeVree

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

Thanks,
-Eric

On 12/4/24 7:50 AM, 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>
> ---
> 
> 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--;
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
  2025-03-27 19:48 ` Eric Sandeen
@ 2025-04-16  1:08   ` Eric Sandeen
  2025-04-17 18:34     ` Daniel Kiper
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Sandeen @ 2025-04-16  1:08 UTC (permalink / raw)
  To: grub-devel
  Cc: linux-xfs@vger.kernel.org, Anthony Iliopoulos, Marta Lewandowska,
	Jon DeVree

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

On 3/27/25 2:48 PM, Eric Sandeen wrote:
> Grub folks, ping on this? It has 2 reviews and testing but I don't see it
> merged yet.
> 
> Thanks,
> -Eric
> 
> On 12/4/24 7:50 AM, 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>
>> ---
>>
>> 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--;
>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
  2025-04-16  1:08   ` Eric Sandeen
@ 2025-04-17 18:34     ` Daniel Kiper
  2025-04-17 18:51       ` Eric Sandeen
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Kiper @ 2025-04-17 18:34 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: grub-devel, linux-xfs, Anthony Iliopoulos, Marta Lewandowska,
	Jon DeVree

On Tue, Apr 15, 2025 at 08:08:12PM -0500, Eric Sandeen via Grub-devel wrote:
> Can I bribe someone to merge this fix, perhaps? ;)
>
> On 3/27/25 2:48 PM, Eric Sandeen wrote:
> > 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...

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support
  2025-04-17 18:34     ` Daniel Kiper
@ 2025-04-17 18:51       ` Eric Sandeen
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Sandeen @ 2025-04-17 18:51 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: grub-devel, linux-xfs, Anthony Iliopoulos, Marta Lewandowska,
	Jon DeVree

On 4/17/25 1:34 PM, Daniel Kiper wrote:
> On Tue, Apr 15, 2025 at 08:08:12PM -0500, Eric Sandeen via Grub-devel wrote:
>> Can I bribe someone to merge this fix, perhaps? ;)
>>
>> On 3/27/25 2:48 PM, Eric Sandeen wrote:
>>> 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...
> 
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> 
> Daniel
> 

Thanks Daniel!

-Eric


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-17 18:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04 13:50 [PATCH GRUB] fs/xfs: fix large extent counters incompat feature support Eric Sandeen
2024-12-04 20:13 ` Anthony Iliopoulos
2024-12-13  2:22 ` Jon DeVree
2025-03-27 19:48 ` Eric Sandeen
2025-04-16  1:08   ` Eric Sandeen
2025-04-17 18:34     ` Daniel Kiper
2025-04-17 18:51       ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox