inode.c (7fc51f923ea6b1c6f304789965414149eaedb358) inode.c (5cd740287ae5e3f9d1c46f5bfe8778972fd6d3fe)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/inode.c
4 *
5 * Copyright (C) 1992, 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 4858 unchanged lines hidden (view full) ---

4867 ei = EXT4_I(inode);
4868 iloc.bh = NULL;
4869
4870 ret = __ext4_get_inode_loc_noinmem(inode, &iloc);
4871 if (ret < 0)
4872 goto bad_inode;
4873 raw_inode = ext4_raw_inode(&iloc);
4874
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/inode.c
4 *
5 * Copyright (C) 1992, 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 4858 unchanged lines hidden (view full) ---

4867 ei = EXT4_I(inode);
4868 iloc.bh = NULL;
4869
4870 ret = __ext4_get_inode_loc_noinmem(inode, &iloc);
4871 if (ret < 0)
4872 goto bad_inode;
4873 raw_inode = ext4_raw_inode(&iloc);
4874
4875 if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) {
4876 ext4_error_inode(inode, function, line, 0,
4877 "iget: root inode unallocated");
4878 ret = -EFSCORRUPTED;
4879 goto bad_inode;
4880 }
4881
4882 if ((flags & EXT4_IGET_HANDLE) &&
4883 (raw_inode->i_links_count == 0) && (raw_inode->i_mode == 0)) {
4884 ret = -ESTALE;
4885 goto bad_inode;
4886 }
4887
4888 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
4889 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);

--- 56 unchanged lines hidden (view full) ---

4946 ei->i_dir_start_lookup = 0;
4947 ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
4948 /* We now have enough fields to check if the inode was active or not.
4949 * This is needed because nfsd might try to access dead inodes
4950 * the test is that same one that e2fsck uses
4951 * NeilBrown 1999oct15
4952 */
4953 if (inode->i_nlink == 0) {
4875 if ((flags & EXT4_IGET_HANDLE) &&
4876 (raw_inode->i_links_count == 0) && (raw_inode->i_mode == 0)) {
4877 ret = -ESTALE;
4878 goto bad_inode;
4879 }
4880
4881 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
4882 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);

--- 56 unchanged lines hidden (view full) ---

4939 ei->i_dir_start_lookup = 0;
4940 ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
4941 /* We now have enough fields to check if the inode was active or not.
4942 * This is needed because nfsd might try to access dead inodes
4943 * the test is that same one that e2fsck uses
4944 * NeilBrown 1999oct15
4945 */
4946 if (inode->i_nlink == 0) {
4954 if ((inode->i_mode == 0 ||
4947 if ((inode->i_mode == 0 || flags & EXT4_IGET_SPECIAL ||
4955 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) &&
4956 ino != EXT4_BOOT_LOADER_INO) {
4948 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) &&
4949 ino != EXT4_BOOT_LOADER_INO) {
4957 /* this inode is deleted */
4958 ret = -ESTALE;
4950 /* this inode is deleted or unallocated */
4951 if (flags & EXT4_IGET_SPECIAL) {
4952 ext4_error_inode(inode, function, line, 0,
4953 "iget: special inode unallocated");
4954 ret = -EFSCORRUPTED;
4955 } else
4956 ret = -ESTALE;
4959 goto bad_inode;
4960 }
4961 /* The only unlinked inodes we let through here have
4962 * valid i_mode and are being read by the orphan
4963 * recovery code: that's fine, we're about to complete
4964 * the process of deleting those.
4965 * OR it is the EXT4_BOOT_LOADER_INO which is
4966 * not initialized on a new filesystem. */

--- 1386 unchanged lines hidden ---
4957 goto bad_inode;
4958 }
4959 /* The only unlinked inodes we let through here have
4960 * valid i_mode and are being read by the orphan
4961 * recovery code: that's fine, we're about to complete
4962 * the process of deleting those.
4963 * OR it is the EXT4_BOOT_LOADER_INO which is
4964 * not initialized on a new filesystem. */

--- 1386 unchanged lines hidden ---