Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1528923

Re: [PATCH 4/4] statx: AFS: Return enhanced file attributes [ver #3]

From Andreas Dilger <adilger@dilger.ca>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] statx: AFS: Return enhanced file attributes [ver #3]
Date 2016-11-24 03:10 +0100
Message-ID <sGRE5-4x0-1@gated-at.bofh.it> (permalink)
References <sGu4N-6a5-5@gated-at.bofh.it> <sGuet-6si-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Nov 22, 2016, at 5:56 PM, David Howells <dhowells@redhat.com> wrote:
> 
> Return enhanced file attributes from the AFS filesystem.  This includes the
> following:
> 
> (1) STATX_ATTR_AUTOMOUNT will be set on automount directories by virtue of
>     S_AUTOMOUNT being set on the inode.  These are referrals to other
>     volumes or other cells.
> 
> STATX_ATIME, STATX_CTIME and STATX_BLOCKS are cleared as AFS does not
> support them.
> 
> Example output:
> 
> 	[root@andromeda ~]# ./samples/statx/test-statx /afs
> 	statx(/afs) = 0
> 	results=7ef

This decodes to everything except STATX_GID being set:
STATX_TYPE	0x00000001U
STATX_MODE	0x00000002U
STATX_NLINK	0x00000004U
STATX_UID	0x00000008U
!STATX_GID	0x00000010U
STATX_ATIME	0x00000020U
STATX_MTIME	0x00000040U
STATX_CTIME	0x00000080U
STATX_INO	0x00000100U
STATX_SIZE	0x00000200U
STATX_BLOCKS	0x00000400U

> 	Size: 2048      Blocks: 0      IO Block: 4096  directory
> 	Device: 00:25           Inode: 1           Links: 2
> 	Access: (0777/drwxrwxrwx)  Uid:     0   Gid:     0
> 	Access: 2006-05-07 00:21:15.000000000+0100
> 	Modify: 2006-05-07 00:21:15.000000000+0100
> 	Change: 2006-05-07 00:21:15.000000000+0100
> 	IO-blocksize: blksize=4096


This is printing Access and Change times, but you write above that
STATX_ATIME, STATX_CTIME, and STATX_BLOCKS are unset for AFS, so they
shouldn't be printed?  Since "results" appear to indicate those flags
are set, and looking at the dump_statx() code appears that they are
checked, it seems this patch isn't doing what you want to clear flags?

Also, it seems that "Gid:  0" is printed even though it is not set in stx_mask?  Possibly this example is old?

Cheers, Andreas

> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
> 
> fs/afs/inode.c |   11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/afs/inode.c b/fs/afs/inode.c
> index 86cc7264c21c..99662045b6fb 100644
> --- a/fs/afs/inode.c
> +++ b/fs/afs/inode.c
> @@ -72,9 +72,9 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key)
> 	inode->i_uid		= vnode->status.owner;
> 	inode->i_gid		= GLOBAL_ROOT_GID;
> 	inode->i_size		= vnode->status.size;
> -	inode->i_ctime.tv_sec	= vnode->status.mtime_server;
> -	inode->i_ctime.tv_nsec	= 0;
> -	inode->i_atime		= inode->i_mtime = inode->i_ctime;
> +	inode->i_mtime.tv_sec	= vnode->status.mtime_server;
> +	inode->i_mtime.tv_nsec	= 0;
> +	inode->i_atime		= inode->i_ctime = inode->i_mtime;
> 	inode->i_blocks		= 0;
> 	inode->i_generation	= vnode->fid.unique;
> 	inode->i_version	= vnode->status.data_version;
> @@ -375,8 +375,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
> /*
>  * read the attributes of an inode
>  */
> -int afs_getattr(struct vfsmount *mnt, struct dentry *dentry,
> -		      struct kstat *stat)
> +int afs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
> {
> 	struct inode *inode;
> 
> @@ -385,6 +384,8 @@ int afs_getattr(struct vfsmount *mnt, struct dentry *dentry,
> 	_enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
> 
> 	generic_fillattr(inode, stat);
> +
> +	stat->result_mask &= ~(STATX_ATIME | STATX_CTIME | STATX_BLOCKS);
> 	return 0;
> }
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas





Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 0/4] Enhanced file stat system call [ver #3] David Howells <dhowells@redhat.com> - 2016-11-23 02:00 +0100
  [PATCH 4/4] statx: AFS: Return enhanced file attributes [ver #3] David Howells <dhowells@redhat.com> - 2016-11-23 02:10 +0100
    Re: [PATCH 4/4] statx: AFS: Return enhanced file attributes [ver #3] Andreas Dilger <adilger@dilger.ca> - 2016-11-24 03:10 +0100
  Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available [ver #3] "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 09:40 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3] Andreas Dilger <adilger@dilger.ca> - 2016-11-23 23:50 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3] Andreas Dilger <adilger@dilger.ca> - 2016-11-24 00:00 +0100
      Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available [ver #3] "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-24 09:20 +0100
  Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3] David Howells <dhowells@redhat.com> - 2016-11-24 08:40 +0100

csiph-web