Re: [PATCH] fs: Add a new flag RWF_IOWAIT for preadv2(2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux