android_kernel_oneplus_msm8998/fs/ext4
Vegard Nossum 3a22cf0c7b ext4: fix reference counting bug on block allocation error
commit 554a5ccc4e4a20c5f3ec859de0842db4b4b9c77e upstream.

If we hit this error when mounted with errors=continue or
errors=remount-ro:

    EXT4-fs error (device loop0): ext4_mb_mark_diskspace_used:2940: comm ext4.exe: Allocating blocks 5090-6081 which overlap fs metadata

then ext4_mb_new_blocks() will call ext4_mb_release_context() and try to
continue. However, ext4_mb_release_context() is the wrong thing to call
here since we are still actually using the allocation context.

Instead, just error out. We could retry the allocation, but there is a
possibility of getting stuck in an infinite loop instead, so this seems
safer.

[ Fixed up so we don't return EAGAIN to userspace. --tytso ]

Fixes: 8556e8f3b6 ("ext4: Don't allow new groups to be added during block allocation")
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-16 09:30:51 +02:00
..
acl.c
acl.h
balloc.c ext4: validate s_reserved_gdt_blocks on mount 2016-08-16 09:30:51 +02:00
bitmap.c
block_validity.c
crypto.c ext4: fix an endianness bug in ext4_encrypted_zeroout() 2015-11-26 15:20:19 -05:00
crypto_fname.c
crypto_key.c ext4 crypto: add missing locking for keyring_key access 2016-02-17 12:31:02 -08:00
crypto_policy.c
dir.c
ext4.h ext4: fix races of writeback with punch hole and zero range 2016-05-04 14:48:53 -07:00
ext4_crypto.h
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h
extents.c ext4: check for extents that wrap around 2016-08-16 09:30:51 +02:00
extents_status.c
extents_status.h
file.c ext4: fix races between page faults and hole punching 2016-05-04 14:48:53 -07:00
fsync.c
hash.c
ialloc.c ext4: clean up error handling when orphan list is corrupted 2016-06-07 18:14:37 -07:00
indirect.c
inline.c
inode.c ext4: don't call ext4_should_journal_data() on the journal inode 2016-08-16 09:30:51 +02:00
ioctl.c
Kconfig
Makefile
mballoc.c ext4: fix reference counting bug on block allocation error 2016-08-16 09:30:51 +02:00
mballoc.h
migrate.c
mmp.c
move_extent.c ext4: iterate over buffer heads correctly in move_extent_per_page() 2016-06-01 12:15:48 -07:00
namei.c ext4: fix oops on corrupted filesystem 2016-06-07 18:14:37 -07:00
page-io.c
readpage.c Merge branch 'akpm' (patches from Andrew) 2015-11-07 14:32:45 -08:00
resize.c ext4: fix potential integer overflow 2016-02-25 12:01:15 -08:00
super.c ext4: short-cut orphan cleanup on error 2016-08-16 09:30:51 +02:00
symlink.c ext4: fix an endianness bug in ext4_encrypted_follow_link() 2015-11-26 15:20:50 -05:00
sysfs.c ext4: add "static" to ext4_seq_##name##_fops struct 2015-11-26 15:52:24 -05:00
truncate.h ext4: fix races between page faults and hole punching 2016-05-04 14:48:53 -07:00
xattr.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00
xattr.h
xattr_security.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00
xattr_trusted.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00
xattr_user.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00