android_kernel_samsung_a7y1.../fs
Josef Bacik 956d21c81b btrfs: do not call synchronize_srcu() in inode_tree_del
[ Upstream commit f72ff01df9cf5db25c76674cac16605992d15467 ]

Testing with the new fsstress uncovered a pretty nasty deadlock with
lookup and snapshot deletion.

Process A
unlink
 -> final iput
   -> inode_tree_del
     -> synchronize_srcu(subvol_srcu)

Process B
btrfs_lookup  <- srcu_read_lock() acquired here
  -> btrfs_iget
    -> find inode that has I_FREEING set
      -> __wait_on_freeing_inode()

We're holding the srcu_read_lock() while doing the iget in order to make
sure our fs root doesn't go away, and then we are waiting for the inode
to finish freeing.  However because the free'ing process is doing a
synchronize_srcu() we deadlock.

Fix this by dropping the synchronize_srcu() in inode_tree_del().  We
don't need people to stop accessing the fs root at this point, we're
only adding our empty root to the dead roots list.

A larger much more invasive fix is forthcoming to address how we deal
with fs roots, but this fixes the immediate problem.

Fixes: 76dda93c6ae2 ("Btrfs: add snapshot/subvolume destroy ioctl")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:21:58 +02:00
..
9p 9p: avoid attaching writeback_fid on mmap with type PRIVATE 2020-04-07 08:07:58 +02:00
adfs fs/adfs: super: fix use-after-free bug 2020-04-06 20:26:54 +02:00
affs
afs
autofs4 autofs: fix a leak in autofs_expire_indirect() 2020-04-07 12:44:02 +02:00
befs
bfs
btrfs btrfs: do not call synchronize_srcu() in inode_tree_del 2020-04-07 13:21:58 +02:00
cachefiles
ceph ceph: fix dentry leak in ceph_readdir_prepopulate 2020-04-07 12:35:17 +02:00
cifs CIFS: Respect O_SYNC and O_DIRECT flags during reconnect 2020-04-07 13:12:47 +02:00
coda coda: add error handling for fget 2020-04-06 20:27:22 +02:00
configfs configfs: fix a deadlock in configfs_symlink() 2020-04-07 11:49:08 +02:00
cramfs
crypto
debugfs debugfs: fix use-after-free on symlink traversal 2020-04-06 16:42:15 +02:00
devpts
dlm dlm: fix invalid cluster name warning 2020-04-07 12:45:23 +02:00
ecryptfs ecryptfs_lookup_interpose(): lower_dentry->d_parent is not stable either 2020-04-07 12:26:27 +02:00
efivarfs
efs
exofs
exportfs
ext2
ext4 ext4: fix punch hole for inline_data file systems 2020-04-07 07:40:53 +02:00
f2fs f2fs: fix to do sanity check on segment bitmap of LFS curseg 2020-04-07 07:36:58 +02:00
fat fat: work around race with userspace's read via blockdev while mounting 2020-04-07 07:53:48 +02:00
freevxfs
fscache
fuse fuse: verify attributes 2020-04-07 12:45:40 +02:00
gfs2 gfs2: take jdata unstuff into account in do_grow 2020-04-07 12:41:53 +02:00
hfs fs/hfs/extent.c: fix array out of bounds read of array extent 2020-04-07 12:35:57 +02:00
hfsplus hfsplus: fix return value of hfsplus_get_block() 2020-04-07 12:35:53 +02:00
hostfs
hpfs
hugetlbfs hugetlb: use same fault hash key for shared and private mappings 2020-04-06 18:15:12 +02:00
isofs
jbd2
jffs2 jffs2: fix use-after-free on symlink traversal 2020-04-06 16:42:13 +02:00
jfs
kernfs kernfs: Fix range checks in kernfs_get_target_path 2020-04-07 12:28:12 +02:00
lockd
logfs
minix
ncpfs
nfs NFSv4.x: fix lock recovery during delegation recall 2020-04-07 12:32:46 +02:00
nfs_common
nfsd nfsd: Return EPERM, not EACCES, in some SETATTR cases 2020-04-07 12:45:30 +02:00
nilfs2
nls
notify
ntfs
ocfs2 quota: Check that quota is not dirty before release 2020-04-07 13:07:33 +02:00
omfs
openpromfs
overlayfs ovl: filter of trusted xattr results in audit 2020-04-07 07:41:14 +02:00
proc fs/proc/array.c: allow reporting eip/esp for all coredumping threads 2020-04-07 13:06:16 +02:00
pstore
qnx4
qnx6
quota quota: fix livelock in dquot_writeback_dquots 2020-04-07 13:07:35 +02:00
ramfs
reiserfs
romfs
sdcardfs
sdfat
squashfs
sysfs
sysv
tracefs
ubifs
udf udf: Fix incorrect final NOT_ALLOCATED (hole) extent length 2020-04-06 19:26:24 +02:00
ufs ufs: fix braino in ufs_get_inode_gid() for solaris UFS flavour 2020-04-06 18:14:41 +02:00
xfs xfs: Align compat attrlist_by_handle with native implementation. 2020-04-07 12:41:55 +02:00
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c binfmt_elf: switch to new creds when switching to new mm 2020-04-06 14:52:46 +02:00
binfmt_em86.c
binfmt_flat.c fs/binfmt_flat.c: make load_flat_shared_library() work 2020-04-06 19:13:44 +02:00
binfmt_misc.c
binfmt_script.c exec: load_script: Do not exec truncated interpreter path 2020-04-07 09:27:31 +02:00
block_dev.c
buffer.c fs: fix guard_bio_eod to check for real EOD errors 2020-04-06 14:50:20 +02:00
char_dev.c chardev: add additional check for minor range overlap 2020-04-06 18:19:58 +02:00
compat_binfmt_elf.c
compat_ioctl.c compat_ioctl: pppoe: fix PPPOEIOCSFWD handling 2020-04-06 20:28:29 +02:00
compat.c
coredump.c
dax.c
dcache.c fs/dcache: move security_d_instantiate() behind attaching dentry to inode 2020-04-07 09:57:56 +02:00
dcookies.c
direct-io.c
dlog_hook.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c sched/fair: Don't free p->numa_faults with concurrent readers 2020-04-06 20:26:24 +02:00
fcntl.c
fhandle.c
file_table.c
file.c fs/file.c: initialize init_files.resize_wait 2020-04-06 14:49:46 +02:00
filesystems.c
fs_pin.c
fs_struct.c
fs-writeback.c cgroup,writeback: don't switch wbs immediately on dead wbs if the memcg is dead 2020-04-07 11:58:54 +02:00
inode.c Abort file_remove_privs() for non-reg. files 2020-04-06 19:09:43 +02:00
internal.h
ioctl.c
Kconfig
Kconfig.binfmt
libfs.c
locks.c
Makefile
mbcache.c
mount.h
mpage.c
namei.c
namespace.c
no-block.c
nsfs.c
open.c access: avoid the RCU grace period for the temporary subjective credentials 2020-04-06 20:24:58 +02:00
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2020-04-06 18:47:45 +02:00
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
userfaultfd.c userfaultfd_release: always remove uffd flags and clear vm_userfaultfd_ctx 2020-04-06 21:09:04 +02:00
utimes.c
xattr.c