if (UNIONFS_D(dentry)->odf.dentry) {
/* return negative dentry if a whiteout */
if (UNIONFS_D(dentry)->odf.whiteout) {
- bindex = 0;
+ bindex = bstart;
goto out_negative;
}
/* if opaque dir lookup only until opaque branch */
}
/* This should only happen if we found a whiteout. */
if (first_dentry_offset == -1) {
+ /*
+ * If we are a whiteout, we haven't filled up lower_dir_dentry
+ * at all, so this is NULL at this point. Fill this up now.
+ * Note, this was why we needed to pass the right bindex from
+ * above.
+ */
+ if (!lower_dir_dentry)
+ lower_dir_dentry =
+ unionfs_lower_dentry_idx(parent_dentry, bindex);
first_lower_dentry = lookup_one_len(name, lower_dir_dentry,
namelen);
first_dentry_offset = bindex;