Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jul 2025 09:42:02 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Oleg Nauman <oleg.nauman@gmail.com>, FreeBSD Current <freebsd-current@freebsd.org>, David Wolfskill <david@catwhisker.org>
Subject:   Re: tail -f is broken in recent CURRENT ( afd5bc630930 Sunday Jul 6 )
Message-ID:  <aGvOqng_1m1SVCIX@nuc>
In-Reply-To: <aGvCtLTuDPj5CnJ_@kib.kiev.ua>
References:  <CAC5YPTv%2BRPEj2uuVarJ0NW4VRn%2BwRBxu4AS=hJDftR=paveJ%2BQ@mail.gmail.com> <aGvCtLTuDPj5CnJ_@kib.kiev.ua>

index | next in thread | previous in thread | raw e-mail

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));	\
>  		}							\
> 


help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aGvOqng_1m1SVCIX>