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-3462 rename on NFSv4 filesystem induces panic
OS-3294 add support for inotify
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
        
*** 32,42 ****
   *      Copyright 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>
--- 32,42 ----
   *      Copyright 1983,1984,1985,1986,1987,1988,1989 AT&T.
   *      All Rights Reserved
   */
  
  /*
!  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
   */
  
  #include <sys/param.h>
  #include <sys/types.h>
  #include <sys/systm.h>
*** 3737,3748 ****
           * to setattr (e.g. basic without chmod) then we will
           * need to add a check here before calling the server.
           */
          error = nfs4setattr(vp, vap, flags, cr, NULL);
  
!         if (error == 0 && (vap->va_mask & AT_SIZE) && vap->va_size == 0)
                  vnevent_truncate(vp, ct);
  
          return (error);
  }
  
  /*
--- 3737,3753 ----
           * to setattr (e.g. basic without chmod) then we will
           * need to add a check here before calling the server.
           */
          error = nfs4setattr(vp, vap, flags, cr, NULL);
  
!         if (error == 0 && (vap->va_mask & AT_SIZE)) {
!                 if (vap->va_size == 0) {
                          vnevent_truncate(vp, ct);
+                 } else {
+                         vnevent_resize(vp, ct);
+                 }
+         }
  
          return (error);
  }
  
  /*
*** 8061,8072 ****
          /*
           * Notify the rename vnevents to source vnode, and to the target
           * vnode if it already existed.
           */
          if (error == 0) {
!                 vnode_t *tvp;
                  rnode4_t *trp;
                  /*
                   * Notify the vnode. Each links is represented by
                   * a different vnode, in nfsv4.
                   */
                  if (nvp) {
--- 8066,8078 ----
          /*
           * Notify the rename vnevents to source vnode, and to the target
           * vnode if it already existed.
           */
          if (error == 0) {
!                 vnode_t *tvp, *tovp;
                  rnode4_t *trp;
+ 
                  /*
                   * Notify the vnode. Each links is represented by
                   * a different vnode, in nfsv4.
                   */
                  if (nvp) {
*** 8075,8101 ****
                          if (IS_SHADOW(nvp, trp))
                                  tvp = RTOV4(trp);
                          vnevent_rename_dest(tvp, ndvp, nnm, ct);
                  }
  
!                 /*
!                  * if the source and destination directory are not the
!                  * same notify the destination directory.
!                  */
!                 if (VTOR4(odvp) != VTOR4(ndvp)) {
                          trp = VTOR4(ndvp);
                          tvp = ndvp;
                          if (IS_SHADOW(ndvp, trp))
                                  tvp = RTOV4(trp);
-                         vnevent_rename_dest_dir(tvp, ct);
-                 }
  
!                 trp = VTOR4(ovp);
!                 tvp = ovp;
!                 if (IS_SHADOW(ovp, trp))
!                         tvp = RTOV4(trp);
!                 vnevent_rename_src(tvp, odvp, onm, ct);
          }
  
          if (nvp) {
                  VN_RELE(nvp);
          }
--- 8081,8104 ----
                          if (IS_SHADOW(nvp, trp))
                                  tvp = RTOV4(trp);
                          vnevent_rename_dest(tvp, ndvp, nnm, ct);
                  }
  
!                 trp = VTOR4(ovp);
!                 tovp = ovp;
!                 if (IS_SHADOW(ovp, trp))
!                         tovp = RTOV4(trp);
! 
!                 vnevent_rename_src(tovp, odvp, onm, ct);
! 
                  trp = VTOR4(ndvp);
                  tvp = ndvp;
+ 
                  if (IS_SHADOW(ndvp, trp))
                          tvp = RTOV4(trp);
  
!                 vnevent_rename_dest_dir(tvp, tovp, nnm, ct);
          }
  
          if (nvp) {
                  VN_RELE(nvp);
          }
*** 11000,11011 ****
  
                          va.va_mask = AT_SIZE;
                          va.va_size = bfp->l_start;
                          error = nfs4setattr(vp, &va, 0, cr, NULL);
  
!                         if (error == 0 && bfp->l_start == 0)
                                  vnevent_truncate(vp, ct);
                  } else
                          error = EINVAL;
          }
  
          return (error);
--- 11003,11019 ----
  
                          va.va_mask = AT_SIZE;
                          va.va_size = bfp->l_start;
                          error = nfs4setattr(vp, &va, 0, cr, NULL);
  
!                         if (error == 0) {
!                                 if (bfp->l_start == 0) {
                                          vnevent_truncate(vp, ct);
+                                 } else {
+                                         vnevent_resize(vp, ct);
+                                 }
+                         }
                  } else
                          error = EINVAL;
          }
  
          return (error);