ntfs: do not update ctime when setxattr fails

ntfs_setxattr() updates ctime and marks the inode dirty even when
the operation fails. A failed setxattr(2) must not change file
metadata.

Update ctime only on success.

Fixes: fc053f05ca ("ntfs: add reparse and ea operations")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Baolin Liu 2026-08-18 16:27:40 +08:00 committed by Namjae Jeon
parent cc9d09fef7
commit 60038154b4

View File

@ -881,8 +881,10 @@ static int ntfs_setxattr(const struct xattr_handler *handler,
mutex_unlock(&ni->mrec_lock);
out:
inode_set_ctime_current(inode);
mark_inode_dirty(inode);
if (!err) {
inode_set_ctime_current(inode);
mark_inode_dirty(inode);
}
return err;
}