Xue jiufei 0e048316ff ocfs2: check existence of old dentry in ocfs2_link()
System call linkat first calls user_path_at(), check the existence of
old dentry, and then calls vfs_link()->ocfs2_link() to do the actual
work.  There may exist a race when Node A create a hard link for file
while node B rm it.

         Node A                          Node B
user_path_at()
  ->ocfs2_lookup(),
find old dentry exist
                                rm file, add inode say inodeA
                                to orphan_dir

call ocfs2_link(),create a
hard link for inodeA.

                                rm the link, add inodeA to orphan_dir
                                again

When orphan_scan work start, it calls ocfs2_queue_orphans() to do the
main work.  It first tranverses entrys in orphan_dir, linking all inodes
in this orphan_dir to a list look like this:

	inodeA->inodeB->...->inodeA

When tranvering this list, it will fall into loop, calling iput() again
and again.  And finally trigger BUG_ON(inode->i_state & I_CLEAR).

Signed-off-by: joyce <xuejiufei@huawei.com>
Reviewed-by: 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>
2014-02-10 16:01:43 -08:00
..
2013-10-24 23:43:27 -04:00
2014-01-25 03:13:02 -05:00
2014-01-25 03:13:02 -05:00
2014-01-23 18:54:14 +02:00
2013-06-29 12:56:53 +04:00
2014-01-26 11:51:09 +01:00
2014-02-02 16:24:07 -08:00
2013-12-04 12:27:46 +01:00
2013-12-08 21:14:59 -05:00
2014-01-28 18:56:37 -08:00
2014-02-08 10:50:58 -06:00
2013-09-16 18:20:25 -07:00
2014-02-10 16:01:42 -08:00
2014-01-25 03:14:05 -05:00
2013-06-29 12:56:32 +04:00
2014-01-25 03:13:03 -05:00
2013-06-29 12:56:39 +04:00
2013-12-22 11:03:49 -08:00
2013-12-05 16:36:21 -06:00
2013-06-29 12:57:04 +04:00
2013-10-24 23:34:54 -04:00
2013-09-13 23:06:40 -04:00
2013-06-29 12:57:05 +04:00
2014-01-26 12:37:55 -05:00
2013-11-23 22:33:47 -08:00
2013-09-10 18:56:31 -04:00
2013-10-24 23:34:54 -04:00
2013-11-09 00:16:20 -05:00
2013-10-24 23:34:54 -04:00
2014-01-26 08:26:40 -05:00
2013-11-23 22:33:47 -08:00
2013-10-24 23:35:00 -04:00
2013-10-24 23:34:54 -04:00
2014-01-22 19:36:57 +01:00
2013-11-09 00:16:31 -05:00
2013-05-29 12:57:34 -07:00