Re: [btrfs] WARNING: CPU: 0 PID: 6379 at fs/direct-io.c:293 dio_complete+0x1d4/0x220

From: Linus Torvalds
Date: Mon Nov 13 2017 - 17:01:46 EST


On Mon, Nov 13, 2017 at 1:56 PM, Darrick J. Wong
<darrick.wong@xxxxxxxxxx> wrote:
> Wellll... the WARN_ON in question happens when:
>
> a) two programs race to write to the same part of a file, one via the page
> cache and the other via directio
> b) the dio write completes, tries to invalidate the page cache, and fails
> because the corresponding page cannot be invalidated
>
> At this point, the page cache contents don't reflect what's on disk, so
> I don't think we can quietly ignore the situation.

Direct-IO causing cache coherency issues? Really? I'm shocked and
surptised that that could _possibly_ happen.

But why the hell would you want a back-trace for it?

IOW, if you want to warn about it, use "pr_warn_ratelimited()" or
something. What did the backtrace and "looks like a kernel oops"
really help with?

And in the end, maybe even the warning is pointless. You used
direct-IO and cached IO at the same time, and you got coherency
issues. What did you expect? directio is fundamentally broken.

Linus