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


Groups > linux.kernel > #1525075

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

From Andreas Dilger <adilger@dilger.ca>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] statx: AFS: Return enhanced file attributes
Date 2016-11-18 09:30 +0100
Message-ID <sEMIx-4Dr-9@gated-at.bofh.it> (permalink)
References <sEvol-1nz-5@gated-at.bofh.it> <sEyvV-3yz-77@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 17, 2016, at 6:35 AM, David Howells <dhowells@redhat.com> wrote:
> 
> Return enhanced file attributes from the AFS filesystem.  This includes the
> following:
> 
> (1) The data version number as st_version, setting STATX_VERSION.
> 
> (2) 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.
> 
> (3) STATX_ATTR_UNLISTED_DENTS on a directory that does cell lookup for
>     non-existent names and mounts them (typically mounted on /afs with -o
>     autocell).  The resulting directories are marked STATX_ATTR_FABRICATED
>     as they do not actually exist in the mounted AFS directory.
> 
> (4) Files, directories and symlinks accessed over AFS are marked
>     STATX_ATTR_REMOTE.
> 
> STATX_ATIME, STATX_CTIME and STATX_BLOCKS are cleared as AFS does not
> support them.

Rather than clearing specific flags, wouldn't it be better to explicitly
set the flags that are actually being returned?  Otherwise, this would
have the problem that Dave pointed out on the 0/4 patch, that there may
be flags still set from userspace that do not mean anything to AFS.

Cheers, Andreas

> 
> Example output:
> 
> 	[root@andromeda ~]# ./samples/statx/test-statx /afs
> 	statx(/afs) = 0
> 	results=7ef
> 	  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
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
> 
> fs/afs/inode.c |   21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/afs/inode.c b/fs/afs/inode.c
> index 86cc7264c21c..b08c405a7e1b 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,18 @@ 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);
> +	stat->result_mask |= STATX_VERSION;
> +	stat->version = inode->i_version;
> +
> +	if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags))
> +		stat->attributes |= STATX_ATTR_UNLISTED_DENTS;
> +
> +	if (test_bit(AFS_VNODE_PSEUDODIR, &AFS_FS_I(inode)->flags))
> +		stat->attributes |= STATX_ATTR_FABRICATED;
> +	else
> +		stat->attributes |= STATX_ATTR_REMOTE;
> 	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 David Howells <dhowells@redhat.com> - 2016-11-17 15:00 +0100
  Re: [RFC][PATCH 0/4] Enhanced file stat system call David Howells <dhowells@redhat.com> - 2016-11-17 18:10 +0100
  Re: [RFC][PATCH 0/4] Enhanced file stat system call David Howells <dhowells@redhat.com> - 2016-11-17 18:10 +0100
    Re: [RFC][PATCH 0/4] Enhanced file stat system call bfields@fieldses.org (J. Bruce Fields) - 2016-11-17 21:10 +0100
      Re: [RFC][PATCH 0/4] Enhanced file stat system call Andreas Dilger <adilger@dilger.ca> - 2016-11-18 03:50 +0100
        Re: [RFC][PATCH 0/4] Enhanced file stat system call NeilBrown <neilb@suse.com> - 2016-11-18 05:40 +0100
    Re: [RFC][PATCH 0/4] Enhanced file stat system call One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-11-18 14:50 +0100
      Re: [RFC][PATCH 0/4] Enhanced file stat system call David Howells <dhowells@redhat.com> - 2016-11-18 14:50 +0100
  Re: [RFC][PATCH 0/4] Enhanced file stat system call Michael Kerrisk <mtk.manpages@gmail.com> - 2016-11-17 18:20 +0100
  [PATCH 3/4] statx: NFS: Return enhanced file attributes David Howells <dhowells@redhat.com> - 2016-11-17 18:20 +0100
  [PATCH 2/4] statx: Ext4: Return enhanced file attributes David Howells <dhowells@redhat.com> - 2016-11-17 18:20 +0100
    Re: [PATCH 2/4] statx: Ext4: Return enhanced file attributes Andreas Dilger <adilger@dilger.ca> - 2016-11-18 04:40 +0100
  [PATCH 4/4] statx: AFS: Return enhanced file attributes David Howells <dhowells@redhat.com> - 2016-11-17 18:20 +0100
    Re: [PATCH 4/4] statx: AFS: Return enhanced file attributes Andreas Dilger <adilger@dilger.ca> - 2016-11-18 09:30 +0100
      Re: [PATCH 4/4] statx: AFS: Return enhanced file attributes David Howells <dhowells@redhat.com> - 2016-11-18 09:50 +0100
  Re: [RFC][PATCH 0/4] Enhanced file stat system call One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-11-17 19:00 +0100
  Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-18 00:50 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available Andreas Dilger <adilger@dilger.ca> - 2016-11-18 04:30 +0100
      Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 11:00 +0100
      Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-18 23:10 +0100
        Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-19 00:00 +0100
          Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-19 23:50 +0100
            Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-22 11:40 +0100
              Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Jeff Layton <jlayton@redhat.com> - 2016-11-22 15:00 +0100
              Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-22 22:00 +0100
          Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-11-21 15:40 +0100
            Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-21 21:50 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 10:40 +0100
      Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Jeff Layton <jlayton@poochiereds.net> - 2016-11-18 18:20 +0100
        Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 19:10 +0100
          Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Jeff Layton <jlayton@redhat.com> - 2016-11-18 20:00 +0100
            Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 20:10 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 10:50 +0100
      Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-18 22:50 +0100
        Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 23:30 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 11:30 +0100
      Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-18 22:30 +0100
        Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 22:50 +0100
          Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Dave Chinner <david@fromorbit.com> - 2016-11-18 23:20 +0100
            Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-19 11:30 +0100
  Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 09:50 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info  available Jeff Layton <jlayton@redhat.com> - 2016-11-18 13:10 +0100
  Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available David Howells <dhowells@redhat.com> - 2016-11-18 10:00 +0100
    Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available Andreas Dilger <adilger@dilger.ca> - 2016-11-18 10:30 +0100

csiph-web