[PATCH v1 v1] ntfs: do not update ctime when setxattr fails
Baolin Liu <[email protected]>
| Newsgroups | org.kernel.vger.linux-fsdevel,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 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 <[email protected]> --- 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