fdescfs, devfs, mqueuefs, nfs, portalfs, pseudofs, tmpfs and xfs
initialize the vattr structure in VOP_GETATTR() with VATTR_NULL(), vattr_null() or by zeroing it. Remove these to allow preinitialization of fields work in vn_stat(). This is needed to get birthtime initialized correctly. Submitted by: Jaakko Heinonen <jh saunalahti fi> Discussed on: freebsd-fs MFC after: 1 month
This commit is contained in:
parent
4c5a20e3da
commit
caf8aec886
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183215
@ -499,8 +499,6 @@ devfs_getattr(struct vop_getattr_args *ap)
|
||||
KASSERT(de != NULL,
|
||||
("Null dir dirent in devfs_getattr vp=%p", vp));
|
||||
}
|
||||
bzero((caddr_t) vap, sizeof(*vap));
|
||||
vattr_null(vap);
|
||||
vap->va_uid = de->de_uid;
|
||||
vap->va_gid = de->de_gid;
|
||||
vap->va_mode = de->de_mode;
|
||||
@ -543,6 +541,7 @@ devfs_getattr(struct vop_getattr_args *ap)
|
||||
}
|
||||
vap->va_gen = 0;
|
||||
vap->va_flags = 0;
|
||||
vap->va_filerev = 0;
|
||||
vap->va_nlink = de->de_links;
|
||||
vap->va_fileid = de->de_inode;
|
||||
|
||||
|
@ -391,8 +391,6 @@ fdesc_getattr(ap)
|
||||
|
||||
switch (VTOFDESC(vp)->fd_type) {
|
||||
case Froot:
|
||||
VATTR_NULL(vap);
|
||||
|
||||
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
|
||||
vap->va_type = VDIR;
|
||||
vap->va_nlink = 2;
|
||||
@ -409,6 +407,7 @@ fdesc_getattr(ap)
|
||||
vap->va_flags = 0;
|
||||
vap->va_rdev = NODEV;
|
||||
vap->va_bytes = 0;
|
||||
vap->va_filerev = 0;
|
||||
break;
|
||||
|
||||
case Fdesc:
|
||||
@ -421,7 +420,6 @@ fdesc_getattr(ap)
|
||||
error = fo_stat(fp, &stb, td->td_ucred, td);
|
||||
fdrop(fp, td);
|
||||
if (error == 0) {
|
||||
VATTR_NULL(vap);
|
||||
vap->va_type = IFTOVT(stb.st_mode);
|
||||
vap->va_mode = stb.st_mode;
|
||||
#define FDRX (VREAD|VEXEC)
|
||||
@ -456,6 +454,8 @@ fdesc_getattr(ap)
|
||||
vap->va_ctime = stb.st_ctimespec;
|
||||
vap->va_uid = stb.st_uid;
|
||||
vap->va_gid = stb.st_gid;
|
||||
vap->va_gen = 0;
|
||||
vap->va_filerev = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -452,8 +452,6 @@ portal_getattr(ap)
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct vattr *vap = ap->a_vap;
|
||||
|
||||
bzero(vap, sizeof(*vap));
|
||||
vattr_null(vap);
|
||||
vap->va_uid = 0;
|
||||
vap->va_gid = 0;
|
||||
vap->va_size = DEV_BSIZE;
|
||||
@ -466,6 +464,7 @@ portal_getattr(ap)
|
||||
vap->va_rdev = NODEV;
|
||||
/* vap->va_qbytes = 0; */
|
||||
vap->va_bytes = 0;
|
||||
vap->va_filerev = 0;
|
||||
/* vap->va_qsize = 0; */
|
||||
if (vp->v_vflag & VV_ROOT) {
|
||||
vap->va_type = VDIR;
|
||||
|
@ -191,12 +191,12 @@ pfs_getattr(struct vop_getattr_args *va)
|
||||
if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc))
|
||||
PFS_RETURN (ENOENT);
|
||||
|
||||
VATTR_NULL(vap);
|
||||
vap->va_type = vn->v_type;
|
||||
vap->va_fileid = pn_fileno(pn, pvd->pvd_pid);
|
||||
vap->va_flags = 0;
|
||||
vap->va_blocksize = PAGE_SIZE;
|
||||
vap->va_bytes = vap->va_size = 0;
|
||||
vap->va_filerev = 0;
|
||||
vap->va_fsid = vn->v_mount->mnt_stat.f_fsid.val[0];
|
||||
vap->va_nlink = 1;
|
||||
nanotime(&vap->va_ctime);
|
||||
|
@ -344,8 +344,6 @@ tmpfs_getattr(struct vop_getattr_args *v)
|
||||
|
||||
node = VP_TO_TMPFS_NODE(vp);
|
||||
|
||||
VATTR_NULL(vap);
|
||||
|
||||
tmpfs_update(vp);
|
||||
|
||||
vap->va_type = vp->v_type;
|
||||
|
@ -240,7 +240,6 @@ _xfs_getattr(
|
||||
/* extract the xfs vnode from the private data */
|
||||
//xfs_vnode_t *xvp = (xfs_vnode_t *)vp->v_data;
|
||||
|
||||
VATTR_NULL(vap);
|
||||
memset(&va,0,sizeof(xfs_vattr_t));
|
||||
va.va_mask = XFS_AT_STAT|XFS_AT_GENCOUNT|XFS_AT_XFLAGS;
|
||||
|
||||
|
@ -1164,7 +1164,6 @@ mqfs_getattr(struct vop_getattr_args *ap)
|
||||
struct vattr *vap = ap->a_vap;
|
||||
int error = 0;
|
||||
|
||||
VATTR_NULL(vap);
|
||||
vap->va_type = vp->v_type;
|
||||
vap->va_mode = pn->mn_mode;
|
||||
vap->va_nlink = 1;
|
||||
|
@ -631,6 +631,8 @@ nfs_getattr(struct vop_getattr_args *ap)
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct thread *td = curthread;
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct vattr vattr;
|
||||
caddr_t bpos, dpos;
|
||||
int error = 0;
|
||||
struct mbuf *mreq, *mrep, *md, *mb;
|
||||
@ -646,12 +648,12 @@ nfs_getattr(struct vop_getattr_args *ap)
|
||||
/*
|
||||
* First look in the cache.
|
||||
*/
|
||||
if (nfs_getattrcache(vp, ap->a_vap) == 0)
|
||||
if (nfs_getattrcache(vp, &vattr) == 0)
|
||||
goto nfsmout;
|
||||
if (v3 && nfsaccess_cache_timeout > 0) {
|
||||
nfsstats.accesscache_misses++;
|
||||
nfs3_access_otw(vp, NFSV3ACCESS_ALL, td, ap->a_cred);
|
||||
if (nfs_getattrcache(vp, ap->a_vap) == 0)
|
||||
if (nfs_getattrcache(vp, &vattr) == 0)
|
||||
goto nfsmout;
|
||||
}
|
||||
nfsstats.rpccnt[NFSPROC_GETATTR]++;
|
||||
@ -661,10 +663,28 @@ nfs_getattr(struct vop_getattr_args *ap)
|
||||
nfsm_fhtom(vp, v3);
|
||||
nfsm_request(vp, NFSPROC_GETATTR, td, ap->a_cred);
|
||||
if (!error) {
|
||||
nfsm_loadattr(vp, ap->a_vap);
|
||||
nfsm_loadattr(vp, &vattr);
|
||||
}
|
||||
m_freem(mrep);
|
||||
nfsmout:
|
||||
vap->va_type = vattr.va_type;
|
||||
vap->va_mode = vattr.va_mode;
|
||||
vap->va_nlink = vattr.va_nlink;
|
||||
vap->va_uid = vattr.va_uid;
|
||||
vap->va_gid = vattr.va_gid;
|
||||
vap->va_fsid = vattr.va_fsid;
|
||||
vap->va_fileid = vattr.va_fileid;
|
||||
vap->va_size = vattr.va_size;
|
||||
vap->va_blocksize = vattr.va_blocksize;
|
||||
vap->va_atime = vattr.va_atime;
|
||||
vap->va_mtime = vattr.va_mtime;
|
||||
vap->va_ctime = vattr.va_ctime;
|
||||
vap->va_gen = vattr.va_gen;
|
||||
vap->va_flags = vattr.va_flags;
|
||||
vap->va_rdev = vattr.va_rdev;
|
||||
vap->va_bytes = vattr.va_bytes;
|
||||
vap->va_filerev = vattr.va_filerev;
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user