linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, achender@linux.vnet.ibm.com
Subject: Re: [PATCH 2/5] ext4: Correctly handle EOFBLOCKS flag in ext4_ext_punch_hole
Date: Wed, 21 Mar 2012 22:13:05 -0400	[thread overview]
Message-ID: <20120322021305.GE11157@thunk.org> (raw)
In-Reply-To: <1332314639-22875-2-git-send-email-lczerner@redhat.com>

On Wed, Mar 21, 2012 at 08:23:55AM +0100, Lukas Czerner wrote:
> +	/*
> +	 * This is fugly, but even though we're going to get rid of the
> +	 * EOFBLOCKS_LF in the future, we have to handle it correctly now
> +	 * because there are still versions of e2fsck out there which
> +	 * would scream otherwise. Once the new e2fsck code ignoring
> +	 * this flag is common enough this can be removed entirely.
> +	 */
> +	if (ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)) {
> +		struct ext4_ext_path *path;
> +		ext4_lblk_t last_block;
> +
> +		mutex_lock(&inode->i_mutex);
> +		down_read(&EXT4_I(inode)->i_data_sem);

I was looking at this patch, and I was wondering why we weren't taking
i_mutex earlier in ext4_ext_punch_hole().  The primary use of i_mutex
is to protect writes racing with each other and with truncate.  Given
that punch essentially works like truncate, and all of ext4_truncate()
is run with i_mutex down, and currently ext4_ext_punch_hole() (before
applying this patch) doesn't isn't taking i_mutex at all, I'm
wondering if we can run into problems where punch is racing against a
write --- if the pages are already in mapped, then the write might not
even need to take i_data_sem.

Lukas, Allison --- am I missing something here?

						- Ted

  reply	other threads:[~2012-03-22  2:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21  7:23 [PATCH 1/5] ext4: Remove restrictive checks for EOFBLOCKS_FL Lukas Czerner
2012-03-21  7:23 ` [PATCH 2/5] ext4: Correctly handle EOFBLOCKS flag in ext4_ext_punch_hole Lukas Czerner
2012-03-22  2:13   ` Ted Ts'o [this message]
2012-03-22  8:25     ` Lukas Czerner
2012-03-22 13:47       ` Ted Ts'o
2012-03-22 14:05         ` Lukas Czerner
2012-03-21  7:23 ` [PATCH 3/5] ext4: Allow punch hole beyond i_size Lukas Czerner
2012-03-21  7:23 ` [PATCH 4/5] ext4: Remove uneeded i_size handling Lukas Czerner
2012-03-21  7:23 ` [PATCH 5/5] ext4: Correct ext4_punch_hole return codes Lukas Czerner
2012-03-22  0:10 ` [PATCH 1/5] ext4: Remove restrictive checks for EOFBLOCKS_FL Allison Henderson

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=20120322021305.GE11157@thunk.org \
    --to=tytso@mit.edu \
    --cc=achender@linux.vnet.ibm.com \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.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).