[PATCH] fs/ntfs3: update ctime only on successful setxattr
Baolin Liu <[email protected]> Fri, 26 Jun 2026 17:49:14 +0800
| Newsgroups | dev.linux.lists.ntfs3,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Baolin Liu <[email protected]> ntfs_setxattr() updates ctime and marks the inode dirty even when the xattr operation fails. Do that only on success. Fixes: 2d44667c306e ("fs/ntfs3: Update i_ctime when xattr is added") Signed-off-by: Baolin Liu <[email protected]> --- fs/ntfs3/xattr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 9eeac0ab2b71..9743a63a152e 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -960,8 +960,10 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler, NULL); 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