commit d4079badbcac92a610b3bdcb4efee86605d71aa1
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Tue Apr 10 22:10:27 2007 -0400
fixed a lookup bug
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 9dc02f6..a246af0 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -72,6 +72,20 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
struct nameidata *n
name = dentry->d_name.name;
namelen = dentry->d_name.len;
+ /* check if whiteout here */
+ if (dentry && UNIONFS_D(dentry) && UNIONFS_D(dentry->d_parent)){
+ err = odf_lookup(dentry->d_parent, dentry, 0);
+ if (err)
+ goto out;
+
+ /* return negative dentry if a whiteout */
+ if (UNIONFS_D(dentry)->odf_info &&
+ UNIONFS_D(dentry)->odf_info->whiteout){
+ bindex = 0;
+ goto out_negative;
+ }
+ }
+
/* Now start the actual lookup procedure. */
bstart = dbstart(parent_dentry);
bend = dbend(parent_dentry);
@@ -191,8 +205,12 @@ out_negative:
nd->dentry = dentry;
/* FIXME: fix following line for mount point crossing */
nd->mnt = unionfs_lower_mnt_idx(parent_dentry, bindex);
- first_hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
- namelen, nd);
+ hidden_dir_dentry = unionfs_lower_dentry_idx(parent_dentry,
bindex);
+ if (hidden_dir_dentry && hidden_dir_dentry->d_inode)
+ first_hidden_dentry = lookup_one_len_nd(name,
+ hidden_dir_dentry, namelen, nd);
+ else
+ first_hidden_dentry = NULL;
first_dentry_offset = bindex;
if (IS_ERR(first_hidden_dentry)) {
err = PTR_ERR(first_hidden_dentry);
@@ -219,15 +237,7 @@ out_negative:
/* This part of the code is for positive dentries. */
out_positive:
BUG_ON(dentry_count <= 0);
-
- /* if what we found is a whiteout then this is really a negative dentry
*/
- err = odf_lookup(dentry->d_parent, dentry, 0);
- if (UNIONFS_D(dentry)->odf_info &&
UNIONFS_D(dentry)->odf_info->whiteout){
- first_dentry_offset = -1;
- bindex = 0; /* FIXME: Always create at branch 0? can we
guarantee that */
- /* if there is a wh, then branch 0 has negative
dentry? */
- goto out;
- }
+ BUG_ON(UNIONFS_D(dentry)->odf_info &&
UNIONFS_D(dentry)->odf_info->whiteout);
/* If we're holding onto the first negative dentry & corresponding
* vfsmount - throw it out.
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 867099b..fdd5996 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -789,7 +789,7 @@ int odf_lookup(struct dentry *parent, struct dentry
*dentry, int flags)
bstart = dbstart(dentry);
}
- if (lower_dentry && lower_dentry->d_inode &&
+ if (bstart != -1 && lower_dentry && lower_dentry->d_inode &&
lower_dentry->d_inode->i_nlink > 1 &&
!S_ISDIR(lower_dentry->d_inode->i_mode) &&
!(flags & ODF_LOOKUP_WH)) {
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs