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:
Ritesh Harjani <riteshh@codeaurora.org>
Loading
Please register or sign in to comment