android_kernel_xiaomi_sm8350/fs/sdcardfs
Gao Xiang 680425be35 ANDROID: sdcardfs: fix -ENOENT lookup race issue
The negative lower dentry created by vfs_path_lookup could be
reclaimed between vfs_path_lookup and d_hash_and_lookup.
Therefore, it is unsafe to just lookup dcache again for
the negative dentry cases.

Without this patch, users could occasionally get trapped into
`failed to create' under memory pressure.

So here is a workaround to hack it and in my opinion sdcardfs
should be refactored to close all races in the long term
as pointed out in the code comment of this commit.

Test: (Thread 1)
while true; do
echo 3 > /proc/sys/vm/drop_caches
done
(Thread 2)
i=0
while true; do
echo 123 > /sdcard/$i
i=$((i+1))
done
Bug: 63872684
Cc: Daniel Rosenberg <drosen@google.com>
Cc: Miao Xie <miaoxie@huawei.com>
Cc: Chao Yu <yuchao0@huawei.com>
Change-Id: Ic033e1f84a8b271c1f48010f4e1f189982bbbea2
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
(cherry picked from commit bd77267426ed5ffe6a25aa77c149cde28f479f95)
2020-01-07 02:42:56 +00:00
..
dentry.c
derived_perm.c
file.c
inode.c ANDROID: sdcardfs: fix -ENOENT lookup race issue 2020-01-07 02:42:56 +00:00
Kconfig
lookup.c ANDROID: sdcardfs: fix -ENOENT lookup race issue 2020-01-07 02:42:56 +00:00
main.c ANDROID: sdcardfs: evict dentries on fscrypt key removal 2019-10-23 21:19:54 +00:00
Makefile
mmap.c
multiuser.h
packagelist.c
sdcardfs.h ANDROID: sdcardfs: evict dentries on fscrypt key removal 2019-10-23 21:19:54 +00:00
super.c ANDROID: sdcardfs: evict dentries on fscrypt key removal 2019-10-23 21:19:54 +00:00