Print this page
3484 enhance and document tail follow support
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
@@ -22,10 +22,14 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/t_lock.h>
#include <sys/systm.h>
#include <sys/sysmacros.h>
@@ -976,10 +980,12 @@
} else {
error = tdirlookup(parent, nm, &oldtp, cred);
}
if (error == 0) { /* name found */
+ boolean_t trunc = B_FALSE;
+
ASSERT(oldtp);
rw_enter(&oldtp->tn_rwlock, RW_WRITER);
/*
@@ -1003,10 +1009,11 @@
if ((*vpp)->v_type == VREG && (vap->va_mask & AT_SIZE) &&
vap->va_size == 0) {
rw_enter(&oldtp->tn_contents, RW_WRITER);
(void) tmpnode_trunc(tm, oldtp, 0);
rw_exit(&oldtp->tn_contents);
+ trunc = B_TRUE;
}
rw_exit(&oldtp->tn_rwlock);
if (IS_DEVVP(*vpp)) {
struct vnode *newvp;
@@ -1017,13 +1024,13 @@
return (ENOSYS);
}
*vpp = newvp;
}
- if (error == 0) {
+ if (trunc)
vnevent_create(*vpp, ct);
- }
+
return (0);
}
if (error != ENOENT)
return (error);