ext2fs: update allocation info earlier in ext2fs_mkdir() and ext2fs_symlink()
Currently, ext2fs_mkdir() and ext2fs_symlink() update allocation bitmaps
and other information only close to the end of the function, in
particular after calling to ext2fs_link(). When ext2fs_link() will
support indexed directories, it will also need to allocate blocks and
that would cause filesystem corruption in case allocation info isn't
properly updated. So make sure ext2fs_mkdir() and ext2fs_symlink()
update allocation info before calling into ext2fs_link().
[ Added error handling so the calls to ext2fs_{block,inode}_alloc_stats()
can be undone if the newly created directory or symlink can not be linked
into the directory. -- TYT ]
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>