summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorXue jiufei <xuejiufei@huawei.com>2014-04-03 14:47:04 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 16:20:55 -0700
commit466e68c4306317e7d239e3100f612d403e3e2c3c (patch)
treedbd2d8c353eb033a3cd08aa1ea51e89e5c1675a9 /fs/ocfs2/namei.c
parent3ed2be719eb9770139da791342b190b20a7a9270 (diff)
downloadlinux-466e68c4306317e7d239e3100f612d403e3e2c3c.tar.gz
linux-466e68c4306317e7d239e3100f612d403e3e2c3c.tar.bz2
linux-466e68c4306317e7d239e3100f612d403e3e2c3c.zip
ocfs2: __ocfs2_mknod_locked should return error when ocfs2_create_new_inode_locks() failed
When ocfs2_create_new_inode_locks() return error, inode open lock may not be obtainted for this inode. So other nodes can remove this file and free dinode when inode still remain in memory on this node, which is not correct and may trigger BUG. So __ocfs2_mknod_locked should return error when ocfs2_create_new_inode_locks() failed. Node_1 Node_2 create fileA, call ocfs2_mknod() -> ocfs2_get_init_inode(), allocate inodeA -> ocfs2_claim_new_inode(), claim dinode(dinodeA) -> call ocfs2_create_new_inode_locks(), create open lock failed, return error -> __ocfs2_mknod_locked return success unlink fileA try open lock succeed, and free dinodeA create another file, call ocfs2_mknod() -> ocfs2_get_init_inode(), allocate inodeB -> ocfs2_claim_new_inode(), as Node_2 had freed dinodeA, so claim dinodeA and update generation for dinodeA call __ocfs2_drop_dl_inodes()->ocfs2_delete_inode() to free inodeA, and finally triggers BUG on(inode->i_generation != le32_to_cpu(fe->i_generation)) in function ocfs2_inode_lock_update(). Signed-off-by: joyce.xue <xuejiufei@huawei.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index e61e4c9a077c..931fd50a971f 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -580,9 +580,6 @@ static int __ocfs2_mknod_locked(struct inode *dir,
oi->i_sync_tid = handle->h_transaction->t_tid;
oi->i_datasync_tid = handle->h_transaction->t_tid;
- status = 0; /* error in ocfs2_create_new_inode_locks is not
- * critical */
-
leave:
if (status < 0) {
if (*new_fe_bh) {