From patchwork Wed Mar 22 03:09:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 9638051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9866602CC for ; Wed, 22 Mar 2017 03:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBBD426E78 for ; Wed, 22 Mar 2017 03:09:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C09FF27CF9; Wed, 22 Mar 2017 03:09:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26F3B27816 for ; Wed, 22 Mar 2017 03:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758738AbdCVDJb (ORCPT ); Tue, 21 Mar 2017 23:09:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60826 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758645AbdCVDJa (ORCPT ); Tue, 21 Mar 2017 23:09:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 127A37EA82; Wed, 22 Mar 2017 03:09:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 127A37EA82 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eguan@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 127A37EA82 Received: from localhost (dhcp-12-149.nay.redhat.com [10.66.12.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89BC57A407; Wed, 22 Mar 2017 03:09:24 +0000 (UTC) Date: Wed, 22 Mar 2017 11:09:23 +0800 From: Eryu Guan To: Brian Foster Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v2] generic: test pagecache invalidation after direct write Message-ID: <20170322030923.GB14226@eguan.usersys.redhat.com> References: <20170321165314.11434-1-eguan@redhat.com> <20170321173509.GC59313@bfoster.bfoster> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170321173509.GC59313@bfoster.bfoster> User-Agent: Mutt/1.7.1 (2016-10-04) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Mar 2017 03:09:25 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Mar 21, 2017 at 01:35:09PM -0400, Brian Foster wrote: > On Wed, Mar 22, 2017 at 12:53:14AM +0800, Eryu Guan wrote: > > Test if direct write invalidates pagecache correctly, so that subsequent > > buffer read reads the correct data from disk. > > > > This test is inspired by LTP tests dio29, and serves as a regression > > test for the bug found by it, see kernel commit c771c14baa33 > > ("iomap: invalidate page caches should be after iomap_dio_complete() > > in direct write"). > > > > The test can be easily expanded to other write/read combinations, e.g. > > buffer write + direct read and direct write + direct read, so they are > > also being tested. > > > > Signed-off-by: Eryu Guan > > --- > > v2: Address Brian's review comments > > - compare buffer content byte-by-byte instead of strncmp > > - use 'pids[i]' not *(pids + 1) > > - dump buffer content to stdout on error > > - initialize write buffer with (i + 1) > > - use pwrite/pread instead of lseek+write/read > > - remove increment of unused 'ret' > > - call fsync(fd) instead of sync() > > - fix typos > > > > .gitignore | 1 + > > src/Makefile | 3 +- > > src/dio-invalidate-cache.c | 326 +++++++++++++++++++++++++++++++++++++++++++++ > > tests/generic/418 | 122 +++++++++++++++++ > > tests/generic/418.out | 2 + > > tests/generic/group | 1 + > > 6 files changed, 454 insertions(+), 1 deletion(-) > > create mode 100644 src/dio-invalidate-cache.c > > create mode 100755 tests/generic/418 > > create mode 100644 tests/generic/418.out > > > ... > > diff --git a/src/dio-invalidate-cache.c b/src/dio-invalidate-cache.c > > new file mode 100644 > > index 0000000..bc795f9 > > --- /dev/null > > +++ b/src/dio-invalidate-cache.c > > @@ -0,0 +1,326 @@ > ... > > +static void kill_children(pid_t *pids, int nr_child) > > +{ > > + int i; > > + pid_t pid; > > + > > + for (i = 0; i < nr_child; i++) { > > + pid = *(pids + i); > > + if (pid == 0) > > + continue; > > + kill(pid, SIGTERM); > > + } > > + return; > > Still have pids pointer arithmetic above and the return is unnecessary. > Otherwise looks Ok to me: I applied this change and queued for next update. > > Reviewed-by: Brian Foster Thanks for the review! Eryu --- 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/src/dio-invalidate-cache.c b/src/dio-invalidate-cache.c index bc795f9..4c40c87 100644 --- a/src/dio-invalidate-cache.c +++ b/src/dio-invalidate-cache.c @@ -73,12 +73,11 @@ static void kill_children(pid_t *pids, int nr_child) pid_t pid; for (i = 0; i < nr_child; i++) { - pid = *(pids + i); + pid = pids[i]; if (pid == 0) continue; kill(pid, SIGTERM); } - return; } static int wait_children(pid_t *pids, int nr_child)