struct vfsmount *first_hidden_mnt = NULL;
int locked_parent = 0;
int locked_child = 0;
+ int allocated_new_info = 0;
int opaque;
char *whname = NULL;
BUG_ON(UNIONFS_D(dentry) != NULL);
locked_child = 1;
}
- if (lookupmode != INTERPOSE_PARTIAL)
+ if (lookupmode != INTERPOSE_PARTIAL) {
if ((err = new_dentry_private_data(dentry)))
goto out;
+ allocated_new_info = 1;
+ }
/* must initialize dentry operations */
dentry->d_op = &unionfs_dops;
if (locked_parent)
unionfs_unlock_dentry(parent_dentry);
dput(parent_dentry);
- if (locked_child)
+ if (locked_child || (err && allocated_new_info))
unionfs_unlock_dentry(dentry);
return ERR_PTR(err);
}
int newsize;
int oldsize = 0;
struct unionfs_dentry_info *info = UNIONFS_D(dentry);
+ int unlock_on_err = 0;
spin_lock(&dentry->d_lock);
if (!info) {
mutex_init(&info->lock);
mutex_lock(&info->lock);
+ unlock_on_err = 1;
info->lower_paths = NULL;
} else
out_free:
kfree(info->lower_paths);
+ if (unlock_on_err)
+ mutex_unlock(&info->lock);
out:
free_dentry_private_data(info);