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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs_vnops.c
          +++ new/usr/src/uts/common/fs/nfs/nfs_vnops.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   *
  24   24   *      Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
  25   25   *      All rights reserved.
  26   26   */
  27   27  
       28 +/*
       29 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
       30 + */
       31 +
  28   32  #include <sys/param.h>
  29   33  #include <sys/types.h>
  30   34  #include <sys/systm.h>
  31   35  #include <sys/cred.h>
  32   36  #include <sys/time.h>
  33   37  #include <sys/vnode.h>
  34   38  #include <sys/vfs.h>
  35   39  #include <sys/vfs_opreg.h>
  36   40  #include <sys/file.h>
  37   41  #include <sys/filio.h>
↓ open down ↓ 1985 lines elided ↑ open up ↑
2023 2027                          if (IS_DEVVP(vp)) {
2024 2028                                  tempvp = vp;
2025 2029                                  vp = specvp(vp, vp->v_rdev, vp->v_type, cr);
2026 2030                                  VN_RELE(tempvp);
2027 2031                          }
2028 2032                          if (!(error = VOP_ACCESS(vp, mode, 0, cr, ct))) {
2029 2033                                  if ((vattr.va_mask & AT_SIZE) &&
2030 2034                                      vp->v_type == VREG) {
2031 2035                                          vattr.va_mask = AT_SIZE;
2032 2036                                          error = nfssetattr(vp, &vattr, 0, cr);
     2037 +
     2038 +                                        if (!error) {
     2039 +                                                /*
     2040 +                                                 * Existing file was truncated;
     2041 +                                                 * emit a create event.
     2042 +                                                 */
     2043 +                                                vnevent_create(vp, ct);
     2044 +                                        }
2033 2045                                  }
2034 2046                          }
2035 2047                  }
2036 2048                  nfs_rw_exit(&drp->r_rwlock);
2037 2049                  if (error) {
2038 2050                          VN_RELE(vp);
2039 2051                  } else {
2040      -                        /*
2041      -                         * existing file got truncated, notify.
2042      -                         */
2043      -                        vnevent_create(vp, ct);
2044 2052                          *vpp = vp;
2045 2053                  }
2046 2054                  return (error);
2047 2055          }
2048 2056  
2049 2057          ASSERT(vattr.va_mask & AT_TYPE);
2050 2058          if (vattr.va_type == VREG) {
2051 2059                  ASSERT(vattr.va_mask & AT_MODE);
2052 2060                  if (MANDMODE(vattr.va_mode)) {
2053 2061                          nfs_rw_exit(&drp->r_rwlock);
↓ open down ↓ 3031 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX