diff mbox series

[v5,22/24] xfs: make scrub aware of verity dinode flag

Message ID 20240304191046.157464-24-aalbersh@redhat.com (mailing list archive)
State New, archived
Headers show
Series fs-verity support for XFS | expand

Commit Message

Andrey Albershteyn March 4, 2024, 7:10 p.m. UTC
fs-verity adds new inode flag which causes scrub to fail as it is
not yet known.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong March 7, 2024, 10:18 p.m. UTC | #1
On Mon, Mar 04, 2024 at 08:10:45PM +0100, Andrey Albershteyn wrote:
> fs-verity adds new inode flag which causes scrub to fail as it is
> not yet known.
> 
> Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/scrub/attr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
> index 9a1f59f7b5a4..ae4227cb55ec 100644
> --- a/fs/xfs/scrub/attr.c
> +++ b/fs/xfs/scrub/attr.c
> @@ -494,7 +494,7 @@ xchk_xattr_rec(
>  	/* Retrieve the entry and check it. */
>  	hash = be32_to_cpu(ent->hashval);
>  	badflags = ~(XFS_ATTR_LOCAL | XFS_ATTR_ROOT | XFS_ATTR_SECURE |
> -			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT);
> +			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT | XFS_ATTR_VERITY);

Now that online repair can modify/discard/salvage broken xattr trees and
is pretty close to merging, how can I make it invalidate all the incore
merkle tree data after a repair?

--D

>  	if ((ent->flags & badflags) != 0)
>  		xchk_da_set_corrupt(ds, level);
>  	if (ent->flags & XFS_ATTR_LOCAL) {
> -- 
> 2.42.0
> 
>
Andrey Albershteyn March 12, 2024, 12:10 p.m. UTC | #2
On 2024-03-07 14:18:09, Darrick J. Wong wrote:
> On Mon, Mar 04, 2024 at 08:10:45PM +0100, Andrey Albershteyn wrote:
> > fs-verity adds new inode flag which causes scrub to fail as it is
> > not yet known.
> > 
> > Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
> > Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  fs/xfs/scrub/attr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
> > index 9a1f59f7b5a4..ae4227cb55ec 100644
> > --- a/fs/xfs/scrub/attr.c
> > +++ b/fs/xfs/scrub/attr.c
> > @@ -494,7 +494,7 @@ xchk_xattr_rec(
> >  	/* Retrieve the entry and check it. */
> >  	hash = be32_to_cpu(ent->hashval);
> >  	badflags = ~(XFS_ATTR_LOCAL | XFS_ATTR_ROOT | XFS_ATTR_SECURE |
> > -			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT);
> > +			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT | XFS_ATTR_VERITY);
> 
> Now that online repair can modify/discard/salvage broken xattr trees and
> is pretty close to merging, how can I make it invalidate all the incore
> merkle tree data after a repair?
> 
> --D
> 

I suppose dropping all the xattr XFS_ATTR_VERITY buffers associated
with an inode should do the job.
Darrick J. Wong March 12, 2024, 4:38 p.m. UTC | #3
On Tue, Mar 12, 2024 at 01:10:06PM +0100, Andrey Albershteyn wrote:
> On 2024-03-07 14:18:09, Darrick J. Wong wrote:
> > On Mon, Mar 04, 2024 at 08:10:45PM +0100, Andrey Albershteyn wrote:
> > > fs-verity adds new inode flag which causes scrub to fail as it is
> > > not yet known.
> > > 
> > > Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
> > > Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > >  fs/xfs/scrub/attr.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
> > > index 9a1f59f7b5a4..ae4227cb55ec 100644
> > > --- a/fs/xfs/scrub/attr.c
> > > +++ b/fs/xfs/scrub/attr.c
> > > @@ -494,7 +494,7 @@ xchk_xattr_rec(
> > >  	/* Retrieve the entry and check it. */
> > >  	hash = be32_to_cpu(ent->hashval);
> > >  	badflags = ~(XFS_ATTR_LOCAL | XFS_ATTR_ROOT | XFS_ATTR_SECURE |
> > > -			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT);
> > > +			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT | XFS_ATTR_VERITY);
> > 
> > Now that online repair can modify/discard/salvage broken xattr trees and
> > is pretty close to merging, how can I make it invalidate all the incore
> > merkle tree data after a repair?
> > 
> > --D
> > 
> 
> I suppose dropping all the xattr XFS_ATTR_VERITY buffers associated
> with an inode should do the job.

Oh!  Yes, xfs_verity_cache_drop would handle that nicely.

--D

> -- 
> - Andrey
> 
>
Darrick J. Wong March 13, 2024, 1:35 a.m. UTC | #4
On Tue, Mar 12, 2024 at 09:38:09AM -0700, Darrick J. Wong wrote:
> On Tue, Mar 12, 2024 at 01:10:06PM +0100, Andrey Albershteyn wrote:
> > On 2024-03-07 14:18:09, Darrick J. Wong wrote:
> > > On Mon, Mar 04, 2024 at 08:10:45PM +0100, Andrey Albershteyn wrote:
> > > > fs-verity adds new inode flag which causes scrub to fail as it is
> > > > not yet known.
> > > > 
> > > > Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
> > > > Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> > > > ---
> > > >  fs/xfs/scrub/attr.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
> > > > index 9a1f59f7b5a4..ae4227cb55ec 100644
> > > > --- a/fs/xfs/scrub/attr.c
> > > > +++ b/fs/xfs/scrub/attr.c
> > > > @@ -494,7 +494,7 @@ xchk_xattr_rec(
> > > >  	/* Retrieve the entry and check it. */
> > > >  	hash = be32_to_cpu(ent->hashval);
> > > >  	badflags = ~(XFS_ATTR_LOCAL | XFS_ATTR_ROOT | XFS_ATTR_SECURE |
> > > > -			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT);
> > > > +			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT | XFS_ATTR_VERITY);
> > > 
> > > Now that online repair can modify/discard/salvage broken xattr trees and
> > > is pretty close to merging, how can I make it invalidate all the incore
> > > merkle tree data after a repair?
> > > 
> > > --D
> > > 
> > 
> > I suppose dropping all the xattr XFS_ATTR_VERITY buffers associated
> > with an inode should do the job.
> 
> Oh!  Yes, xfs_verity_cache_drop would handle that nicely.

Here's today's branch, in which I implemented Eric's suggestions for the
"support block-based Merkle tree caching" patch, except for the ones
that conflict with the different direction I went in for
->read_merkle_tree_block; and implemented Dave's suggestions for
shrinker improvements:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/log/?h=fsverity-cleanups-6.9_2024-03-12

--D

> --D
> 
> > -- 
> > - Andrey
> > 
> > 
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index 9a1f59f7b5a4..ae4227cb55ec 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -494,7 +494,7 @@  xchk_xattr_rec(
 	/* Retrieve the entry and check it. */
 	hash = be32_to_cpu(ent->hashval);
 	badflags = ~(XFS_ATTR_LOCAL | XFS_ATTR_ROOT | XFS_ATTR_SECURE |
-			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT);
+			XFS_ATTR_INCOMPLETE | XFS_ATTR_PARENT | XFS_ATTR_VERITY);
 	if ((ent->flags & badflags) != 0)
 		xchk_da_set_corrupt(ds, level);
 	if (ent->flags & XFS_ATTR_LOCAL) {