Re: iov_iter_pipe warning.

From: Dave Jones
Date: Mon Apr 10 2017 - 19:48:52 EST


On Mon, Apr 10, 2017 at 08:57:11PM +0100, Al Viro wrote:
> On Mon, Apr 10, 2017 at 03:42:06PM -0400, Dave Jones wrote:
> > > Do you have a reliable reproducer?
> >
> > Not reliable, but I'll see if I can find some time to narrow it down
> > this week. I've been working on better logging of "wtf just happened"
> > the last few weeks, so it should get easier once I finish that work.
>
> I would suggest
> a) slapping WARN_ON(pipe->nr_bufs); right before the loop
> in splice_direct_to_actor(). Internal pipe should be empty when we
> enter this function.
> b) the same WARN_ON() in the very end of the loop body.
>
> We should have started with empty pipe. We'd called ->splice_read()
> and it had returned a positive number (in read_len). That should be
> the amount we'd pushed in there. Then we call actor(), with
> sd->total_len set to read_len. Its return value is
> * positive (or we would've buggered off)
> * no less than read_len (ditto)
> so it should have drained the pipe entirely, leaving it empty again.
>
> Finding it not just non-empty, but full means that something's very
> wrong. The actor here is essentially ->splice_write(), and I'm really
> curious which file is the target. Actually, could you turn those
> WARN_ON() into
> if (WARN_ON(pipe->nr_bufs))
> printk(KERN_ERR "->splice_write = %p",
> sd->u.file->f_op->splice_write);
> and see which function it is?

s/nr_bufs/nrbufs/ aside, I tried this, and it didn't trigger, even
though I hit the iov_iter_pipe WARN again.

Dave