Date: Wed, 20 Nov 2013 11:06:02 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r258383 - in vendor-sys/illumos/dist/uts/common: fs fs/zfs sys Message-ID: <201311201106.rAKB627j060368@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Wed Nov 20 11:06:02 2013 New Revision: 258383 URL: http://svnweb.freebsd.org/changeset/base/258383 Log: 3928 `tail -f ...` doesn't notice file truncation 3929 `man tail` doesn't mentioned "-F" option 3930 'tail -F ...' not resetting the offset of file rotation properly 3968 want FILE_TRUNC event for PORT_SOURCE_FILE illumos/illumos-gate@72102e7461c97dc268d21d9dd8f02da45f174acd Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/sys/vnode.h Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/vnode.c Wed Nov 20 11:05:07 2013 (r258382) +++ vendor-sys/illumos/dist/uts/common/fs/vnode.c Wed Nov 20 11:06:02 2013 (r258383) @@ -21,6 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -2582,6 +2583,15 @@ vnevent_mountedover(vnode_t *vp, caller_ (void) VOP_VNEVENT(vp, VE_MOUNTEDOVER, NULL, NULL, ct); } +void +vnevent_truncate(vnode_t *vp, caller_context_t *ct) +{ + if (vp == NULL || vp->v_femhead == NULL) { + return; + } + (void) VOP_VNEVENT(vp, VE_TRUNCATE, NULL, NULL, ct); +} + /* * Vnode accessors. */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Nov 20 11:05:07 2013 (r258382) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Nov 20 11:06:02 2013 (r258383) @@ -2756,6 +2756,9 @@ top: ZFS_EXIT(zfsvfs); return (err); } + + if (vap->va_size == 0) + vnevent_truncate(ZTOV(zp), ct); } if (mask & (AT_ATIME|AT_MTIME) || @@ -4770,6 +4773,9 @@ zfs_space(vnode_t *vp, int cmd, flock64_ error = zfs_freesp(zp, off, len, flag, TRUE); + if (error == 0 && off == 0 && len == 0) + vnevent_truncate(ZTOV(zp), ct); + ZFS_EXIT(zfsvfs); return (error); } Modified: vendor-sys/illumos/dist/uts/common/sys/vnode.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/vnode.h Wed Nov 20 11:05:07 2013 (r258382) +++ vendor-sys/illumos/dist/uts/common/sys/vnode.h Wed Nov 20 11:06:02 2013 (r258383) @@ -21,6 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -733,7 +734,8 @@ typedef enum vnevent { VE_CREATE = 5, /* Create with vnode's name which exists */ VE_LINK = 6, /* Link with vnode's name as source */ VE_RENAME_DEST_DIR = 7, /* Rename with vnode as target dir */ - VE_MOUNTEDOVER = 8 /* File or Filesystem got mounted over vnode */ + VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */ + VE_TRUNCATE = 9 /* Truncate */ } vnevent_t; /* @@ -1290,6 +1292,7 @@ void vnevent_create(vnode_t *, caller_co void vnevent_link(vnode_t *, caller_context_t *); void vnevent_rename_dest_dir(vnode_t *, caller_context_t *ct); void vnevent_mountedover(vnode_t *, caller_context_t *); +void vnevent_truncate(vnode_t *, caller_context_t *); int vnevent_support(vnode_t *, caller_context_t *); /* Vnode specific data */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311201106.rAKB627j060368>