public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Allison Henderson <achender@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Andreas Dilger <adilger@dilger.ca>
Subject: Re: lock i_mutex for fallocate?
Date: Thu, 1 Sep 2011 17:08:48 +1000	[thread overview]
Message-ID: <20110901070848.GQ32358@dastard> (raw)
In-Reply-To: <4E5ED2D5.8040302@linux.vnet.ibm.com>

On Wed, Aug 31, 2011 at 05:33:25PM -0700, Allison Henderson wrote:
> Hi All,
> 
> In ext4 punch hole, we realized that the punch hole operation needs
> to be done under i_mutex just like truncate.  i_mutex for truncate
> is held in the vfs layer, so we dont need to lock it at the file
> system layer, but vfs does not lock i_mutex for fallocate.  We can
> lock i_mutex for fallocate at the fs layer, but question was raised
> then: should i_mutex for fallocate be held in the vfs layer instead?

No.

> I do not know if other file systems need i_mutex to be locked for
> fallocate,

For one, XFS does not require i_mutex to be held for any extent
manipulation of any kind (allocation, truncation, hole punch,
unwritten extent conversion, etc).

Hence the current structure of having the filesystem take i_mutex if
it needs it to protect allocations against races is appropriate.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2011-09-01  7:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01  0:33 lock i_mutex for fallocate? Allison Henderson
2011-09-01  1:10 ` Yongqiang Yang
2011-09-01  1:12 ` Allison Henderson
2011-09-01 17:59   ` Josef Bacik
2011-09-01  7:08 ` Dave Chinner [this message]
2011-09-01  7:31 ` Christoph Hellwig
2011-09-01 17:47   ` 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=20110901070848.GQ32358@dastard \
    --to=david@fromorbit.com \
    --cc=achender@linux.vnet.ibm.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@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