]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orp...
authorYounger Liu <younger.liu@huawei.com>
Thu, 27 Jun 2013 23:51:06 +0000 (09:51 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:37:17 +0000 (16:37 +1000)
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 <younger.liu@huawei.com>
Cc: Jie Liu <jeff.liu@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/namei.c

index 75964addfe3242fec9a9eb5f963e126d191a86af..514d8468375c9f17e626992a2d3a1f1e22001141 100644 (file)
@@ -2095,17 +2095,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;