Re: [PATCH v4 2/4] ovl: Add versioned header for overlay.metacopy xattr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 21, 2023 at 01:18:26PM +0200, Alexander Larsson wrote:
> Historically overlay.metacopy was a zero-size xattr, and it's
> existence marked a metacopy file. This change adds a versioned header
> with a flag field, a length and a digest. The initial use-case of this
> will be for validating a fs-verity digest, but the flags field could
> also be used later for other new features.
> 
> ovl_check_metacopy_xattr() now returns the size of the xattr,
> emulating a size of OVL_METACOPY_MIN_SIZE for empty xattrs to
> distinguish it from the no-xattr case.
> 
> Signed-off-by: Alexander Larsson <alexl@xxxxxxxxxx>
> ---
>  fs/overlayfs/namei.c     | 10 +++++-----
>  fs/overlayfs/overlayfs.h | 24 +++++++++++++++++++++++-
>  fs/overlayfs/util.c      | 37 +++++++++++++++++++++++++++++++++----
>  3 files changed, 61 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index 57adf911735f..3dd480253710 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -25,7 +25,7 @@ struct ovl_lookup_data {
>  	bool stop;
>  	bool last;
>  	char *redirect;
> -	bool metacopy;
> +	int metacopy;

Should this be called 'metacopy_size' now?

> -		err = ovl_check_metacopy_xattr(OVL_FS(d->sb), &path);
> +		err = ovl_check_metacopy_xattr(OVL_FS(d->sb), &path, NULL);
>  		if (err < 0)
>  			goto out_err;

This part is confusing because variables named 'err' conventionally contain only
0 or a negative errno value.  But this patch makes it possible for
ovl_check_metacopy_xattr() to return a positive size.

- Eric



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux