lkml.org 
[lkml]   [2011]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: lock i_mutex for fallocate?
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


\
 
 \ /
  Last update: 2011-09-01 09:11    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site