On Tue, Aug 6, 2024 at 11:08 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Sun, Aug 04, 2024 at 04:02:51PM +0800, Yafang Shao wrote: > > One solution we're currently exploring is leveraging the preadv2(2) > > syscall. By using the RWF_NOWAIT flag, preadv2(2) can avoid the XFS inode > > lock hung task. This can be illustrated as follows: > > > > retry: > > if (preadv2(fd, iovec, cnt, offset, RWF_NOWAIT) < 0) { > > sleep(n) > > goto retry; > > But that's not how you're supposed to use RWF_NOWAIT! You're supposed > to try it _once_ in the thread that can't block, then hand the I/O off > to another thread which _can_ block. Because that single thread is the > one which does all the blocking I/O, there's no lock contention. > > So this is a kernel workaround for bad application design, and should > be rejected. They are different applications, but not different threads within a single application. A simple example: $ ps -eLo pid,comm 1 systemd 2 tail -f /var/log/messages. In this case, tail is reading /var/log/messages while systemd is writing to it. Are you suggesting we should forbid `tail -f` on Linux servers? If you had taken the time to understand what filebeat is doing, you wouldn't have reached this arbitrary conclusion. -- Regards Yafang