예제 #1
0
static void
ext2_itimes_locked(struct vnode *vp)
{
	struct inode *ip;
	struct timespec ts;

	ASSERT_VI_LOCKED(vp, __func__);	

	ip = VTOI(vp);
	if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0)
		return;
	if ((vp->v_type == VBLK || vp->v_type == VCHR))
		ip->i_flag |= IN_LAZYMOD;
	else
		ip->i_flag |= IN_MODIFIED;
	if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
		vfs_timestamp(&ts);
		if (ip->i_flag & IN_ACCESS) {
			ip->i_atime = ts.tv_sec;
			ip->i_atimensec = ts.tv_nsec;
		}
		if (ip->i_flag & IN_UPDATE) {
			ip->i_mtime = ts.tv_sec;
			ip->i_mtimensec = ts.tv_nsec;
			ip->i_modrev++;
		}
		if (ip->i_flag & IN_CHANGE) {
			ip->i_ctime = ts.tv_sec;
			ip->i_ctimensec = ts.tv_nsec;
		}
	}
	ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE);
}
예제 #2
0
파일: osi_misc.c 프로젝트: openafs/openafs
/**
 * check if a vcache is in use
 *
 * @return status
 *  @retcode 0 success
 *  @retcode EBUSY vcache is in use by someone else
 *  @retcode otherwise other error
 *
 * @pre  The caller must hold the vnode interlock for the associated vnode
 * @post The vnode interlock for the associated vnode will still be held
 *       and must be VI_UNLOCK'd by the caller
 */
int
osi_fbsd_checkinuse(struct vcache *avc)
{
    struct vnode *vp = AFSTOV(avc);

    ASSERT_VI_LOCKED(vp, "osi_fbsd_checkinuse");

    /* The interlock is needed to check the usecount. */
    if (vp->v_usecount > 0) {
	return EBUSY;
    }

    /* XXX
     * The value of avc->opens here came to be, at some point,
     * typically -1.  This was caused by incorrectly performing afs_close
     * processing on vnodes being recycled */
    if (avc->opens) {
	return EBUSY;
    }

    /* if a lock is held, give up */
    if (CheckLock(&avc->lock)) {
	return EBUSY;
    }

    return 0;
}