UPSTREAM: ANDROID: fuse-bpf: Invalidate if lower is unhashed

If the lower filesystem has deleted a file or folder behind our back, we
should drop it as well.

Bug: 221093504
Test: atest android.hardware.cts.CameraTest#testJpegThumbnailSize
      several times in a row
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ibd92dea83a82dd7ab21269ae5d2533e4826f5fb7
This commit is contained in:
Daniel Rosenberg 2022-03-02 15:18:27 -08:00 • committed by Alexander Martinz
commit 36351aded0
No known key found for this signature in database
GPG key ID: CF15BDD9A321A9B2

View file

@ -1055,6 +1055,13 @@ int fuse_revalidate_backing(struct fuse_args *fa, struct inode *dir,
struct fuse_dentry *fuse_dentry = get_fuse_dentry(entry);
struct dentry *backing_entry = fuse_dentry->backing_path.dentry;
spin_lock(&backing_entry->d_lock);
if (d_unhashed(backing_entry)) {
spin_unlock(&backing_entry->d_lock);
return 0;
}
spin_unlock(&backing_entry->d_lock);
if (unlikely(backing_entry->d_flags & DCACHE_OP_REVALIDATE))
return backing_entry->d_op->d_revalidate(backing_entry, flags);
return 1;