fs/ntfs/ea.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
From: Baolin Liu <liubaolin@kylinos.cn>
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: fc053f05ca28 ("ntfs: add reparse and ea operations")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
fs/ntfs/ea.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs/ea.c b/fs/ntfs/ea.c
index 0cd192752b7c..47ff40aa8e0f 100644
--- a/fs/ntfs/ea.c
+++ b/fs/ntfs/ea.c
@@ -768,8 +768,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;
}
--
2.51.0
On Tue, Aug 18, 2026 at 5:28 PM Baolin Liu <liubaolin12138@163.com> wrote:
>
> From: Baolin Liu <liubaolin@kylinos.cn>
>
> 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: fc053f05ca28 ("ntfs: add reparse and ea operations")
> Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Applied it to #ntfs-next.
Thanks!
Hi Baolin,
2026년 8월 18일 (화) 오후 5:28, Baolin Liu <liubaolin12138@163.com>님이 작성:
>
> From: Baolin Liu <liubaolin@kylinos.cn>
>
> 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: fc053f05ca28 ("ntfs: add reparse and ea operations")
> Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
--
Thanks,
Hyunchul
© 2016 - 2026 Red Hat, Inc.