Re: [PATCH] mm for fs: add truncate_pagecache_range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 25 Mar 2012 13:26:10 -0700 (PDT) Hugh Dickins <hughd@xxxxxxxxxx> wrote:

> Building a test kernel quickly told me that inode->i_mapping->i_mutex
> doesn't exist, of course it's inode->i_mutex.
> 
> Then running the test kernel quickly told me that neither ext4 nor xfs
> (I didn't try ocfs2) holds inode->i_mutex where holepunching calls
> truncate_inode_pages_range().
> 
> Now, there might or might not be reasons why ext4 or xfs ought to hold
> i_mutex there for its own consistency, but it's beyond me to determine
> that: let's assume they're correct without evidence to the contrary.
> 
> Stabilizing i_size is not a reason: holepunching does not affect i_size
> and is not affected by i_size (okay, ext4 still has the bug I reported
> a couple of months ago, whereby its holepunching stops at i_size,
> forgetting blocks fallocated beyond; but no doubt that will get fixed).
> 
> And nothing that truncate_pagecache_range() does needs i_mutex:
> neither the unmap_mapping_range() nor the truncate_inode_pages_range()
> needs i_mutex.  A year ago, yes, Miklos showed how unmap_mapping_range()
> was relying on mutex serialization, and added an additional mutex for
> that, which Peter was able to remove once he mutified i_mmap_lock.
> 
> truncate_pagecache_range() is just a drop-in replacement for
> truncate_inode_pages_range(), and has no different locking needs.

Does anything prevent new pages from getting added to pagecache and
perhaps faulted into VMAs after or during the execution of these
functions?

Also, I wonder what prevents pages in the range from being dirtied
between ext4_ext_punch_hole()'s filemap_write_and_wait_range() and
truncate_inode_pages_range().

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]