mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
UPSTREAM: ANDROID: fuse-bpf: Check if mkdir dentry setup
Uses lookup_one_len if given dentry is still negative/unlocked after mkdir is called Bug: 202785178 Test: atest android.scopedstorage.cts.device.ScopedStorageDeviceTest#testCreateAndDeleteEmptyDir Change-Id: Id5c7dfd303c242d6966fab82d96712d289676857 Signed-off-by: Daniel Rosenberg <drosen@google.com>
This commit is contained in:
parent
950ab97234
commit
5f188dae20
1 changed files with 10 additions and 7 deletions
|
|
@ -1110,6 +1110,7 @@ int fuse_mkdir_backing(
|
|||
struct inode *backing_inode = get_fuse_inode(dir)->backing_inode;
|
||||
struct path backing_path = {};
|
||||
struct inode *inode = NULL;
|
||||
struct dentry *d;
|
||||
|
||||
//TODO Actually deal with changing the backing entry in mkdir
|
||||
get_fuse_backing_path(entry, &backing_path);
|
||||
|
|
@ -1118,17 +1119,18 @@ int fuse_mkdir_backing(
|
|||
|
||||
inode_lock_nested(backing_inode, I_MUTEX_PARENT);
|
||||
err = vfs_mkdir(backing_inode, backing_path.dentry, fmi->mode & ~fmi->umask);
|
||||
inode_unlock(backing_inode);
|
||||
if (err)
|
||||
goto out;
|
||||
if (d_really_is_negative(backing_path.dentry) ||
|
||||
unlikely(d_unhashed(backing_path.dentry))) {
|
||||
err = -EINVAL;
|
||||
/**
|
||||
* TODO: overlayfs responds to this situation with a
|
||||
* lookupOneLen. Should we do that too?
|
||||
*/
|
||||
goto out;
|
||||
d = lookup_one_len(entry->d_name.name, backing_path.dentry->d_parent,
|
||||
entry->d_name.len);
|
||||
if (IS_ERR(d)) {
|
||||
err = PTR_ERR(d);
|
||||
goto out;
|
||||
}
|
||||
dput(backing_path.dentry);
|
||||
backing_path.dentry = d;
|
||||
}
|
||||
inode = fuse_iget_backing(dir->i_sb, backing_inode);
|
||||
if (IS_ERR(inode)) {
|
||||
|
|
@ -1137,6 +1139,7 @@ int fuse_mkdir_backing(
|
|||
}
|
||||
d_instantiate(entry, inode);
|
||||
out:
|
||||
inode_unlock(backing_inode);
|
||||
path_put(&backing_path);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue