From: Jan Kara <jack@suse.cz>
To: Dave Chinner <david@fromorbit.com>
Cc: Matthew Wilcox <matthew@wil.cx>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org
Subject: Re: hole-punch vs fault
Date: Mon, 2 Dec 2013 09:33:18 +0100 [thread overview]
Message-ID: <20131202083318.GA2188@quack.suse.cz> (raw)
In-Reply-To: <20131201215221.GW10988@dastard>
On Mon 02-12-13 08:52:21, Dave Chinner wrote:
<snip>
> > I'm solving two cases here, one is holepunch vs fault for regular
> > files. The other is truncate vs fault for XIP files, which is
> > probably a little less rare. I think the same mechanism can be
> > used when a filesystem is doing a defragment or otherwise moving
> > blocks around on an XIP block device.
>
> Well, you kind of raised that as a secondary issue in passing, not
> that it was the problem you actually need to solve.
>
> > Look, I'm not attached to the i_damage solution,
> > but I do need something to protect against truncate vs fault on XIP.
> > Fixing holepunch vs fault too just felt like the right thing to do.
>
> So, your real problem is that ext2-xip has a truncate vs fault race
> because of a lack of a page lock to serialise page faults against
> truncate. In fact, it appears to bypass the page cache completely
> for both reads and writes (writes go directly to block device
> memory), so it would seem that all the assumptions we've made about
> serialisation on page locks throughout every filesystem are not
> valid for XIP?
Yeah, agreed.
> Indeed, XIP could make use of the structures we already
> have in the struct inode/address space to behave more like a normal
> filesystem. We already use the mapping tree to store
> per-page information that is used to serialise truncate vs page
> faults, so why not make XIP do exactly the same thing?
I believe that grabbing mmap_sem for writing during truncate (in case of
ext2 around xip_truncate_page() & truncate_setsize() calls should do the
trick. But I need to verify with lockdep that it doesn't introduce new
locking problems.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2013-12-02 8:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 13:48 hole-punch vs fault Matthew Wilcox
2013-11-27 22:19 ` Jan Kara
2013-11-28 2:33 ` Matthew Wilcox
2013-11-28 3:30 ` Matthew Wilcox
2013-11-28 4:22 ` Dave Chinner
2013-11-28 4:44 ` Matthew Wilcox
2013-11-28 12:24 ` Matthew Wilcox
2013-11-28 22:12 ` Dave Chinner
2013-11-29 13:11 ` Matthew Wilcox
2013-12-01 21:52 ` Dave Chinner
2013-12-02 8:33 ` Jan Kara [this message]
2013-12-02 15:58 ` Matthew Wilcox
2013-12-02 20:11 ` Jan Kara
2013-12-02 20:13 ` Matthew Wilcox
2013-12-02 23:13 ` 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=20131202083318.GA2188@quack.suse.cz \
--to=jack@suse.cz \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthew@wil.cx \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.