From eefb8e00c4955a8f2ad4ef2f27384923c5b01604 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Thu, 22 Apr 2010 16:11:29 +0800 Subject: [PATCH] --- yaml --- r: 190556 b: refs/heads/master c: 062d340384dcf77dfd8de0a082b5da571de3925a h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ocfs2/namei.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 81a08aa048bd..e0aa208c261f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ab41fdc8fdd9f0942430941c1e2b516fd481371d +refs/heads/master: 062d340384dcf77dfd8de0a082b5da571de3925a diff --git a/trunk/fs/ocfs2/namei.c b/trunk/fs/ocfs2/namei.c index b66e48855825..8ff035eabfd8 100644 --- a/trunk/fs/ocfs2/namei.c +++ b/trunk/fs/ocfs2/namei.c @@ -445,11 +445,6 @@ static int ocfs2_mknod(struct inode *dir, ocfs2_free_dir_lookup_result(&lookup); - if ((status < 0) && inode) { - clear_nlink(inode); - iput(inode); - } - if (inode_ac) ocfs2_free_alloc_context(inode_ac); @@ -459,6 +454,17 @@ static int ocfs2_mknod(struct inode *dir, if (meta_ac) ocfs2_free_alloc_context(meta_ac); + /* + * We should call iput after the i_mutex of the bitmap been + * unlocked in ocfs2_free_alloc_context, or the + * ocfs2_delete_inode will mutex_lock again. + */ + if ((status < 0) && inode) { + OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; + clear_nlink(inode); + iput(inode); + } + mlog_exit(status); return status;