Unverified Commit 266ab6d0 authored by Konstantin Komarov's avatar Konstantin Komarov
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: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent d8e1e0d3
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -654,12 +654,22 @@ static noinline int ntfs_set_acl_ex(struct mnt_idmap *idmap,
	err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0, NULL);
	if (err == -ENODATA && !size)
		err = 0; /* Removing non existed xattr. */
	if (!err) {
		set_cached_acl(inode, type, acl);
	if (err)
		goto out;

	if (inode->i_mode != mode) {
		umode_t old_mode = inode->i_mode;
		inode->i_mode = mode;
		err = ntfs_save_wsl_perm(inode, NULL);
		if (err) {
			inode->i_mode = old_mode;
			goto out;
		}
		inode->i_mode = mode;
	}
	set_cached_acl(inode, type, acl);
	inode_set_ctime_current(inode);
	mark_inode_dirty(inode);
	}

out:
	kfree(value);