Hunter Adrian 8b3884a841 UBIFS: return error if link and unlink race
Consider a scenario when 'vfs_link(dirA/fileA)' and
'vfs_unlink(dirA/fileA, dirB/fileB)' race. 'vfs_link()' does not
lock 'dirA->i_mutex', so this is possible. Both of the functions
lock 'fileA->i_mutex' though. Suppose 'vfs_unlink()' wins, and takes
'fileA->i_mutex' mutex first. Suppose 'fileA->i_nlink' is 1. In this
case 'ubifs_unlink()' will drop the last reference, and put 'inodeA'
to the list of orphans. After this, 'vfs_link()' will link
'dirB/fileB' to 'inodeA'. Thir is a problem because, for example,
the subsequent 'vfs_unlink(dirB/fileB)' will add the same inode
to the list of orphans.

This problem was reported by J. R. Okajima <hooanon05@yahoo.co.jp>

[Artem: add more comments, amended commit message]

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-19 11:01:31 +03:00
..
2008-12-03 13:14:33 +02:00
2008-12-31 14:13:24 +02:00
2009-03-20 19:11:12 +02:00
2009-01-26 12:54:11 +02:00
2009-03-08 13:29:09 +02:00
2009-03-20 19:12:00 +02:00
2009-01-27 16:25:10 +02:00
2008-12-31 14:13:25 +02:00
2009-03-20 19:11:12 +02:00
2009-03-08 13:29:41 +02:00
2009-03-20 19:11:12 +02:00
2009-01-26 12:54:11 +02:00
2009-03-20 19:11:12 +02:00
2008-12-23 12:23:40 +02:00
2009-01-29 16:22:54 +02:00
2008-09-30 11:12:56 +03:00
2009-03-31 14:58:40 +03:00
2009-03-20 19:11:12 +02:00
2009-03-26 16:36:20 +02:00
2008-09-30 11:12:56 +03:00
2009-02-17 12:45:22 +02:00
2008-09-30 11:12:57 +03:00
2009-03-20 19:11:12 +02:00
2009-03-26 16:36:20 +02:00
2009-03-26 16:36:20 +02:00
2008-09-30 11:12:55 +03:00