[Ocfs2-devel] [patch 08/28] ocfs2: add ip_alloc_sem in direct IO to protect allocation changes

Mark Fasheh mfasheh at suse.de
Fri Aug 28 16:27:12 PDT 2015


On Wed, Aug 26, 2015 at 03:11:40PM -0700, Andrew Morton wrote:
> From: WeiWei Wang <wangww631 at huawei.com>
> Subject: ocfs2: add ip_alloc_sem in direct IO to protect allocation changes
> 
> In ocfs2, ip_alloc_sem is used to protect allocation changes on the node. 
> In direct IO, we add ip_alloc_sem to protect date consistent between
> direct-io and ocfs2_truncate_file race (buffer io use ip_alloc_sem
> already).  Although inode->i_mutex lock is used to avoid concurrency of
> above situation, i think ip_alloc_sem is still needed because protect
> allocation changes is significant.
> 
> Other filesystem like ext4 also uses rw_semaphore to protect data
> consistent between get_block-vs-truncate race by other means, So
> ip_alloc_sem in ocfs2 direct io is needed.
> 
> Signed-off-by: Weiwei Wang <wangww631 at huawei.com>
> Cc: Mark Fasheh <mfasheh at suse.com>
> Cc: Joel Becker <jlbec at evilplan.org>
> Signed-off-by: Andrew Morton <akpm at linux-foundation.org>

Signed-off-by: Mark Fasheh <mfasheh at suse.de>

--
Mark Fasheh



More information about the Ocfs2-devel mailing list