Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 69e29d1c authored by Ritesh Harjani's avatar Ritesh Harjani
Browse files

sdcardfs: Fix a case where sdcardfs may fail to create a file



Test case:-
1. touch <sdcardfs-path>/file1
2. In parallel keep dropping the caches.

In below sequence:-
1. __sdcardfs_lookup
2. vfs_path_lookup   --> returns -ENOENT(since file is not yet present)
3. d_hash_lookup     --> if returned NULL, then sdcardfs returns NULL

In above sequence of events, sdcardfs has not taken any ref count
on lower_dentry while doing vfs_path_lookup.
If in case like during low memory situation, if shrink_dcache is invoked
then it will remove the dentry from lookup cache.
Now when sdcardfs searches for d_hash_lookup, it could not find the
dentry and assumes that lower FS did not create it and hence returns and
error.

To fix this, it should again go via lookup_one_len_unlocked call
to see if dentry is really present or not.

Change-Id: I58e73e39605bfd5e81dffd878701d3f744514c05
Signed-off-by: default avatarRitesh Harjani <riteshh@codeaurora.org>
parent 4c314540
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment