On Mon, Apr 17, 2017 at 02:59:33AM +0300, Amir Goldstein wrote: [..] > @@ -272,6 +385,33 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, > goto out_put_upper; > } > > + /* Try to lookup lower layers by file handle (at root) */ > + d.by_path = false; > + for (i = 0; !d.stop && d.fh && i < roe->numlower; i++) { > + struct path lowerpath = roe->lowerstack[i]; > + > + d.last = i == roe->numlower - 1; > + err = ovl_lookup_layer_fh(&lowerpath, &d, &this); > + if (err) > + goto out_put; > + > + if (!this) > + continue; > + > + stack[ctr].dentry = this; > + stack[ctr].mnt = lowerpath.mnt; > + ctr++; > + } > + > + /* Fallback to lookup lower layers by name (at parent) */ > + if (ctr) { > + d.stop = true; Hi Amir, Got a very basic question. So say I two lower layers and a directory is in present in both, say lower1/dir1 and lower2/dir1. Now this directory gets copied up to upper/dir1. Assume lower1/dir1 is being copied up. So upper/dir1 will save file handle of lower1/dir1 right? This file handle does not represent lower2/dir1? IOW, later when I am doing lookup, then using file handle I will find dentry of lower1/dir1 but not lower2/dir1. And looks like we will not path based lookup as ctr will be non-zero (as we found one dentry in one path). What am I missing. (This ovl_lookup() logic has become really twisted now. I wished it was little easier to read.) Vivek