Skip to content

Commit 266ab6d

Browse files
fs/ntfs3: update mode in xattr when ACL can be reduced to mode
If a file's ACL can be reduced to standard mode bits, update mode accordingly, persist the change, and update the cached ACL. This keeps mode and ACL consistent and avoids redundant xattrs. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent d8e1e0d commit 266ab6d

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

fs/ntfs3/xattr.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,22 @@ static noinline int ntfs_set_acl_ex(struct mnt_idmap *idmap,
654654
err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0, NULL);
655655
if (err == -ENODATA && !size)
656656
err = 0; /* Removing non existed xattr. */
657-
if (!err) {
658-
set_cached_acl(inode, type, acl);
657+
if (err)
658+
goto out;
659+
660+
if (inode->i_mode != mode) {
661+
umode_t old_mode = inode->i_mode;
662+
inode->i_mode = mode;
663+
err = ntfs_save_wsl_perm(inode, NULL);
664+
if (err) {
665+
inode->i_mode = old_mode;
666+
goto out;
667+
}
659668
inode->i_mode = mode;
660-
inode_set_ctime_current(inode);
661-
mark_inode_dirty(inode);
662669
}
670+
set_cached_acl(inode, type, acl);
671+
inode_set_ctime_current(inode);
672+
mark_inode_dirty(inode);
663673

664674
out:
665675
kfree(value);

0 commit comments

Comments
 (0)