svn commit: r191564 - head/sys/ufs/ufs
Rick Macklem
rmacklem at FreeBSD.org
Mon Apr 27 16:46:18 UTC 2009
Author: rmacklem
Date: Mon Apr 27 16:46:16 2009
New Revision: 191564
URL: http://svn.freebsd.org/changeset/base/191564
Log:
Change the semantics of i_modrev/va_filerev to what is required for
the nfsv4 Change attribute. There are 2 changes:
1 - The value now changes on metadata changes as well as data
modifications (incremented for IN_CHANGE instead of IN_UPDATE).
2 - It is now saved in spare space in the on-disk i-node so that it
survives a crash.
Since va_filerev is not passed out into user space, the only current
use of va_filerev is in the nfs server, which uses it as the directory
cookie verifier. Since this verifier is only passed back to the server
by a client verbatim and then the server doesn't check it, changing the
semantics should not break anything currently in FreeBSD.
Reviewed by: bde
Approved by: kib (mentor)
Modified:
head/sys/ufs/ufs/dinode.h
head/sys/ufs/ufs/inode.h
head/sys/ufs/ufs/ufs_vnops.c
Modified: head/sys/ufs/ufs/dinode.h
==============================================================================
--- head/sys/ufs/ufs/dinode.h Mon Apr 27 15:58:38 2009 (r191563)
+++ head/sys/ufs/ufs/dinode.h Mon Apr 27 16:46:16 2009 (r191564)
@@ -145,7 +145,8 @@ struct ufs2_dinode {
ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */
ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */
ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */
- int64_t di_spare[3]; /* 232: Reserved; currently unused */
+ u_int64_t di_modrev; /* 232: i_modrev for NFSv4 */
+ int64_t di_spare[2]; /* 240: Reserved; currently unused */
};
/*
@@ -183,7 +184,7 @@ struct ufs1_dinode {
int32_t di_gen; /* 108: Generation number. */
u_int32_t di_uid; /* 112: File owner. */
u_int32_t di_gid; /* 116: File group. */
- int32_t di_spare[2]; /* 120: Reserved; currently unused */
+ u_int64_t di_modrev; /* 120: i_modrev for NFSv4 */
};
#define di_ogid di_u.oldids[1]
#define di_ouid di_u.oldids[0]
Modified: head/sys/ufs/ufs/inode.h
==============================================================================
--- head/sys/ufs/ufs/inode.h Mon Apr 27 15:58:38 2009 (r191563)
+++ head/sys/ufs/ufs/inode.h Mon Apr 27 16:46:16 2009 (r191564)
@@ -74,7 +74,6 @@ struct inode {
struct fs *i_fs; /* Associated filesystem superblock. */
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
- u_quad_t i_modrev; /* Revision level for NFS lease. */
/*
* Side effects; used during directory lookup.
*/
Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c Mon Apr 27 15:58:38 2009 (r191563)
+++ head/sys/ufs/ufs/ufs_vnops.c Mon Apr 27 16:46:16 2009 (r191564)
@@ -157,11 +157,11 @@ ufs_itimes_locked(struct vnode *vp)
if (ip->i_flag & IN_UPDATE) {
DIP_SET(ip, i_mtime, ts.tv_sec);
DIP_SET(ip, i_mtimensec, ts.tv_nsec);
- ip->i_modrev++;
}
if (ip->i_flag & IN_CHANGE) {
DIP_SET(ip, i_ctime, ts.tv_sec);
DIP_SET(ip, i_ctimensec, ts.tv_nsec);
+ DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1);
}
out:
@@ -446,6 +446,7 @@ ufs_getattr(ap)
vap->va_ctime.tv_sec = ip->i_din1->di_ctime;
vap->va_ctime.tv_nsec = ip->i_din1->di_ctimensec;
vap->va_bytes = dbtob((u_quad_t)ip->i_din1->di_blocks);
+ vap->va_filerev = ip->i_din1->di_modrev;
} else {
vap->va_rdev = ip->i_din2->di_rdev;
vap->va_size = ip->i_din2->di_size;
@@ -456,12 +457,12 @@ ufs_getattr(ap)
vap->va_birthtime.tv_sec = ip->i_din2->di_birthtime;
vap->va_birthtime.tv_nsec = ip->i_din2->di_birthnsec;
vap->va_bytes = dbtob((u_quad_t)ip->i_din2->di_blocks);
+ vap->va_filerev = ip->i_din2->di_modrev;
}
vap->va_flags = ip->i_flags;
vap->va_gen = ip->i_gen;
vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
vap->va_type = IFTOVT(ip->i_mode);
- vap->va_filerev = ip->i_modrev;
return (0);
}
@@ -2225,7 +2226,6 @@ ufs_vinit(mntp, fifoops, vpp)
ASSERT_VOP_LOCKED(vp, "ufs_vinit");
if (ip->i_number == ROOTINO)
vp->v_vflag |= VV_ROOT;
- ip->i_modrev = init_va_filerev();
*vpp = vp;
return (0);
}
More information about the svn-src-head
mailing list