Print this page
3484 enhance and document tail follow support
Reviewed by: Joshua M. Clulow <jmc@joyent.com>

@@ -26,10 +26,14 @@
 /*
  *      Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
  *      All rights reserved.
  */
 
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/systm.h>
 #include <sys/cred.h>
 #include <sys/time.h>

@@ -2296,24 +2300,27 @@
                                         }
                                         if (!error) {
                                                 vattr.va_mask = AT_SIZE;
                                                 error = nfs3setattr(vp,
                                                     &vattr, 0, cr);
+
+                                                /*
+                                                 * Existing file was truncated;
+                                                 * emit a create event.
+                                                 */
+                                                vnevent_create(vp, ct);
                                         }
                                 }
                         }
                 }
                 nfs_rw_exit(&drp->r_rwlock);
                 if (error) {
                         VN_RELE(vp);
                 } else {
-                        /*
-                         * existing file got truncated, notify.
-                         */
-                        vnevent_create(vp, ct);
                         *vpp = vp;
                 }
+
                 return (error);
         }
 
         dnlc_remove(dvp, nm);