[2/4] ext4: support STATX_ATTR_VERITY
diff mbox series

Message ID 20191029204141.145309-3-ebiggers@kernel.org
State Accepted
Headers show
Series
  • statx: expose the fs-verity bit
Related show

Commit Message

Eric Biggers Oct. 29, 2019, 8:41 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Set the STATX_ATTR_VERITY bit when the statx() system call is used on a
verity file on ext4.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/ext4/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Andreas Dilger Oct. 30, 2019, 6:27 p.m. UTC | #1
> On Oct 29, 2019, at 2:41 PM, Eric Biggers <ebiggers@kernel.org> wrote:
> 
> From: Eric Biggers <ebiggers@google.com>
> 
> Set the STATX_ATTR_VERITY bit when the statx() system call is used on a
> verity file on ext4.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>


> ---
> fs/ext4/inode.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 516faa280ceda8..a7ca6517798008 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -5717,12 +5717,15 @@ int ext4_getattr(const struct path *path, struct kstat *stat,
> 		stat->attributes |= STATX_ATTR_IMMUTABLE;
> 	if (flags & EXT4_NODUMP_FL)
> 		stat->attributes |= STATX_ATTR_NODUMP;
> +	if (flags & EXT4_VERITY_FL)
> +		stat->attributes |= STATX_ATTR_VERITY;
> 
> 	stat->attributes_mask |= (STATX_ATTR_APPEND |
> 				  STATX_ATTR_COMPRESSED |
> 				  STATX_ATTR_ENCRYPTED |
> 				  STATX_ATTR_IMMUTABLE |
> -				  STATX_ATTR_NODUMP);
> +				  STATX_ATTR_NODUMP |
> +				  STATX_ATTR_VERITY);
> 
> 	generic_fillattr(inode, stat);
> 	return 0;
> --
> 2.24.0.rc1.363.gb1bccd3e3d-goog
> 


Cheers, Andreas

Patch
diff mbox series

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 516faa280ceda8..a7ca6517798008 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5717,12 +5717,15 @@  int ext4_getattr(const struct path *path, struct kstat *stat,
 		stat->attributes |= STATX_ATTR_IMMUTABLE;
 	if (flags & EXT4_NODUMP_FL)
 		stat->attributes |= STATX_ATTR_NODUMP;
+	if (flags & EXT4_VERITY_FL)
+		stat->attributes |= STATX_ATTR_VERITY;
 
 	stat->attributes_mask |= (STATX_ATTR_APPEND |
 				  STATX_ATTR_COMPRESSED |
 				  STATX_ATTR_ENCRYPTED |
 				  STATX_ATTR_IMMUTABLE |
-				  STATX_ATTR_NODUMP);
+				  STATX_ATTR_NODUMP |
+				  STATX_ATTR_VERITY);
 
 	generic_fillattr(inode, stat);
 	return 0;