From a062390a37e71ed0580d8b7ffe6c32ad7fdc582c Mon Sep 17 00:00:00 2001 From: Younger Liu Date: Tue, 17 Dec 2013 10:44:57 +1100 Subject: [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del() While deleting a file into orphan dir in ocfs2_orphan_del(), it calls ocfs2_delete_entry() before ocfs2_journal_access_di(). If ocfs2_delete_entry() succeeded and ocfs2_journal_access_di() failed, there would be a inconsistency: the file is deleted from orphan dir, but orphan dir dinode is not updated. So we need to call ocfs2_journal_access_di() before ocfs2_orphan_del(). Signed-off-by: Younger Liu Reviewed-by: Jensen Cc: Jie Liu Cc: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton --- fs/ocfs2/namei.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 3cd7b07aef35..41b3e72ace2f 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -2194,17 +2194,17 @@ int ocfs2_orphan_del(struct ocfs2_super *osb, goto leave; } - /* remove it from the orphan directory */ - status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup); + status = ocfs2_journal_access_di(handle, + INODE_CACHE(orphan_dir_inode), + orphan_dir_bh, + OCFS2_JOURNAL_ACCESS_WRITE); if (status < 0) { mlog_errno(status); goto leave; } - status = ocfs2_journal_access_di(handle, - INODE_CACHE(orphan_dir_inode), - orphan_dir_bh, - OCFS2_JOURNAL_ACCESS_WRITE); + /* remove it from the orphan directory */ + status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup); if (status < 0) { mlog_errno(status); goto leave; -- 2.39.5