Re: tail -f is broken in recent CURRENT ( afd5bc630930 Sunday Jul 6 )
- In reply to: Konstantin Belousov : "Re: tail -f is broken in recent CURRENT ( afd5bc630930 Sunday Jul 6 )"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Jul 2025 13:42:02 UTC
On Mon, Jul 07, 2025 at 03:51:00PM +0300, Konstantin Belousov wrote:
> On Mon, Jul 07, 2025 at 03:36:12PM +0300, Oleg Nauman wrote:
> >  I noticed that
> > tail -f /var/log/messages never receive updates if running with recent
> > CURRENT ( afd5bc630930 Sunday Jul 6 )
> > 
> > 60092: read(3,"talled\nJul  6 16:59:54 mysystem pkg-static[86368]:
> > gstreamer1-plugins-mpg123-1.26.2 deinstalled\nJul  6 16:59:57 mysytem
> > pkg"...,32768) = 2666 (0xa6a)
> > 60092: munmap(0x801403000,297578)                = 0 (0x0)
> > 60092: read(3,0x80182c600,32768)                 = 0 (0x0)
> > 60092: kqueue()                                  = 5 (0x5)
> > 60092: fstatfs(3,{
> > fstypename=ufs,mntonname=/,mntfromname=/dev/gpt/FreeBSD-UFS,fsid=133a996124e0f956
> > }) = 0 (0x0)
> > 60092: kevent(5,{ 3,EVFILT_READ,EV_ADD|EV_ENABLE|EV_CLEAR,0,0,0x0
> > },1,0x0,0,{ 0.000000000 }) = 0 (0x0)
> > 60092: kevent(5,0x0,0,0x801814000,1,0x0)         ERR#4 'Interrupted
> > system call' <--- killed at this point by me
> > 60095: select(7,{ 6 },0x0,0x0,0x0)               ERR#4 'Interrupted system call'
> > 60092: SIGNAL 2 (SIGINT) code=SI_KERNEL
> > 60095: SIGNAL 2 (SIGINT) code=SI_KERNEL
> > 60095: process killed, signal = 2
> > 60092: process killed, signal = 2
> > 
> >  Likely something is wrong with kqueue and/or kevent
> 
> Try this
I tested this patch and can confirm that it fixes tail -f.  Thank you.
> diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
> index 3ed469bdce6d..2c6947103c94 100644
> --- a/sys/sys/vnode.h
> +++ b/sys/sys/vnode.h
> @@ -1032,7 +1032,7 @@ void	vop_rename_fail(struct vop_rename_args *ap);
>  #define VOP_WRITE_POST(ap, ret)						\
>  	noffset = (ap)->a_uio->uio_offset;				\
>  	if (noffset > ooffset) {					\
> -		if (VN_KNLIST_EMPTY((ap)->a_vp)) {			\
> +		if (!VN_KNLIST_EMPTY((ap)->a_vp)) {			\
>  			VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE |	\
>  			    (noffset > osize ? NOTE_EXTEND : 0));	\
>  		}							\
>