From patchwork Tue Oct 4 20:12:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 9485665 X-Mozilla-Keys: nonjunk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sandeen.net X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.0 X-Spam-HP: BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5,RP_MATCHES_RCVD=-0.1 X-Original-To: sandeen@sandeen.net Delivered-To: sandeen@sandeen.net Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by sandeen.net (Postfix) with ESMTP id 262A859ED9 for ; Tue, 4 Oct 2016 15:12:01 -0500 (CDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527AbcJDUMh (ORCPT ); Tue, 4 Oct 2016 16:12:37 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:55504 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbcJDUMg (ORCPT ); Tue, 4 Oct 2016 16:12:36 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.86_2 #1 (Red Hat Linux)) id 1brW4n-0003Kd-2l; Tue, 04 Oct 2016 20:12:33 +0000 Date: Tue, 4 Oct 2016 21:12:33 +0100 From: Al Viro To: CAI Qian Cc: Linus Torvalds , Dave Chinner , linux-xfs , Jens Axboe , Nick Piggin , linux-fsdevel@vger.kernel.org Subject: Re: [RFC][CFT] splice_read reworked Message-ID: <20161004201232.GA19539@ZenIV.linux.org.uk> References: <1415238593.811146.1475257337058.JavaMail.zimbra@redhat.com> <20161003014218.GS19539@ZenIV.linux.org.uk> <19064316.41568.1475503587628.JavaMail.zimbra@redhat.com> <37510012.118174.1475526739119.JavaMail.zimbra@redhat.com> <20161003203539.GW19539@ZenIV.linux.org.uk> <1209071853.342152.1475587775353.JavaMail.zimbra@redhat.com> <20161004142805.GX19539@ZenIV.linux.org.uk> <307867218.381779.1475598088901.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <307867218.381779.1475598088901.JavaMail.zimbra@redhat.com> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue, Oct 04, 2016 at 12:21:28PM -0400, CAI Qian wrote: > > > Not enough information, unfortunately (descriptor in question opened > > outside of that log, sendfile(out_fd=578, in_fd=578, offset=0x7f8318a07000, > > count=0x3ffc00) doesn't tell what *offset was before the call) ;-/ > > > > Anyway, I've found and fixed a bug in pipe_advance(), which might or might > > not help with those. Could you try vfs.git#work.splice_read (or #for-next) > > and see if these persist? > I am afraid that this can also reproduced in the latest #for-next . The warning > always showed up at the end of trinity run. I captured more information this time. OK, let's try to get more information about what's going on (this is on top of either for-next or work.splice_read): --- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/iov_iter.c b/lib/iov_iter.c index c97d661..a9cb9ff 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -313,6 +313,15 @@ static bool sanity(const struct iov_iter *i) } return true; Bad: + printk(KERN_ERR "idx = %d, offset = %zd\n", i->idx, i->iov_offset); + printk(KERN_ERR "curbuf = %d, nrbufs = %d, buffers = %d\n", + pipe->curbuf, pipe->nrbufs, pipe->buffers); + for (idx = 0; idx < pipe->buffers; idx++) + printk(KERN_ERR "[%p %p %d %d]\n", + pipe->bufs[idx].ops, + pipe->bufs[idx].page, + pipe->bufs[idx].offset, + pipe->bufs[idx].len); WARN_ON(1); return false; } @@ -339,8 +348,11 @@ static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t by if (unlikely(!bytes)) return 0; - if (!sanity(i)) + if (!sanity(i)) { + printk(KERN_ERR "page = %p, offset = %zd, size = %zd\n", + page, offset, bytes); return 0; + } off = i->iov_offset; idx = i->idx; @@ -518,6 +530,8 @@ static size_t copy_pipe_to_iter(const void *addr, size_t bytes, addr += chunk; } i->count -= bytes; + if (!sanity(i)) + printk(KERN_ERR "buggered after copy_to_iter\n"); return bytes; } @@ -629,6 +643,8 @@ static size_t pipe_zero(size_t bytes, struct iov_iter *i) n -= chunk; } i->count -= bytes; + if (!sanity(i)) + printk(KERN_ERR "buggered after zero_iter\n"); return bytes; } @@ -673,6 +689,8 @@ static void pipe_advance(struct iov_iter *i, size_t size) struct pipe_buffer *buf; int idx = i->idx; size_t off = i->iov_offset; + struct iov_iter orig = *i; + size_t orig_size = size; if (unlikely(i->count < size)) size = i->count; @@ -702,6 +720,9 @@ static void pipe_advance(struct iov_iter *i, size_t size) pipe->nrbufs--; } } + if (!sanity(i)) + printk(KERN_ERR "buggered pipe_advance by %zd from [%d.%zd]", + orig_size, orig.idx, orig.iov_offset); } void iov_iter_advance(struct iov_iter *i, size_t size)