From patchwork Thu Mar 19 11:46:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 6048551 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 54A2C9F399 for ; Thu, 19 Mar 2015 11:46:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 687252051A for ; Thu, 19 Mar 2015 11:46:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E9A520531 for ; Thu, 19 Mar 2015 11:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbbCSLqp (ORCPT ); Thu, 19 Mar 2015 07:46:45 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:35637 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752021AbbCSLqo (ORCPT ); Thu, 19 Mar 2015 07:46:44 -0400 Received: by webcq43 with SMTP id cq43so55051704web.2 for ; Thu, 19 Mar 2015 04:46:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=o6eIzwIPPfF7fT/Bev/D2jyo0QSuXjpksi0MQ6I84ps=; b=Ed6L29jE3u0Gbd0idz9xJfHPInKVscwnOMqu+A9ZDd4FLL79u/YgkeniWVkNavF4Yu YlLQ8+UPEtuTTpmgrvxWGlmx3f+KHH0pGXjPFIXOb7Ua5aT8M+8cXN5hv6RkRheYJsi6 ByMOZE67sk5L9hiltFb9hY+Ip8dZ+xsKtigS3lfbW5wtzdxXHfdp5BeIti3hxjuJ2jLn NezLVjlmKhTty1Xv5n66UKIzd1wWbHeC1HLoWPBMPBEV7cFh+S2nd9BtffN1ukxGny1c RJMzF3U/VwUMlyXtZfsgD42Pu9Dh1kPKcluFijOxNwoRHfk8r/bdEGgxh0A7ew+6c4mI IgKw== X-Gm-Message-State: ALoCoQmkmOFO8D5lbM6ZwzONfg84TZeq5goazxVGvuK5jo++UQLRVXhI873N/aAxE8BtToHcN7H0 X-Received: by 10.180.74.135 with SMTP id t7mr15740910wiv.72.1426765603193; Thu, 19 Mar 2015 04:46:43 -0700 (PDT) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id v8sm2123613wib.0.2015.03.19.04.46.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 04:46:42 -0700 (PDT) Message-ID: <550AB720.3090009@plexistor.com> Date: Thu, 19 Mar 2015 13:46:40 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Eryu Guan , Boaz Harrosh , Dave Chinner CC: Matthew Wilcox , linux-fsdevel , fstests@vger.kernel.org Subject: [PATCH v3] xfstest: generic/080 test that mmap-write updates c/mtime References: <54F733BD.7060807@plexistor.com> <54F734C4.7080409@plexistor.com> <20150305001312.GA4251@dastard> <550A9C84.4090807@plexistor.com> <20150319104409.GO4810@dhcp-13-216.nay.redhat.com> In-Reply-To: <20150319104409.GO4810@dhcp-13-216.nay.redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Chinner when using mmap() for file i/o, writing to the file should update it's c/mtime. Specifically if we first mmap-read from a page, then memap-write to the same page. This test was failing for the initial submission of DAX because pfn based mapping do not have an page_mkwrite called for them. The new Kernel patches that introduce pfn_mkwrite fixes this test. Written by Dave Chinner but edited and tested by: Omer Zilberberg Dave hands-up man, it looks like you edited this directly in the email, but there was not even a single typo. Tested-by: Omer Zilberberg Tested-by: Boaz Harrosh Signed-off-by: Omer Zilberberg Signed-off-by: Boaz Harrosh Need-Reviewed-by: Eryu Guan Reviewed-by: Eryu Guan --- tests/generic/080 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/080.out | 2 ++ tests/generic/group | 1 + 3 files changed, 80 insertions(+) create mode 100755 tests/generic/080 create mode 100644 tests/generic/080.out diff --git a/tests/generic/080 b/tests/generic/080 new file mode 100755 index 0000000..bb9d552 --- /dev/null +++ b/tests/generic/080 @@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test No. 080 +# +# Verify that mtime is updated when writing to mmap-ed pages +# +#----------------------------------------------------------------------- +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=0 +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* + rm -f $testfile +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs generic +_supported_os IRIX Linux +_require_test + +echo "Silence is golden." +rm -f $seqres.full + +# pattern the file. +testfile=$TEST_DIR/mmap_mtime_testfile +$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $testfile >> $seqres.full + +# sample timestamps. +mtime1=`stat -c %Y $testfile` +ctime1=`stat -c %Z $testfile` +echo "before mwrite: $mtime1 $ctime1" >> $seqres.full + +# map read followed by map write to trigger timestamp change +sleep 2 +$XFS_IO_PROG -c "mmap 0 4k" -c "mread 0 4k" -c "mwrite 0 4k" $testfile >> $seqres.full + +# sample and verify that timestamps have changed. +mtime2=`stat -c %Y $testfile` +ctime2=`stat -c %Z $testfile` +echo "after mwrite : $mtime2 $ctime2" >> $seqres.full + +if [ "$mtime1" == "$mtime2" ]; then + echo "mtime not updated" + let status=$status+1 +fi +if [ "$ctime1" == "$ctime2" ]; then + echo "ctime not updated" + let status=$status+1 +fi + +exit diff --git a/tests/generic/080.out b/tests/generic/080.out new file mode 100644 index 0000000..cccac52 --- /dev/null +++ b/tests/generic/080.out @@ -0,0 +1,2 @@ +QA output created by 080 +Silence is golden. diff --git a/tests/generic/group b/tests/generic/group index d56d3ce..8154401 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -79,6 +79,7 @@ 077 acl attr auto enospc 078 auto quick metadata 079 acl attr ioctl metadata auto quick +080 auto quick 083 rw auto enospc stress 088 perms auto quick 089 metadata auto