public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data
@ 2024-06-18 14:43 Luis Henriques (SUSE)
  2024-06-18 22:30 ` Ben Hutchings
  2024-07-11  2:35 ` Theodore Ts'o
  0 siblings, 2 replies; 5+ messages in thread
From: Luis Henriques (SUSE) @ 2024-06-18 14:43 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger
  Cc: Ben Hutchings, Harshad Shirwadkar, linux-ext4,
	Luis Henriques (SUSE)

When fast-commit needs to track ranges, it has to handle inodes that have
inlined data in a different way because ext4_fc_write_inode_data(), in the
actual commit path, will attempt to map the required blocks for the range.
However, inodes that have inlined data will have it's data stored in
inode->i_block and, eventually, in the extended attribute space.

Unfortunately, because fast commit doesn't currently support extended
attributes, the solution is to mark this commit as ineligible.

Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039883
Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
---
 fs/ext4/fast_commit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 87c009e0c59a..d3a67bc06d10 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -649,6 +649,12 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star
 	if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE))
 		return;
 
+	if (ext4_has_inline_data(inode)) {
+		ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
+					handle);
+		return;
+	}
+
 	args.start = start;
 	args.end = end;
 

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

* Re: [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data
  2024-06-18 14:43 [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data Luis Henriques (SUSE)
@ 2024-06-18 22:30 ` Ben Hutchings
  2024-06-19  7:58   ` Luis Henriques
  2024-07-11  2:35 ` Theodore Ts'o
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2024-06-18 22:30 UTC (permalink / raw)
  To: Luis Henriques (SUSE), Theodore Ts'o, Andreas Dilger
  Cc: Harshad Shirwadkar, linux-ext4, 1039883

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]

On Tue, 2024-06-18 at 15:43 +0100, Luis Henriques (SUSE) wrote:
> When fast-commit needs to track ranges, it has to handle inodes that have
> inlined data in a different way because ext4_fc_write_inode_data(), in the
> actual commit path, will attempt to map the required blocks for the range.
> However, inodes that have inlined data will have it's data stored in
> inode->i_block and, eventually, in the extended attribute space.
> 
> Unfortunately, because fast commit doesn't currently support extended
> attributes, the solution is to mark this commit as ineligible.
> 
> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039883
> Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>

Reported-by: Hervé Werner <dud225@hotmail.com>
Tested-by: Ben Hutchings <benh@debian.org>

I think this should also have:

Fixes: 9725958bb75c ("ext4: fast commit may miss tracking unwritten range during ftruncate")

unless you think the problem is even older than that.

Ben.

> ---
>  fs/ext4/fast_commit.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 87c009e0c59a..d3a67bc06d10 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -649,6 +649,12 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star
>  	if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE))
>  		return;
>  
> +	if (ext4_has_inline_data(inode)) {
> +		ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
> +					handle);
> +		return;
> +	}
> +
>  	args.start = start;
>  	args.end = end;
>  

-- 
Ben Hutchings
For every complex problem
there is a solution that is simple, neat, and wrong.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data
  2024-06-18 22:30 ` Ben Hutchings
@ 2024-06-19  7:58   ` Luis Henriques
  2024-06-19 13:47     ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Henriques @ 2024-06-19  7:58 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Theodore Ts'o, Andreas Dilger, Harshad Shirwadkar, linux-ext4,
	1039883

On Wed 19 Jun 2024 12:30:38 AM +02, Ben Hutchings wrote;

> On Tue, 2024-06-18 at 15:43 +0100, Luis Henriques (SUSE) wrote:
>> When fast-commit needs to track ranges, it has to handle inodes that have
>> inlined data in a different way because ext4_fc_write_inode_data(), in the
>> actual commit path, will attempt to map the required blocks for the range.
>> However, inodes that have inlined data will have it's data stored in
>> inode->i_block and, eventually, in the extended attribute space.
>> 
>> Unfortunately, because fast commit doesn't currently support extended
>> attributes, the solution is to mark this commit as ineligible.
>> 
>> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039883
>> Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
>
> Reported-by: Hervé Werner <dud225@hotmail.com>
> Tested-by: Ben Hutchings <benh@debian.org>
>

Thanks a lot, Ben.

> I think this should also have:
>
> Fixes: 9725958bb75c ("ext4: fast commit may miss tracking unwritten range during ftruncate")
>
> unless you think the problem is even older than that.

If my understanding is correct (hopefully someone will confirm that!), I
think the problem goes further back.  That commit just makes it more
likely to be visible, but handling of inlined data is incorrect since the
fast_commit merge.  So, I guess that's better to simply add:

Cc: stable@vger.kernel.org

Cheers,
-- 
Luís


>
> Ben.
>
>> ---
>>  fs/ext4/fast_commit.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>> 
>> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
>> index 87c009e0c59a..d3a67bc06d10 100644
>> --- a/fs/ext4/fast_commit.c
>> +++ b/fs/ext4/fast_commit.c
>> @@ -649,6 +649,12 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star
>>  	if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE))
>>  		return;
>>  
>> +	if (ext4_has_inline_data(inode)) {
>> +		ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
>> +					handle);
>> +		return;
>> +	}
>> +
>>  	args.start = start;
>>  	args.end = end;
>>  
>
> -- 
> Ben Hutchings
> For every complex problem
> there is a solution that is simple, neat, and wrong.
>

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

* Re: [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data
  2024-06-19  7:58   ` Luis Henriques
@ 2024-06-19 13:47     ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2024-06-19 13:47 UTC (permalink / raw)
  To: Luis Henriques
  Cc: Theodore Ts'o, Andreas Dilger, Harshad Shirwadkar, linux-ext4,
	1039883

[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]

On Wed, 2024-06-19 at 08:58 +0100, Luis Henriques wrote:
> On Wed 19 Jun 2024 12:30:38 AM +02, Ben Hutchings wrote;
> 
> > On Tue, 2024-06-18 at 15:43 +0100, Luis Henriques (SUSE) wrote:
> > > When fast-commit needs to track ranges, it has to handle inodes that have
> > > inlined data in a different way because ext4_fc_write_inode_data(), in the
> > > actual commit path, will attempt to map the required blocks for the range.
> > > However, inodes that have inlined data will have it's data stored in
> > > inode->i_block and, eventually, in the extended attribute space.
> > > 
> > > Unfortunately, because fast commit doesn't currently support extended
> > > attributes, the solution is to mark this commit as ineligible.
> > > 
> > > Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039883
> > > Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
> > 
> > Reported-by: Hervé Werner <dud225@hotmail.com>
> > Tested-by: Ben Hutchings <benh@debian.org>
> > 
> 
> Thanks a lot, Ben.
> 
> > I think this should also have:
> > 
> > Fixes: 9725958bb75c ("ext4: fast commit may miss tracking unwritten range during ftruncate")
> > 
> > unless you think the problem is even older than that.
> 
> If my understanding is correct (hopefully someone will confirm that!), I
> think the problem goes further back.  That commit just makes it more
> likely to be visible, but handling of inlined data is incorrect since the
> fast_commit merge.  So, I guess that's better to simply add:
> 
> Cc: stable@vger.kernel.org

That makes sense to me.

Ben.

-- 
Ben Hutchings
For every complex problem
there is a solution that is simple, neat, and wrong.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data
  2024-06-18 14:43 [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data Luis Henriques (SUSE)
  2024-06-18 22:30 ` Ben Hutchings
@ 2024-07-11  2:35 ` Theodore Ts'o
  1 sibling, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2024-07-11  2:35 UTC (permalink / raw)
  To: Andreas Dilger, Luis Henriques (SUSE)
  Cc: Theodore Ts'o, Ben Hutchings, Harshad Shirwadkar, linux-ext4


On Tue, 18 Jun 2024 15:43:12 +0100, Luis Henriques (SUSE) wrote:
> When fast-commit needs to track ranges, it has to handle inodes that have
> inlined data in a different way because ext4_fc_write_inode_data(), in the
> actual commit path, will attempt to map the required blocks for the range.
> However, inodes that have inlined data will have it's data stored in
> inode->i_block and, eventually, in the extended attribute space.
> 
> Unfortunately, because fast commit doesn't currently support extended
> attributes, the solution is to mark this commit as ineligible.
> 
> [...]

Applied, thanks!

[1/1] ext4: don't track ranges in fast_commit if inode has inlined data
      commit: 7882b0187bbeb647967a7b5998ce4ad26ef68a9a

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

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

end of thread, other threads:[~2024-07-11  2:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 14:43 [PATCH] ext4: don't track ranges in fast_commit if inode has inlined data Luis Henriques (SUSE)
2024-06-18 22:30 ` Ben Hutchings
2024-06-19  7:58   ` Luis Henriques
2024-06-19 13:47     ` Ben Hutchings
2024-07-11  2:35 ` Theodore Ts'o

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