From: Mikulas Patocka <mpatocka@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Jan Kara <jack@suse.cz>, Dave Chinner <dchinner@redhat.com>,
Jann Horn <jannh@google.com>, Christoph Hellwig <hch@lst.de>,
Oleg Nesterov <oleg@redhat.com>,
Kirill Shutemov <kirill@shutemov.name>,
Theodore Ts'o <tytso@mit.edu>,
Andrea Arcangeli <aarcange@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org, Eric Sandeen <sandeen@redhat.com>
Subject: Re: [PATCH 2/2] xfs: don't update mtime on COW faults
Date: Fri, 11 Sep 2020 12:41:26 -0400 (EDT) [thread overview]
Message-ID: <alpine.LRH.2.02.2009111232210.29958@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20200910060626.GA7964@magnolia>
On Wed, 9 Sep 2020, Darrick J. Wong wrote:
> On Sat, Sep 05, 2020 at 01:02:33PM -0400, Mikulas Patocka wrote:
> > > >
> >
> > I've written this program that tests it - you can integrate it into your
> > testsuite.
>
> I don't get it. You're a filesystem maintainer too, which means you're
> a regular contributor. Do you:
>
> (a) not use fstests? If you don't, I really hope you use something else
> to QA hpfs.
I don't use xfstests on HPFS. I was testing it just by using it. Now I use
it just a little, but I don't modify it much.
> (b) really think that it's my problem to integrate and submit your
> regression tests for you?
>
> and (c) what do you want me to do with a piece of code that has no
> signoff tag, no copyright, and no license? This is your patch, and
> therefore your responsibility to develop enough of an appropriate
> regression test in a proper form that the rest of us can easily
> determine we have the rights to contribute to it.
If you want a full patch (I copied the script from test 313), I send it
here.
Mikulas
From: Mikulas Patocka <mpatocka@redhat.com>
Subject: [PATCH] check ctime and mtime vs mmap
Check ctime and mtime are not updated on COW faults
and that they are updated on shared faults
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
src/Makefile | 3 +-
src/mmap-timestamp.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/609 | 40 +++++++++++++++++++++++++++++++++++++
tests/generic/609.out | 2 +
tests/generic/group | 1
5 files changed, 98 insertions(+), 1 deletion(-)
Index: xfstests-dev/src/Makefile
===================================================================
--- xfstests-dev.orig/src/Makefile 2020-09-06 12:38:40.000000000 +0200
+++ xfstests-dev/src/Makefile 2020-09-11 17:39:04.000000000 +0200
@@ -17,7 +17,8 @@ TARGETS = dirstress fill fill2 getpagesi
t_mmap_cow_race t_mmap_fallocate fsync-err t_mmap_write_ro \
t_ext4_dax_journal_corruption t_ext4_dax_inline_corruption \
t_ofd_locks t_mmap_collision mmap-write-concurrent \
- t_get_file_time t_create_short_dirs t_create_long_dirs
+ t_get_file_time t_create_short_dirs t_create_long_dirs \
+ mmap-timestamp
LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
Index: xfstests-dev/src/mmap-timestamp.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xfstests-dev/src/mmap-timestamp.c 2020-09-11 18:21:40.000000000 +0200
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2020 Red Hat, Inc. All Rights reserved.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#define FILE_NAME argv[1]
+
+static struct stat st1, st2;
+
+int main(int argc, char *argv[])
+{
+ int h, r;
+ char *map;
+ unlink(FILE_NAME);
+ h = creat(FILE_NAME, 0600);
+ if (h == -1) perror("creat"), exit(1);
+ r = write(h, "x", 1);
+ if (r != 1) perror("write"), exit(1);
+ if (close(h)) perror("close"), exit(1);
+ h = open(FILE_NAME, O_RDWR);
+ if (h == -1) perror("open"), exit(1);
+
+ map = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, h, 0);
+ if (map == MAP_FAILED) perror("mmap"), exit(1);
+ if (fstat(h, &st1)) perror("fstat"), exit(1);
+ sleep(2);
+ *map = 'y';
+ if (fstat(h, &st2)) perror("fstat"), exit(1);
+ if (st1.st_mtime != st2.st_mtime) fprintf(stderr, "BUG: COW fault changed mtime!\n"), exit(1);
+ if (st1.st_ctime != st2.st_ctime) fprintf(stderr, "BUG: COW fault changed ctime!\n"), exit(1);
+ if (munmap(map, 4096)) perror("munmap"), exit(1);
+
+ map = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, h, 0);
+ if (map == MAP_FAILED) perror("mmap"), exit(1);
+ if (fstat(h, &st1)) perror("fstat"), exit(1);
+ sleep(2);
+ *map = 'z';
+ if (msync(map, 4096, MS_SYNC)) perror("msync"), exit(1);
+ if (fstat(h, &st2)) perror("fstat"), exit(1);
+ if (st1.st_mtime == st2.st_mtime) fprintf(stderr, "BUG: Shared fault did not change mtime!\n"), exit(1);
+ if (st1.st_ctime == st2.st_ctime) fprintf(stderr, "BUG: Shared fault did not change ctime!\n"), exit(1);
+ if (munmap(map, 4096)) perror("munmap"), exit(1);
+
+ if (close(h)) perror("close"), exit(1);
+ if (unlink(FILE_NAME)) perror("unlink"), exit(1);
+ return 0;
+}
Index: xfstests-dev/tests/generic/609
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xfstests-dev/tests/generic/609 2020-09-11 18:30:30.000000000 +0200
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved.
+#
+# FS QA Test No. 609
+#
+# Check ctime and mtime are not updated on COW faults
+# and that they are updated on shared faults
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $testfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_test
+
+testfile=$TEST_DIR/testfile.$seq
+
+echo "Silence is golden"
+
+$here/src/mmap-timestamp $testfile 2>&1
+
+status=0
+exit
Index: xfstests-dev/tests/generic/609.out
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xfstests-dev/tests/generic/609.out 2020-09-11 18:24:24.000000000 +0200
@@ -0,0 +1,2 @@
+QA output created by 609
+Silence is golden
Index: xfstests-dev/tests/generic/group
===================================================================
--- xfstests-dev.orig/tests/generic/group 2020-09-06 12:38:40.000000000 +0200
+++ xfstests-dev/tests/generic/group 2020-09-11 18:25:09.000000000 +0200
@@ -611,3 +611,4 @@
606 auto attr quick dax
607 auto attr quick dax
608 auto attr quick dax
+609 auto quick
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
next prev parent reply other threads:[~2020-09-11 16:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 19:24 a crash when running strace from persistent memory Mikulas Patocka
2020-09-03 19:55 ` Linus Torvalds
2020-09-04 8:08 ` Mikulas Patocka
2020-09-04 17:11 ` Linus Torvalds
2020-09-04 16:21 ` make misbehavior on ext2 in dax mode (was: a crash when running strace from persistent memory) Mikulas Patocka
2020-09-05 12:11 ` Mikulas Patocka
2020-09-05 12:12 ` [PATCH 1/2] ext2: don't update mtime on COW faults Mikulas Patocka
2020-09-07 9:00 ` Jan Kara
2020-09-05 12:13 ` [PATCH 2/2] xfs: " Mikulas Patocka
2020-09-05 15:36 ` Darrick J. Wong
2020-09-05 17:02 ` Mikulas Patocka
2020-09-10 6:06 ` Darrick J. Wong
2020-09-11 16:41 ` Mikulas Patocka [this message]
2020-09-05 16:47 ` Linus Torvalds
2020-09-05 17:03 ` Linus Torvalds
2020-09-07 8:59 ` Jan Kara
2020-09-05 17:04 ` [PATCH 2/2 v2] " Mikulas Patocka
2020-09-07 6:47 ` [PATCH 2/2] " Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.02.2009111232210.29958@file01.intranet.prod.int.rdu2.redhat.com \
--to=mpatocka@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=kirill@shutemov.name \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=linux-xfs@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=sandeen@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).