2 * Copyright (C) 2011 Novell Inc.
3 * Copyright (C) 2016 Red Hat, Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
11 #include <linux/cred.h>
12 #include <linux/ctype.h>
13 #include <linux/namei.h>
14 #include <linux/xattr.h>
15 #include <linux/ratelimit.h>
16 #include <linux/mount.h>
17 #include <linux/exportfs.h>
18 #include "overlayfs.h"
20 struct ovl_lookup_data {
30 static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d,
31 size_t prelen, const char *post)
36 buf = ovl_get_redirect_xattr(dentry, prelen + strlen(post));
37 if (IS_ERR_OR_NULL(buf))
42 * One of the ancestor path elements in an absolute path
43 * lookup in ovl_lookup_layer() could have been opaque and
44 * that will stop further lookup in lower layers (d->stop=true)
45 * But we have found an absolute redirect in decendant path
46 * element and that should force continue lookup in lower
47 * layers (reset d->stop).
51 res = strlen(buf) + 1;
52 memmove(buf + prelen, buf, res);
53 memcpy(buf, d->name.name, prelen);
59 d->name.name = d->redirect;
60 d->name.len = strlen(d->redirect);
65 static int ovl_acceptable(void *ctx, struct dentry *dentry)
68 * A non-dir origin may be disconnected, which is fine, because
69 * we only need it for its unique inode number.
71 if (!d_is_dir(dentry))
74 /* Don't decode a deleted empty directory */
75 if (d_unhashed(dentry))
78 /* Check if directory belongs to the layer we are decoding from */
79 return is_subdir(dentry, ((struct vfsmount *)ctx)->mnt_root);
83 * Check validity of an overlay file handle buffer.
85 * Return 0 for a valid file handle.
86 * Return -ENODATA for "origin unknown".
87 * Return <0 for an invalid file handle.
89 int ovl_check_fh_len(struct ovl_fh *fh, int fh_len)
91 if (fh_len < sizeof(struct ovl_fh) || fh_len < fh->len)
94 if (fh->magic != OVL_FH_MAGIC)
97 /* Treat larger version and unknown flags as "origin unknown" */
98 if (fh->version > OVL_FH_VERSION || fh->flags & ~OVL_FH_FLAG_ALL)
101 /* Treat endianness mismatch as "origin unknown" */
102 if (!(fh->flags & OVL_FH_FLAG_ANY_ENDIAN) &&
103 (fh->flags & OVL_FH_FLAG_BIG_ENDIAN) != OVL_FH_FLAG_CPU_ENDIAN)
109 static struct ovl_fh *ovl_get_fh(struct dentry *dentry, const char *name)
112 struct ovl_fh *fh = NULL;
114 res = vfs_getxattr(dentry, name, NULL, 0);
116 if (res == -ENODATA || res == -EOPNOTSUPP)
120 /* Zero size value means "copied up but origin unknown" */
124 fh = kzalloc(res, GFP_KERNEL);
126 return ERR_PTR(-ENOMEM);
128 res = vfs_getxattr(dentry, name, fh, res);
132 err = ovl_check_fh_len(fh, res);
146 pr_warn_ratelimited("overlayfs: failed to get origin (%i)\n", res);
149 pr_warn_ratelimited("overlayfs: invalid origin (%*phN)\n", res, fh);
153 struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt,
160 * Make sure that the stored uuid matches the uuid of the lower
161 * layer where file handle will be decoded.
163 if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
166 bytes = (fh->len - offsetof(struct ovl_fh, fid));
167 real = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
168 bytes >> 2, (int)fh->type,
169 connected ? ovl_acceptable : NULL, mnt);
172 * Treat stale file handle to lower file as "origin unknown".
173 * upper file handle could become stale when upper file is
174 * unlinked and this information is needed to handle stale
175 * index entries correctly.
177 if (real == ERR_PTR(-ESTALE) &&
178 !(fh->flags & OVL_FH_FLAG_PATH_UPPER))
183 if (ovl_dentry_weird(real)) {
191 static bool ovl_is_opaquedir(struct dentry *dentry)
193 return ovl_check_dir_xattr(dentry, OVL_XATTR_OPAQUE);
196 static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
197 const char *name, unsigned int namelen,
198 size_t prelen, const char *post,
203 bool last_element = !post[0];
205 this = lookup_one_len_unlocked(name, base, namelen);
209 if (err == -ENOENT || err == -ENAMETOOLONG)
216 if (ovl_dentry_weird(this)) {
217 /* Don't support traversing automounts and other weirdness */
221 if (ovl_is_whiteout(this)) {
222 d->stop = d->opaque = true;
226 * This dentry should be a regular file if previous layer lookup
227 * found a metacopy dentry.
229 if (last_element && d->metacopy && !d_is_reg(this)) {
233 if (!d_can_lookup(this)) {
234 if (d->is_dir || !last_element) {
238 err = ovl_check_metacopy_xattr(this);
243 d->stop = !d->metacopy;
244 if (!d->metacopy || d->last)
252 if (ovl_is_opaquedir(this)) {
259 err = ovl_check_redirect(this, d, prelen, post);
276 static int ovl_lookup_layer(struct dentry *base, struct ovl_lookup_data *d,
279 /* Counting down from the end, since the prefix can change */
280 size_t rem = d->name.len - 1;
281 struct dentry *dentry = NULL;
284 if (d->name.name[0] != '/')
285 return ovl_lookup_single(base, d, d->name.name, d->name.len,
288 while (!IS_ERR_OR_NULL(base) && d_can_lookup(base)) {
289 const char *s = d->name.name + d->name.len - rem;
290 const char *next = strchrnul(s, '/');
291 size_t thislen = next - s;
294 /* Verify we did not go off the rails */
295 if (WARN_ON(s[-1] != '/'))
298 err = ovl_lookup_single(base, d, s, thislen,
299 d->name.len - rem, next, &base);
309 if (WARN_ON(rem >= d->name.len))
317 int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected,
318 struct dentry *upperdentry, struct ovl_path **stackp)
320 struct dentry *origin = NULL;
323 for (i = 0; i < ofs->numlower; i++) {
324 origin = ovl_decode_real_fh(fh, ofs->lower_layers[i].mnt,
332 else if (IS_ERR(origin))
333 return PTR_ERR(origin);
335 if (upperdentry && !ovl_is_whiteout(upperdentry) &&
336 ((d_inode(origin)->i_mode ^ d_inode(upperdentry)->i_mode) & S_IFMT))
340 *stackp = kmalloc(sizeof(struct ovl_path), GFP_KERNEL);
345 **stackp = (struct ovl_path){
347 .layer = &ofs->lower_layers[i]
353 pr_warn_ratelimited("overlayfs: invalid origin (%pd2, ftype=%x, origin ftype=%x).\n",
354 upperdentry, d_inode(upperdentry)->i_mode & S_IFMT,
355 d_inode(origin)->i_mode & S_IFMT);
360 static int ovl_check_origin(struct ovl_fs *ofs, struct dentry *upperdentry,
361 struct ovl_path **stackp, unsigned int *ctrp)
363 struct ovl_fh *fh = ovl_get_fh(upperdentry, OVL_XATTR_ORIGIN);
366 if (IS_ERR_OR_NULL(fh))
369 err = ovl_check_origin_fh(ofs, fh, false, upperdentry, stackp);
386 * Verify that @fh matches the file handle stored in xattr @name.
387 * Return 0 on match, -ESTALE on mismatch, < 0 on error.
389 static int ovl_verify_fh(struct dentry *dentry, const char *name,
390 const struct ovl_fh *fh)
392 struct ovl_fh *ofh = ovl_get_fh(dentry, name);
401 if (fh->len != ofh->len || memcmp(fh, ofh, fh->len))
409 * Verify that @real dentry matches the file handle stored in xattr @name.
411 * If @set is true and there is no stored file handle, encode @real and store
412 * file handle in xattr @name.
414 * Return 0 on match, -ESTALE on mismatch, -ENODATA on no xattr, < 0 on error.
416 int ovl_verify_set_fh(struct dentry *dentry, const char *name,
417 struct dentry *real, bool is_upper, bool set)
423 fh = ovl_encode_real_fh(real, is_upper);
430 err = ovl_verify_fh(dentry, name, fh);
431 if (set && err == -ENODATA)
432 err = ovl_do_setxattr(dentry, name, fh, fh->len, 0);
441 inode = d_inode(real);
442 pr_warn_ratelimited("overlayfs: failed to verify %s (%pd2, ino=%lu, err=%i)\n",
443 is_upper ? "upper" : "origin", real,
444 inode ? inode->i_ino : 0, err);
448 /* Get upper dentry from index */
449 struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
452 struct dentry *upper;
454 if (!d_is_dir(index))
457 fh = ovl_get_fh(index, OVL_XATTR_UPPER);
458 if (IS_ERR_OR_NULL(fh))
461 upper = ovl_decode_real_fh(fh, ofs->upper_mnt, true);
464 if (IS_ERR_OR_NULL(upper))
465 return upper ?: ERR_PTR(-ESTALE);
467 if (!d_is_dir(upper)) {
468 pr_warn_ratelimited("overlayfs: invalid index upper (%pd2, upper=%pd2).\n",
471 return ERR_PTR(-EIO);
477 /* Is this a leftover from create/whiteout of directory index entry? */
478 static bool ovl_is_temp_index(struct dentry *index)
480 return index->d_name.name[0] == '#';
484 * Verify that an index entry name matches the origin file handle stored in
485 * OVL_XATTR_ORIGIN and that origin file handle can be decoded to lower path.
486 * Return 0 on match, -ESTALE on mismatch or stale origin, < 0 on error.
488 int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
490 struct ovl_fh *fh = NULL;
492 struct ovl_path origin = { };
493 struct ovl_path *stack = &origin;
494 struct dentry *upper = NULL;
500 /* Cleanup leftover from index create/cleanup attempt */
502 if (ovl_is_temp_index(index))
506 if (index->d_name.len < sizeof(struct ovl_fh)*2)
510 len = index->d_name.len / 2;
511 fh = kzalloc(len, GFP_KERNEL);
516 if (hex2bin((u8 *)fh, index->d_name.name, len))
519 err = ovl_check_fh_len(fh, len);
524 * Whiteout index entries are used as an indication that an exported
525 * overlay file handle should be treated as stale (i.e. after unlink
526 * of the overlay inode). These entries contain no origin xattr.
528 if (ovl_is_whiteout(index))
532 * Verifying directory index entries are not stale is expensive, so
533 * only verify stale dir index if NFS export is enabled.
535 if (d_is_dir(index) && !ofs->config.nfs_export)
539 * Directory index entries should have 'upper' xattr pointing to the
540 * real upper dir. Non-dir index entries are hardlinks to the upper
541 * real inode. For non-dir index, we can read the copy up origin xattr
542 * directly from the index dentry, but for dir index we first need to
543 * decode the upper directory.
545 upper = ovl_index_upper(ofs, index);
546 if (IS_ERR_OR_NULL(upper)) {
547 err = PTR_ERR(upper);
549 * Directory index entries with no 'upper' xattr need to be
550 * removed. When dir index entry has a stale 'upper' xattr,
551 * we assume that upper dir was removed and we treat the dir
552 * index as orphan entry that needs to be whited out.
561 err = ovl_verify_fh(upper, OVL_XATTR_ORIGIN, fh);
566 /* Check if non-dir index is orphan and don't warn before cleaning it */
567 if (!d_is_dir(index) && d_inode(index)->i_nlink == 1) {
568 err = ovl_check_origin_fh(ofs, fh, false, index, &stack);
572 if (ovl_get_nlink(origin.dentry, index, 0) == 0)
582 pr_warn_ratelimited("overlayfs: failed to verify index (%pd2, ftype=%x, err=%i)\n",
583 index, d_inode(index)->i_mode & S_IFMT, err);
587 pr_warn_ratelimited("overlayfs: orphan index entry (%pd2, ftype=%x, nlink=%u)\n",
588 index, d_inode(index)->i_mode & S_IFMT,
589 d_inode(index)->i_nlink);
594 static int ovl_get_index_name_fh(struct ovl_fh *fh, struct qstr *name)
598 n = kcalloc(fh->len, 2, GFP_KERNEL);
602 s = bin2hex(n, fh, fh->len);
603 *name = (struct qstr) QSTR_INIT(n, s - n);
610 * Lookup in indexdir for the index entry of a lower real inode or a copy up
611 * origin inode. The index entry name is the hex representation of the lower
614 * If the index dentry in negative, then either no lower aliases have been
615 * copied up yet, or aliases have been copied up in older kernels and are
618 * If the index dentry for a copy up origin inode is positive, but points
619 * to an inode different than the upper inode, then either the upper inode
620 * has been copied up and not indexed or it was indexed, but since then
621 * index dir was cleared. Either way, that index cannot be used to indentify
624 int ovl_get_index_name(struct dentry *origin, struct qstr *name)
629 fh = ovl_encode_real_fh(origin, false);
633 err = ovl_get_index_name_fh(fh, name);
639 /* Lookup index by file handle for NFS export */
640 struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh)
642 struct dentry *index;
646 err = ovl_get_index_name_fh(fh, &name);
650 index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len);
653 if (PTR_ERR(index) == -ENOENT)
658 if (d_is_negative(index))
660 else if (ovl_is_whiteout(index))
662 else if (ovl_dentry_weird(index))
671 struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
672 struct dentry *origin, bool verify)
674 struct dentry *index;
677 bool is_dir = d_is_dir(origin);
680 err = ovl_get_index_name(origin, &name);
684 index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len);
686 err = PTR_ERR(index);
687 if (err == -ENOENT) {
691 pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%.*s, err=%i);\n"
692 "overlayfs: mount with '-o index=off' to disable inodes index.\n",
693 d_inode(origin)->i_ino, name.len, name.name,
698 inode = d_inode(index);
699 if (d_is_negative(index)) {
701 } else if (ovl_is_whiteout(index) && !verify) {
703 * When index lookup is called with !verify for decoding an
704 * overlay file handle, a whiteout index implies that decode
705 * should treat file handle as stale and no need to print a
709 index = ERR_PTR(-ESTALE);
711 } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) ||
712 ((inode->i_mode ^ d_inode(origin)->i_mode) & S_IFMT)) {
714 * Index should always be of the same file type as origin
715 * except for the case of a whiteout index. A whiteout
716 * index should only exist if all lower aliases have been
717 * unlinked, which means that finding a lower origin on lookup
718 * whose index is a whiteout should be treated as an error.
720 pr_warn_ratelimited("overlayfs: bad index found (index=%pd2, ftype=%x, origin ftype=%x).\n",
721 index, d_inode(index)->i_mode & S_IFMT,
722 d_inode(origin)->i_mode & S_IFMT);
724 } else if (is_dir && verify) {
726 pr_warn_ratelimited("overlayfs: suspected uncovered redirected dir found (origin=%pd2, index=%pd2).\n",
731 /* Verify that dir index 'upper' xattr points to upper dir */
732 err = ovl_verify_upper(index, upper, false);
734 if (err == -ESTALE) {
735 pr_warn_ratelimited("overlayfs: suspected multiply redirected dir found (upper=%pd2, origin=%pd2, index=%pd2).\n",
736 upper, origin, index);
740 } else if (upper && d_inode(upper) != inode) {
754 index = ERR_PTR(-EIO);
759 * Returns next layer in stack starting from top.
760 * Returns -1 if this is the last layer.
762 int ovl_path_next(int idx, struct dentry *dentry, struct path *path)
764 struct ovl_entry *oe = dentry->d_fsdata;
768 ovl_path_upper(dentry, path);
770 return oe->numlower ? 1 : -1;
773 BUG_ON(idx > oe->numlower);
774 path->dentry = oe->lowerstack[idx - 1].dentry;
775 path->mnt = oe->lowerstack[idx - 1].layer->mnt;
777 return (idx < oe->numlower) ? idx + 1 : -1;
780 /* Fix missing 'origin' xattr */
781 static int ovl_fix_origin(struct dentry *dentry, struct dentry *lower,
782 struct dentry *upper)
786 if (ovl_check_origin_xattr(upper))
789 err = ovl_want_write(dentry);
793 err = ovl_set_origin(dentry, lower, upper);
795 err = ovl_set_impure(dentry->d_parent, upper->d_parent);
797 ovl_drop_write(dentry);
801 struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
804 struct ovl_entry *oe;
805 const struct cred *old_cred;
806 struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
807 struct ovl_entry *poe = dentry->d_parent->d_fsdata;
808 struct ovl_entry *roe = dentry->d_sb->s_root->d_fsdata;
809 struct ovl_path *stack = NULL, *origin_path = NULL;
810 struct dentry *upperdir, *upperdentry = NULL;
811 struct dentry *origin = NULL;
812 struct dentry *index = NULL;
813 unsigned int ctr = 0;
814 struct inode *inode = NULL;
815 bool upperopaque = false;
816 char *upperredirect = NULL;
820 bool metacopy = false;
821 struct ovl_lookup_data d = {
822 .name = dentry->d_name,
826 .last = ofs->config.redirect_follow ? false : !poe->numlower,
831 if (dentry->d_name.len > ofs->namelen)
832 return ERR_PTR(-ENAMETOOLONG);
834 old_cred = ovl_override_creds(dentry->d_sb);
835 upperdir = ovl_dentry_upper(dentry->d_parent);
837 err = ovl_lookup_layer(upperdir, &d, &upperdentry);
841 if (upperdentry && unlikely(ovl_dentry_remote(upperdentry))) {
846 if (upperdentry && !d.is_dir) {
847 unsigned int origin_ctr = 0;
850 * Lookup copy up origin by decoding origin file handle.
851 * We may get a disconnected dentry, which is fine,
852 * because we only need to hold the origin inode in
853 * cache and use its inode number. We may even get a
854 * connected dentry, that is not under any of the lower
855 * layers root. That is also fine for using it's inode
856 * number - it's the same as if we held a reference
857 * to a dentry in lower layer that was moved under us.
859 err = ovl_check_origin(ofs, upperdentry, &origin_path,
870 upperredirect = kstrdup(d.redirect, GFP_KERNEL);
873 if (d.redirect[0] == '/')
876 upperopaque = d.opaque;
879 if (!d.stop && poe->numlower) {
881 stack = kcalloc(ofs->numlower, sizeof(struct ovl_path),
887 for (i = 0; !d.stop && i < poe->numlower; i++) {
888 struct ovl_path lower = poe->lowerstack[i];
890 if (!ofs->config.redirect_follow)
891 d.last = i == poe->numlower - 1;
893 d.last = lower.layer->idx == roe->numlower;
895 err = ovl_lookup_layer(lower.dentry, &d, &this);
903 * If no origin fh is stored in upper of a merge dir, store fh
904 * of lower dir and set upper parent "impure".
906 if (upperdentry && !ctr && !ofs->noxattr && d.is_dir) {
907 err = ovl_fix_origin(dentry, this, upperdentry);
915 * When "verify_lower" feature is enabled, do not merge with a
916 * lower dir that does not match a stored origin xattr. In any
917 * case, only verified origin is used for index lookup.
919 * For non-dir dentry, if index=on, then ensure origin
920 * matches the dentry found using path based lookup,
921 * otherwise error out.
923 if (upperdentry && !ctr &&
924 ((d.is_dir && ovl_verify_lower(dentry->d_sb)) ||
925 (!d.is_dir && ofs->config.index && origin_path))) {
926 err = ovl_verify_origin(upperdentry, this, false);
939 * Do not store intermediate metacopy dentries in chain,
940 * except top most lower metacopy dentry
942 if (d.metacopy && ctr) {
947 stack[ctr].dentry = this;
948 stack[ctr].layer = lower.layer;
952 * Following redirects can have security consequences: it's like
953 * a symlink into the lower layer without the permission checks.
954 * This is only a problem if the upper layer is untrusted (e.g
955 * comes from an USB drive). This can allow a non-readable file
956 * or directory to become readable.
958 * Only following redirects when redirects are enabled disables
959 * this attack vector when not necessary.
962 if (d.redirect && !ofs->config.redirect_follow) {
963 pr_warn_ratelimited("overlayfs: refusing to follow redirect for (%pd2)\n",
971 if (d.redirect && d.redirect[0] == '/' && poe != roe) {
973 /* Find the current layer on the root dentry */
974 i = lower.layer->idx - 1;
980 * Found a metacopy dentry but did not find corresponding
989 if (!ofs->config.metacopy) {
990 pr_warn_ratelimited("overlay: refusing to follow metacopy origin for (%pd2)\n",
994 } else if (!d.is_dir && upperdentry && !ctr && origin_path) {
995 if (WARN_ON(stack != NULL)) {
1005 * Lookup index by lower inode and verify it matches upper inode.
1006 * We only trust dir index if we verified that lower dir matches
1007 * origin, otherwise dir index entries may be inconsistent and we
1010 * For non-dir upper metacopy dentry, we already set "origin" if we
1011 * verified that lower matched upper origin. If upper origin was
1012 * not present (because lower layer did not support fh encode/decode),
1013 * or indexing is not enabled, do not set "origin" and skip looking up
1014 * index. This case should be handled in same way as a non-dir upper
1015 * without ORIGIN is handled.
1017 * Always lookup index of non-dir non-metacopy and non-upper.
1019 if (ctr && (!upperdentry || (!d.is_dir && !metacopy)))
1020 origin = stack[0].dentry;
1022 if (origin && ovl_indexdir(dentry->d_sb) &&
1023 (!d.is_dir || ovl_index_all(dentry->d_sb))) {
1024 index = ovl_lookup_index(ofs, upperdentry, origin, true);
1025 if (IS_ERR(index)) {
1026 err = PTR_ERR(index);
1032 oe = ovl_alloc_entry(ctr);
1037 memcpy(oe->lowerstack, stack, sizeof(struct ovl_path) * ctr);
1038 dentry->d_fsdata = oe;
1041 ovl_dentry_set_opaque(dentry);
1044 ovl_dentry_set_upper_alias(dentry);
1046 upperdentry = dget(index);
1047 upperredirect = ovl_get_redirect_xattr(upperdentry, 0);
1048 if (IS_ERR(upperredirect)) {
1049 err = PTR_ERR(upperredirect);
1050 upperredirect = NULL;
1055 if (upperdentry || ctr) {
1056 struct ovl_inode_params oip = {
1057 .upperdentry = upperdentry,
1061 .redirect = upperredirect,
1062 .lowerdata = (ctr > 1 && !d.is_dir) ?
1063 stack[ctr - 1].dentry : NULL,
1066 inode = ovl_get_inode(dentry->d_sb, &oip);
1067 err = PTR_ERR(inode);
1072 revert_creds(old_cred);
1074 dput(origin_path->dentry);
1080 return d_splice_alias(inode, dentry);
1083 dentry->d_fsdata = NULL;
1087 for (i = 0; i < ctr; i++)
1088 dput(stack[i].dentry);
1092 dput(origin_path->dentry);
1096 kfree(upperredirect);
1099 revert_creds(old_cred);
1100 return ERR_PTR(err);
1103 bool ovl_lower_positive(struct dentry *dentry)
1105 struct ovl_entry *poe = dentry->d_parent->d_fsdata;
1106 const struct qstr *name = &dentry->d_name;
1107 const struct cred *old_cred;
1109 bool positive = false;
1113 * If dentry is negative, then lower is positive iff this is a
1116 if (!dentry->d_inode)
1117 return ovl_dentry_is_opaque(dentry);
1119 /* Negative upper -> positive lower */
1120 if (!ovl_dentry_upper(dentry))
1123 old_cred = ovl_override_creds(dentry->d_sb);
1124 /* Positive upper -> have to look up lower to see whether it exists */
1125 for (i = 0; !done && !positive && i < poe->numlower; i++) {
1126 struct dentry *this;
1127 struct dentry *lowerdir = poe->lowerstack[i].dentry;
1129 this = lookup_one_len_unlocked(name->name, lowerdir,
1132 switch (PTR_ERR(this)) {
1139 * Assume something is there, we just couldn't
1146 if (this->d_inode) {
1147 positive = !ovl_is_whiteout(this);
1153 revert_creds(old_cred);