Chris sez time is volatile
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 8 Jul 1992 08:37:41 +0000 (00:37 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 8 Jul 1992 08:37:41 +0000 (00:37 -0800)
SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 7.87
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 7.71

usr/src/sys/ufs/lfs/lfs_inode.c
usr/src/sys/ufs/lfs/lfs_vnops.c

index 5aa1644..54404c2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_inode.c 7.70 (Berkeley) %G%
+ *     @(#)lfs_inode.c 7.71 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -132,6 +132,7 @@ lfs_truncate(ap)
        register struct vnode *vp = ap->a_vp;
        off_t length = ap->a_length;
        struct buf *bp, *sup_bp;
        register struct vnode *vp = ap->a_vp;
        off_t length = ap->a_length;
        struct buf *bp, *sup_bp;
+       struct timeval tv;
        struct ifile *ifp;
        struct inode *ip;
        struct lfs *fs;
        struct ifile *ifp;
        struct inode *ip;
        struct lfs *fs;
@@ -157,9 +158,10 @@ lfs_truncate(ap)
        }
 
        /* If length is larger than the file, just update the times. */
        }
 
        /* If length is larger than the file, just update the times. */
+       tv = time;
        if (ip->i_size <= length) {
                ip->i_flag |= ICHG|IUPD;
        if (ip->i_size <= length) {
                ip->i_flag |= ICHG|IUPD;
-               return (VOP_UPDATE(vp, &time, &time, 1));
+               return (VOP_UPDATE(vp, &tv, &tv, 1));
        }
 
        /*
        }
 
        /*
@@ -281,6 +283,6 @@ lfs_truncate(ap)
                ip->i_blocks = 0;
        ip->i_flag |= ICHG|IUPD;
        e1 = vinvalbuf(vp, length > 0, ap->a_cred, ap->a_p); 
                ip->i_blocks = 0;
        ip->i_flag |= ICHG|IUPD;
        e1 = vinvalbuf(vp, length > 0, ap->a_cred, ap->a_p); 
-       e2 = VOP_UPDATE(vp, &time, &time, MNT_WAIT);
+       e2 = VOP_UPDATE(vp, &tv, &tv, MNT_WAIT);
        return (e1 ? e1 : e2 ? e2 : 0);
 }
        return (e1 ? e1 : e2 ? e2 : 0);
 }
index 1749641..6627431 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_vnops.c 7.86 (Berkeley) %G%
+ *     @(#)lfs_vnops.c 7.87 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -263,6 +263,7 @@ lfs_write(ap)
        register struct inode *ip = VTOI(vp);
        register struct lfs *fs;
        register ioflag = ap->a_ioflag;
        register struct inode *ip = VTOI(vp);
        register struct lfs *fs;
        register ioflag = ap->a_ioflag;
+       struct timeval tv;
        struct buf *bp;
        daddr_t lbn;
        off_t osize;
        struct buf *bp;
        daddr_t lbn;
        off_t osize;
@@ -351,8 +352,10 @@ lfs_write(ap)
                uio->uio_offset -= resid - uio->uio_resid;
                uio->uio_resid = resid;
        }
                uio->uio_offset -= resid - uio->uio_resid;
                uio->uio_resid = resid;
        }
-       if (!error && (ioflag & IO_SYNC))
-               error = VOP_UPDATE(vp, &time, &time, 1);
+       if (!error && (ioflag & IO_SYNC)) {
+               tv = time;
+               error = VOP_UPDATE(vp, &tv, &tv, 1);
+       }
        return (error);
 }
 
        return (error);
 }
 
@@ -368,11 +371,13 @@ lfs_fsync(ap)
                struct proc *a_p;
        } */ *ap;
 {
                struct proc *a_p;
        } */ *ap;
 {
+       struct timeval tv;
 
 #ifdef VERBOSE
        printf("lfs_fsync\n");
 #endif
 
 #ifdef VERBOSE
        printf("lfs_fsync\n");
 #endif
-       return (VOP_UPDATE(ap->a_vp, &time, &time, ap->a_waitfor == MNT_WAIT));
+       tv = time;
+       return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
 }
 
 /*
 }
 
 /*
@@ -388,6 +393,7 @@ lfs_inactive(ap)
        extern int prtactive;
        register struct vnode *vp = ap->a_vp;
        register struct inode *ip;
        extern int prtactive;
        register struct vnode *vp = ap->a_vp;
        register struct inode *ip;
+       struct timeval tv;
        int mode, error;
 
 #ifdef VERBOSE
        int mode, error;
 
 #ifdef VERBOSE
@@ -418,8 +424,10 @@ lfs_inactive(ap)
                ip->i_flag |= IUPD|ICHG;
                VOP_VFREE(vp, ip->i_number, mode);
        }
                ip->i_flag |= IUPD|ICHG;
                VOP_VFREE(vp, ip->i_number, mode);
        }
-       if (ip->i_flag&(IUPD|IACC|ICHG|IMOD))
-               VOP_UPDATE(vp, &time, &time, 0);
+       if (ip->i_flag&(IUPD|IACC|ICHG|IMOD)) {
+               tv = time;
+               VOP_UPDATE(vp, &tv, &tv, 0);
+       }
        IUNLOCK(ip);
        ip->i_flag = 0;
        /*
        IUNLOCK(ip);
        ip->i_flag = 0;
        /*