Messages in this thread | | | From | Linus Torvalds <> | Date | Thu, 1 Jul 2021 17:30:28 -0700 | Subject | Re: [PATCH] gfs2: Fix mmap + page fault deadlocks |
| |
On Thu, Jul 1, 2021 at 5:20 PM Andreas Gruenbacher <agruenba@redhat.com> wrote: > > On Thu, Jul 1, 2021 at 11:41 PM Linus Torvalds > <torvalds@linux-foundation.org> wrote: > > Also, I have to say that I think the direct-IO code is fundamentally > > mis-designed. Why it is doing the page lookup _during_ the IO is a > > complete mystery to me. Why wasn't that done ahead of time before the > > filesystem took the locks it needed? > > That would be inconvenient for reads, when the number of bytes read is > much smaller than the buffer size and we won't need to page in the > entire buffer.
What?
A file read will READ THE WHOLE BUFFER.
We're not talking pipes or ttys here. If you ask for X bytes, you'll get X bytes.
Of course, if you ask for more data than the file has, that's another thing, but who really does that with direct-IO? And if they do, why should we care about their silly behavior?
Face it, right now direct-IO is *BUGGY* because of this, and you can deadlock filesystems with it.
So tell me again how it's "inconvenient" to fix this bug, and fix the bad direct-IO design?
Linus
| |