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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
          +++ new/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28      - * Copyright (c) 2015, Joyent, Inc. All rights reserved.
       28 + * Copyright 2016, Joyent, Inc.
  29   29   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  30   30   * Copyright 2016 RackTop Systems.
  31   31   */
  32   32  
  33   33  #include <sys/types.h>
  34   34  #include <sys/param.h>
  35   35  #include <sys/t_lock.h>
  36   36  #include <sys/systm.h>
  37   37  #include <sys/sysmacros.h>
  38   38  #include <sys/user.h>
↓ open down ↓ 741 lines elided ↑ open up ↑
 780  780                          goto out;
 781  781                  }
 782  782                  mutex_exit(&tp->tn_tlock);
 783  783  
 784  784                  rw_enter(&tp->tn_rwlock, RW_WRITER);
 785  785                  rw_enter(&tp->tn_contents, RW_WRITER);
 786  786                  error = tmpnode_trunc(tm, tp, (ulong_t)vap->va_size);
 787  787                  rw_exit(&tp->tn_contents);
 788  788                  rw_exit(&tp->tn_rwlock);
 789  789  
 790      -                if (error == 0 && vap->va_size == 0)
 791      -                        vnevent_truncate(vp, ct);
      790 +                if (error == 0) {
      791 +                        if (vap->va_size == 0) {
      792 +                                vnevent_truncate(vp, ct);
      793 +                        } else {
      794 +                                vnevent_resize(vp, ct);
      795 +                        }
      796 +                }
 792  797  
 793  798                  goto out1;
 794  799          }
 795  800  out:
 796  801          mutex_exit(&tp->tn_tlock);
 797  802  out1:
 798  803          return (error);
 799  804  }
 800  805  
 801  806  /* ARGSUSED2 */
↓ open down ↓ 495 lines elided ↑ open up ↑
1297 1302          if (error == ENOENT)
1298 1303                  error = 0;
1299 1304  
1300 1305          rw_exit(&fromtp->tn_rwlock);
1301 1306          rw_exit(&fromparent->tn_rwlock);
1302 1307  
1303 1308          if (error == 0) {
1304 1309                  vnevent_rename_src(TNTOV(fromtp), odvp, onm, ct);
1305 1310                  /*
1306 1311                   * vnevent_rename_dest is called in tdirenter().
1307      -                 * Notify the target dir if not same as source dir.
1308 1312                   */
1309      -                if (ndvp != odvp)
1310      -                        vnevent_rename_dest_dir(ndvp, ct);
     1313 +                vnevent_rename_dest_dir(ndvp, TNTOV(fromtp), nnm, ct);
1311 1314          }
1312 1315  
1313 1316  done:
1314 1317          tmpnode_rele(fromtp);
1315 1318          mutex_exit(&tm->tm_renamelck);
1316 1319  
1317 1320          TRACE_5(TR_FAC_TMPFS, TR_TMPFS_RENAME,
1318 1321              "tmpfs rename:ovp %p onm %s nvp %p nnm %s error %d", odvp, onm,
1319 1322              ndvp, nnm, error);
1320 1323          return (error);
↓ open down ↓ 1016 lines elided ↑ open up ↑
2337 2340  {
2338 2341          int error;
2339 2342  
2340 2343          if (cmd != F_FREESP)
2341 2344                  return (EINVAL);
2342 2345          if ((error = convoff(vp, bfp, 0, (offset_t)offset)) == 0) {
2343 2346                  if ((bfp->l_start > MAXOFF_T) || (bfp->l_len > MAXOFF_T))
2344 2347                          return (EFBIG);
2345 2348                  error = tmp_freesp(vp, bfp, flag);
2346 2349  
2347      -                if (error == 0 && bfp->l_start == 0)
2348      -                        vnevent_truncate(vp, ct);
     2350 +                if (error == 0) {
     2351 +                        if (bfp->l_start == 0) {
     2352 +                                vnevent_truncate(vp, ct);
     2353 +                        } else {
     2354 +                                vnevent_resize(vp, ct);
     2355 +                        }
     2356 +                }
2349 2357          }
2350 2358          return (error);
2351 2359  }
2352 2360  
2353 2361  /* ARGSUSED */
2354 2362  static int
2355 2363  tmp_seek(
2356 2364          struct vnode *vp,
2357 2365          offset_t ooff,
2358 2366          offset_t *noffp,
↓ open down ↓ 113 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX