ext4: make sure group number is bumped after a inode allocation race
authorTheodore Ts'o <tytso@mit.edu>
Fri, 26 Jul 2013 19:15:46 +0000 (15:15 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Aug 2013 05:57:06 +0000 (22:57 -0700)
commitb2fea70a4a26d2946b470affd5582d7916be93ab
tree118d6d33a6dcaadbbd059747d71d7a29786e4cd4
parent3b8d21f4237f7ef442314feec300cdbce72592b5
ext4: make sure group number is bumped after a inode allocation race

commit a34eb503742fd25155fd6cff6163daacead9fbc3 upstream.

When we try to allocate an inode, and there is a race between two
CPU's trying to grab the same inode, _and_ this inode is the last free
inode in the block group, make sure the group number is bumped before
we continue searching the rest of the block groups.  Otherwise, we end
up searching the current block group twice, and we end up skipping
searching the last block group.  So in the unlikely situation where
almost all of the inodes are allocated, it's possible that we will
return ENOSPC even though there might be free inodes in that last
block group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ialloc.c