ntfs: return errors from inode initialization

ntfs_iget() previously converted only -ENOMEM from
ntfs_read_locked_inode() into an ERR_PTR(). Other initialization errors
left the inode on the normal return path after it had been unlocked.

Return every non-zero initialization error after releasing the inode
reference.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Hyunchul Lee 2026-08-21 14:00:55 +09:00 committed by Namjae Jeon
parent 760c9d271d
commit d7aa04984f

View File

@ -173,10 +173,11 @@ struct inode *ntfs_iget(struct super_block *sb, u64 mft_no)
unlock_new_inode(vi);
}
/*
* There is no point in keeping bad inodes around if the failure was
* due to ENOMEM. We want to be able to retry again later.
* There is no point in keeping bad inodes around. This also
* simplifies things in that we never need to check for bad inodes
* elsewhere.
*/
if (unlikely(err == -ENOMEM)) {
if (unlikely(err)) {
iput(vi);
vi = ERR_PTR(err);
}