Print this page
OS-5148 ftruncate at offset should emit proper events
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-5291 lxbrand inotify02 LTP regression
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
OS-3294 add support for inotify
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>

@@ -23,11 +23,11 @@
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*
- * Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ * Copyright 2016, Joyent, Inc.
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2016 RackTop Systems.
  */
 
 #include <sys/types.h>

@@ -785,12 +785,17 @@
                 rw_enter(&tp->tn_contents, RW_WRITER);
                 error = tmpnode_trunc(tm, tp, (ulong_t)vap->va_size);
                 rw_exit(&tp->tn_contents);
                 rw_exit(&tp->tn_rwlock);
 
-                if (error == 0 && vap->va_size == 0)
+                if (error == 0) {
+                        if (vap->va_size == 0) {
                         vnevent_truncate(vp, ct);
+                        } else {
+                                vnevent_resize(vp, ct);
+                        }
+                }
 
                 goto out1;
         }
 out:
         mutex_exit(&tp->tn_tlock);

@@ -1302,14 +1307,12 @@
 
         if (error == 0) {
                 vnevent_rename_src(TNTOV(fromtp), odvp, onm, ct);
                 /*
                  * vnevent_rename_dest is called in tdirenter().
-                 * Notify the target dir if not same as source dir.
                  */
-                if (ndvp != odvp)
-                        vnevent_rename_dest_dir(ndvp, ct);
+                vnevent_rename_dest_dir(ndvp, TNTOV(fromtp), nnm, ct);
         }
 
 done:
         tmpnode_rele(fromtp);
         mutex_exit(&tm->tm_renamelck);

@@ -2342,13 +2345,18 @@
         if ((error = convoff(vp, bfp, 0, (offset_t)offset)) == 0) {
                 if ((bfp->l_start > MAXOFF_T) || (bfp->l_len > MAXOFF_T))
                         return (EFBIG);
                 error = tmp_freesp(vp, bfp, flag);
 
-                if (error == 0 && bfp->l_start == 0)
+                if (error == 0) {
+                        if (bfp->l_start == 0) {
                         vnevent_truncate(vp, ct);
+                        } else {
+                                vnevent_resize(vp, ct);
         }
+                }
+        }
         return (error);
 }
 
 /* ARGSUSED */
 static int