All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: "Lukáš Czerner" <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: ext4 dev branch: mutex not locked in ext4_truncate()
Date: Wed, 3 Apr 2013 13:58:18 -0400	[thread overview]
Message-ID: <20130403175818.GA18661@thunk.org> (raw)
In-Reply-To: <alpine.LFD.2.00.1304031503470.10110@localhost>

On Wed, Apr 03, 2013 at 04:41:01PM +0200, Lukáš Czerner wrote:
> Hi Ted,
> 
> there is a problem with your patch:
> 
> 32d90a241a44d22ebc5289d2a2561691fc2d1351
> 
> because there is one more case where we might call ext4_truncate()
> without i_mutex locked - from ext4_symlink(). Because we might be
> calling __page_symlink() and it will call ext4_write_begin(). In
> possible error case (ENOSPC for example) we might want to truncate
> everything which might have been instantiated past i_size, however
> at that point we're not holding i_mutex because there is no point in
> doing so - the inode can not be possibly held by anyone else.
> 
> My proposal is to only check whether the mutex is locked if the
> inode is _not_ new or is _not_ being freed.
> 
> There is a quick&dirty patch and it seems to be working well so
> far. Let me know if you prefer standalone patch, or if you'll
> include it into your commit.

I really like your approach.  We've been trying a number of other
approaches, including

      http://patchwork.ozlabs.org/patch/232914/
and
      http://patchwork.ozlabs.org/patch/231679/

but I think your suggestion is the best.

Thanks!!

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-04-03 17:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 14:41 ext4 dev branch: mutex not locked in ext4_truncate() Lukáš Czerner
2013-04-03 17:58 ` Theodore Ts'o [this message]
2013-04-04  2:02 ` Theodore Ts'o

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=20130403175818.GA18661@thunk.org \
    --to=tytso@mit.edu \
    --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 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.