]> www.infradead.org Git - users/willy/linux.git/commitdiff
fs/ntfs3: Stale inode instead of bad
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Thu, 22 Aug 2024 11:43:32 +0000 (14:43 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 3 Sep 2024 13:58:42 +0000 (16:58 +0300)
Fixed the logic of processing inode with wrong sequence number.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/inode.c

index 6b0bdc474e763f2361118d47dc372aa43549eef7..56b6c4c6f528fe8b182309df94ba2602298a7002 100644 (file)
@@ -536,11 +536,15 @@ struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref,
        if (inode->i_state & I_NEW)
                inode = ntfs_read_mft(inode, name, ref);
        else if (ref->seq != ntfs_i(inode)->mi.mrec->seq) {
-               /* Inode overlaps? */
-               _ntfs_bad_inode(inode);
+               /*
+                * Sequence number is not expected.
+                * Looks like inode was reused but caller uses the old reference
+                */
+               iput(inode);
+               inode = ERR_PTR(-ESTALE);
        }
 
-       if (IS_ERR(inode) && name)
+       if (IS_ERR(inode))
                ntfs_set_state(sb->s_fs_info, NTFS_DIRTY_ERROR);
 
        return inode;