[Ocfs2-devel] [patch 10/28] ocfs2: do not set fs read-only if rec[0] is empty while committing truncate

Mark Fasheh mfasheh at suse.de
Fri Aug 28 16:52:00 PDT 2015


On Wed, Aug 26, 2015 at 03:11:46PM -0700, Andrew Morton wrote:
> From: Xue jiufei <xuejiufei at huawei.com>
> Subject: ocfs2: do not set fs read-only if rec[0] is empty while committing truncate
> 
> While appending an extent to a file, it will call these functions:
> ocfs2_insert_extent
> 
>   -> call ocfs2_grow_tree() if there's no free rec
>      -> ocfs2_add_branch add a new branch to extent tree,
>         now rec[0] in the leaf of rightmost path is empty
>   -> ocfs2_do_insert_extent
>      -> ocfs2_rotate_tree_right
>        -> ocfs2_extend_rotate_transaction
>           -> jbd2_journal_restart if jbd2_journal_extend fail
>      -> ocfs2_insert_path
>         -> ocfs2_extend_trans
>           -> jbd2_journal_restart if jbd2_journal_extend fail
>         -> ocfs2_insert_at_leaf
>      -> ocfs2_et_update_clusters
> Function jbd2_journal_restart() may be called and it may happened that
> buffers dirtied in ocfs2_add_branch() are committed
> while buffers dirtied in ocfs2_insert_at_leaf() and
> ocfs2_et_update_clusters() are not.
> So an empty rec[0] is left in rightmost path which will cause
> read-only filesystem when call ocfs2_commit_truncate()
> with the error message: "Inode %lu has an empty extent record".
> 
> This is not a serious problem, so remove the rightmost path when call
> ocfs2_commit_truncate().
> 
> Signed-off-by: joyce.xue <xuejiufei 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>

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



--
Mark Fasheh



More information about the Ocfs2-devel mailing list