Skip to content

Commit

Permalink
fs/ntfs3: Stale inode instead of bad
Browse files Browse the repository at this point in the history
Fixed the logic of processing inode with wrong sequence number.

Signed-off-by: Konstantin Komarov <[email protected]>
  • Loading branch information
aalexandrovich committed Sep 3, 2024
1 parent 56c16d5 commit 1fd2191
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs/ntfs3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1fd2191

Please sign in to comment.