archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <>
To: Mikulas Patocka <>
Cc: Jan Kara <>,
	"Darrick J. Wong" <>,
	Dave Chinner <>, Jann Horn <>,
	Christoph Hellwig <>, Oleg Nesterov <>,
	Kirill Shutemov <>,
	Theodore Ts'o <>,
	Andrea Arcangeli <>,
	Matthew Wilcox <>,
	Andrew Morton <>,
	Linux-MM <>,
	Linux Kernel Mailing List <>,
	linux-nvdimm <>,
	Ext4 Developers List <>,
	linux-xfs <>
Subject: Re: [PATCH 2/2] xfs: don't update mtime on COW faults
Date: Sat, 5 Sep 2020 09:47:53 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Sat, Sep 5, 2020 at 5:13 AM Mikulas Patocka <> wrote:
> When running in a dax mode, if the user maps a page with MAP_PRIVATE and
> PROT_WRITE, the xfs filesystem would incorrectly update ctime and mtime
> when the user hits a COW fault.

So your patch is obviously correct,  but at the same time I look at
the (buggy) ext2/xfs code you fixed, and I go "well, that was a really
natural mistake to make".

So I get the feeling that "yes, this was an ext2 and xfs bug, but we
kind of set those filesystems up to fail".

Could this possibly have been avoided by having nicer interfaces?

Grepping around, and doing a bit of "git blame", I note that ext4 used
to have this exact same bug too, but it was fixed three years ago in
commit fd96b8da68d3 ("ext4: fix fault handling when mounted with -o
dax,ro") and nobody at the time clearly realized it might be a

And honestly, it's possible that the pattern came from cut-and-paste
errors, but it's equally likely that the pattern was there simply
because it was such a natural pattern and such an easy and natural
mistake to make.

Maybe it's inevitable. Some people do want (and need) the information
whether it was a write just because they care about the page table
issues (ie marking the pte dirty etc). To that kind of situation,
whether it's shared or not might not matter all that much. But to a
filesystem, a private write vs a shared write are quite different

So I don't really have any suggestions, and maybe it's just what it
is, but maybe somebody has an idea for how to make it slightly less
natural to make this mistake..

But maybe just a test-case is all it takes, like Darrick suggests.

Linux-nvdimm mailing list --
To unsubscribe send an email to

  parent reply	other threads:[~2020-09-05 16:48 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
2020-09-05 16:47       ` Linus Torvalds [this message]
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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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).