|
|
@@ -790,6 +790,18 @@ xfs_ialloc(
|
|
|
}
|
|
|
ASSERT(*ialloc_context == NULL);
|
|
|
|
|
|
+ /*
|
|
|
+ * Protect against obviously corrupt allocation btree records. Later
|
|
|
+ * xfs_iget checks will catch re-allocation of other active in-memory
|
|
|
+ * and on-disk inodes. If we don't catch reallocating the parent inode
|
|
|
+ * here we will deadlock in xfs_iget() so we have to do these checks
|
|
|
+ * first.
|
|
|
+ */
|
|
|
+ if ((pip && ino == pip->i_ino) || !xfs_verify_dir_ino(mp, ino)) {
|
|
|
+ xfs_alert(mp, "Allocated a known in-use inode 0x%llx!", ino);
|
|
|
+ return -EFSCORRUPTED;
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* Get the in-core inode with the lock held exclusively.
|
|
|
* This is because we're setting fields here we need
|