Lines Matching +full:a +full:- +full:facing
1 // SPDX-License-Identifier: GPL-2.0+
30 /* Look for an entry in a parent pointing to this inode. */
40 /* Look for a single entry in a directory pointing to an inode. */
54 if (spc->ino == ino) in xchk_parent_actor()
55 spc->nlink++; in xchk_parent_actor()
58 * If we're facing a fatal signal, bail out. Store the cancellation in xchk_parent_actor()
62 if (xchk_should_terminate(spc->sc, &error)) in xchk_parent_actor()
63 spc->cancelled = true; in xchk_parent_actor()
77 .ino = sc->ip->i_ino, in xchk_parent_count_parent_dentries()
86 * If there are any blocks, read-ahead block 0 as we're almost in xchk_parent_count_parent_dentries()
87 * certain to have the next operation be a read there. This is in xchk_parent_count_parent_dentries()
92 if (parent->i_df.if_nextents > 0) in xchk_parent_count_parent_dentries()
104 parent->i_disk_size); in xchk_parent_count_parent_dentries()
107 error = xfs_readdir(sc->tp, parent, &spc.dc, bufsize); in xchk_parent_count_parent_dentries()
111 error = -EAGAIN; in xchk_parent_count_parent_dentries()
134 struct xfs_mount *mp = sc->mp; in xchk_parent_validate()
142 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_parent_validate()
146 if (sc->ip->i_ino == dnum) { in xchk_parent_validate()
152 * If we're an unlinked directory, the parent /won't/ have a link in xchk_parent_validate()
155 expected_nlink = VFS_I(sc->ip)->i_nlink == 0 ? 0 : 1; in xchk_parent_validate()
159 * cancel the scrub transaction. Since we're don't know a in xchk_parent_validate()
161 * cleanup (which allocates what would be a nested transaction) in xchk_parent_validate()
162 * if the parent pointer erroneously points to a file, we in xchk_parent_validate()
166 * If _iget returns -EINVAL or -ENOENT then the parent inode number is in xchk_parent_validate()
168 * -EFSCORRUPTED or -EFSBADCRC then the parent is corrupt which is a in xchk_parent_validate()
171 error = xfs_iget(mp, sc->tp, dnum, XFS_IGET_UNTRUSTED, 0, &dp); in xchk_parent_validate()
172 if (error == -EINVAL || error == -ENOENT) { in xchk_parent_validate()
173 error = -EFSCORRUPTED; in xchk_parent_validate()
179 if (dp == sc->ip || !S_ISDIR(VFS_I(dp)->i_mode)) { in xchk_parent_validate()
186 * its alleged parent for a forward reference. If we can grab in xchk_parent_validate()
207 xfs_iunlock(sc->ip, sc->ilock_flags); in xchk_parent_validate()
208 sc->ilock_flags = 0; in xchk_parent_validate()
220 error = xchk_ilock_inverted(sc->ip, XFS_IOLOCK_EXCL); in xchk_parent_validate()
223 sc->ilock_flags = XFS_IOLOCK_EXCL; in xchk_parent_validate()
226 * If we're an unlinked directory, the parent /won't/ have a link in xchk_parent_validate()
227 * to us. Otherwise, it should have one link. We have to re-set in xchk_parent_validate()
228 * it here because we dropped the lock on sc->ip. in xchk_parent_validate()
230 expected_nlink = VFS_I(sc->ip)->i_nlink == 0 ? 0 : 1; in xchk_parent_validate()
233 error = xfs_dir_lookup(sc->tp, sc->ip, &xfs_name_dotdot, &dnum, NULL); in xchk_parent_validate()
238 if (dnum != dp->i_ino) { in xchk_parent_validate()
261 /* Scrub a parent pointer. */
266 struct xfs_mount *mp = sc->mp; in xchk_parent()
273 * If we're a directory, check that the '..' link points up to in xchk_parent()
274 * a directory that has one entry pointing to us. in xchk_parent()
276 if (!S_ISDIR(VFS_I(sc->ip)->i_mode)) in xchk_parent()
277 return -ENOENT; in xchk_parent()
279 /* We're not a special inode, are we? */ in xchk_parent()
280 if (!xfs_verify_dir_ino(mp, sc->ip->i_ino)) { in xchk_parent()
286 * The VFS grabs a read or write lock via i_rwsem before it reads in xchk_parent()
287 * or writes to a directory. If we've gotten this far we've in xchk_parent()
289 * getting a write lock on i_rwsem. Therefore, it is safe for us in xchk_parent()
292 sc->ilock_flags &= ~(XFS_ILOCK_EXCL | XFS_MMAPLOCK_EXCL); in xchk_parent()
293 xfs_iunlock(sc->ip, XFS_ILOCK_EXCL | XFS_MMAPLOCK_EXCL); in xchk_parent()
296 error = xfs_dir_lookup(sc->tp, sc->ip, &xfs_name_dotdot, &dnum, NULL); in xchk_parent()
305 if (sc->ip == mp->m_rootip) { in xchk_parent()
306 if (sc->ip->i_ino != mp->m_sb.sb_rootino || in xchk_parent()
307 sc->ip->i_ino != dnum) in xchk_parent()
326 * If we failed to lock the parent inode even after a retry, just mark in xchk_parent()
329 if ((sc->flags & XCHK_TRY_HARDER) && error == -EDEADLOCK) { in xchk_parent()