Lines Matching refs:index

175 		 * index entries correctly.
478 /* Get upper dentry from index */
479 struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
484 if (!d_is_dir(index))
485 return dget(index);
487 fh = ovl_get_fh(ofs, index, OVL_XATTR_UPPER);
498 pr_warn_ratelimited("invalid index upper (%pd2, upper=%pd2).\n",
499 index, upper);
508 * Verify that an index entry name matches the origin file handle stored in
512 int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
521 if (!d_inode(index))
525 if (index->d_name.len < sizeof(struct ovl_fb)*2)
529 len = index->d_name.len / 2;
535 if (hex2bin(fh->buf, index->d_name.name, len))
543 * Whiteout index entries are used as an indication that an exported
547 if (ovl_is_whiteout(index))
551 * Verifying directory index entries are not stale is expensive, so
552 * only verify stale dir index if NFS export is enabled.
554 if (d_is_dir(index) && !ofs->config.nfs_export)
558 * Directory index entries should have 'upper' xattr pointing to the
559 * real upper dir. Non-dir index entries are hardlinks to the upper
560 * real inode. For non-dir index, we can read the copy up origin xattr
561 * directly from the index dentry, but for dir index we first need to
564 upper = ovl_index_upper(ofs, index);
568 * Directory index entries with no 'upper' xattr need to be
569 * removed. When dir index entry has a stale 'upper' xattr,
571 * index as orphan entry that needs to be whited out.
585 /* Check if non-dir index is orphan and don't warn before cleaning it */
586 if (!d_is_dir(index) && d_inode(index)->i_nlink == 1) {
587 err = ovl_check_origin_fh(ofs, fh, false, index, &stack);
591 if (ovl_get_nlink(ofs, origin.dentry, index, 0) == 0)
601 pr_warn_ratelimited("failed to verify index (%pd2, ftype=%x, err=%i)\n",
602 index, d_inode(index)->i_mode & S_IFMT, err);
606 pr_warn_ratelimited("orphan index entry (%pd2, ftype=%x, nlink=%u)\n",
607 index, d_inode(index)->i_mode & S_IFMT,
608 d_inode(index)->i_nlink);
629 * Lookup in indexdir for the index entry of a lower real inode or a copy up
630 * origin inode. The index entry name is the hex representation of the lower
633 * If the index dentry in negative, then either no lower aliases have been
637 * If the index dentry for a copy up origin inode is positive, but points
640 * index dir was cleared. Either way, that index cannot be used to indentify
658 /* Lookup index by file handle for NFS export */
661 struct dentry *index;
669 index = lookup_positive_unlocked(name.name, ofs->indexdir, name.len);
671 if (IS_ERR(index)) {
672 if (PTR_ERR(index) == -ENOENT)
673 index = NULL;
674 return index;
677 if (ovl_is_whiteout(index))
679 else if (ovl_dentry_weird(index))
682 return index;
684 dput(index);
691 struct dentry *index;
701 index = lookup_positive_unlocked(name.name, ofs->indexdir, name.len);
702 if (IS_ERR(index)) {
703 err = PTR_ERR(index);
705 index = NULL;
708 pr_warn_ratelimited("failed inode index lookup (ino=%lu, key=%.*s, err=%i);\n"
709 "overlayfs: mount with '-o index=off' to disable inodes index.\n",
715 inode = d_inode(index);
716 if (ovl_is_whiteout(index) && !verify) {
718 * When index lookup is called with !verify for decoding an
719 * overlay file handle, a whiteout index implies that decode
723 dput(index);
724 index = ERR_PTR(-ESTALE);
726 } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) ||
730 * except for the case of a whiteout index. A whiteout
731 * index should only exist if all lower aliases have been
733 * whose index is a whiteout should be treated as an error.
735 pr_warn_ratelimited("bad index found (index=%pd2, ftype=%x, origin ftype=%x).\n",
736 index, d_inode(index)->i_mode & S_IFMT,
741 pr_warn_ratelimited("suspected uncovered redirected dir found (origin=%pd2, index=%pd2).\n",
742 origin, index);
746 /* Verify that dir index 'upper' xattr points to upper dir */
747 err = ovl_verify_upper(ofs, index, upper, false);
750 pr_warn_ratelimited("suspected multiply redirected dir found (upper=%pd2, origin=%pd2, index=%pd2).\n",
751 upper, origin, index);
760 return index;
763 dput(index);
764 index = NULL;
768 dput(index);
769 index = ERR_PTR(-EIO);
827 struct dentry *index = NULL;
937 * case, only verified origin is used for index lookup.
939 * For non-dir dentry, if index=on, then ensure origin
945 (!d.is_dir && ofs->config.index && origin_path))) {
1023 * Always lookup index if there is no-upperdentry.
1028 * For directories, lookup index by lower inode and verify it matches
1029 * upper inode. We only trust dir index if we verified that lower dir
1030 * matches origin, otherwise dir index entries may be inconsistent
1037 * For metacopy upper, we set a verified origin already if index
1046 index = ovl_lookup_index(ofs, upperdentry, origin, true);
1047 if (IS_ERR(index)) {
1048 err = PTR_ERR(index);
1049 index = NULL;
1067 else if (index) {
1068 upperdentry = dget(index);
1085 .index = index,
1107 dput(index);
1116 dput(index);