linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Theodore Ts'o <tytso@mit.edu>
Cc: Luk???? Czerner <lczerner@redhat.com>,
	Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>,
	linux-ext4@vger.kernel.org
Subject: Re: OpenPosix test case mmap_11-4 fails in ext4 filesystem
Date: Wed, 21 May 2014 17:06:19 +0200	[thread overview]
Message-ID: <20140521150619.GA5459@rei.suse.cz> (raw)
In-Reply-To: <20140521141203.GB1501@thunk.org>

Hi!
> This is a valid bug report which applies to upstream ext4.  It also
> applies to tmpfs, by the way.
> 
> It would be good to get this test case (thank you very much for
> writing it!) imported into xfstests, since the lack of this test is
> why we didn't notice the bug when we added the fs/ext4/page_io.c code
> paths.

It has been in LTP for ages. Maybe it's a time developers should start
to use LTP :) (We managed to fix most of the problems that are credible
for the bad LTP reputation...)

> BTW, there is one interesting thing about that changed when we moved
> to page based I/O (years and years ago).  The requirement in mmap is
> as Xiaoguang stated:
> 
>        A file is mapped in multiples of the page size.  For a file
>        that is not a multi??? ple of the page size, the remaining memory
>        is zeroed when mapped, and writes to that region are not
>        written out to the file.  The effect of changing the size of
>        the underlying file of a mapping on the pages that correspond
>        to added or removed regions of the file is unspecified.
> 
> Previously in Linux 2.2 (or was it 2.0; my memory is a bit fuzzy about
> when we unified the buffer and page caches), when we copied the data
> from the page cache to the buffer cache, we stopped at EOF.  This
> implies that if the program modified the portion of the page mapped
> beyond EOF, it would remain modified until the page was released and
> the page was dropped from the page cache.
> 
> Now, when we call writepage() --- assuming the file system wasn't
> buggy --- the bytes after EOF will get cleared.  If the user doesn't
> call msync(), when this happens is unpredictable to the userspace
> program, since it happens when writeback daemons decide to write back
> the data.

This is exacly what we concluded when we were fixing the testacase (I
talked about this I think with Jan Kara and Michal Hocko). And the
result was to add the msync() to the testcase. We also agreed that
fixing this for tmpfs is not worth the effort although when interpreting
POSIX strictly it should work with shm memory as well.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2014-05-21 15:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21  6:39 OpenPosix test case mmap_11-4 fails in ext4 filesystem Xiaoguang Wang
2014-05-21 12:55 ` Lukáš Czerner
2014-05-21 14:12   ` Theodore Ts'o
2014-05-21 15:06     ` chrubis [this message]
2014-05-21 18:58       ` Theodore Ts'o
2014-05-21 21:20         ` chrubis
2014-05-21 22:06           ` Eric Sandeen
2014-05-22  2:45           ` Theodore Ts'o
2014-05-22 10:45             ` chrubis
2014-05-22 14:38               ` Theodore Ts'o
2014-05-21 15:18     ` Lukáš Czerner
2014-05-21 19:01       ` Theodore Ts'o
2014-05-22 13:42 ` Jan Kara

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=20140521150619.GA5459@rei.suse.cz \
    --to=chrubis@suse.cz \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=wangxg.fnst@cn.fujitsu.com \
    /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).