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@72102e7461
This commit is contained in:
Andriy Gapon 2013-11-20 11:06:02 +00:00
parent 12ad6bef9b
commit 491ececfb9
3 changed files with 20 additions and 1 deletions

View File

@ -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_context_t *ct)
(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.
*/

View File

@ -2756,6 +2756,9 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
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_t *bfp, int flag,
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);
}

View File

@ -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_context_t *);
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 */