Commit 460bbf29 authored by Konstantin Komarov's avatar Konstantin Komarov

fs/ntfs3: Do not change mode if ntfs_set_ea failed

ntfs_set_ea can fail with NOSPC, so we don't need to
change mode in this situation.
Fixes xfstest generic/449
Fixes: be71b5cb ("fs/ntfs3: Add attrib operations")
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 604a9d27
...@@ -547,28 +547,23 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, ...@@ -547,28 +547,23 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
{ {
const char *name; const char *name;
size_t size, name_len; size_t size, name_len;
void *value = NULL; void *value;
int err = 0; int err;
int flags; int flags;
umode_t mode;
if (S_ISLNK(inode->i_mode)) if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP; return -EOPNOTSUPP;
mode = inode->i_mode;
switch (type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
/* Do not change i_mode if we are in init_acl */ /* Do not change i_mode if we are in init_acl */
if (acl && !init_acl) { if (acl && !init_acl) {
umode_t mode;
err = posix_acl_update_mode(mnt_userns, inode, &mode, err = posix_acl_update_mode(mnt_userns, inode, &mode,
&acl); &acl);
if (err) if (err)
goto out; goto out;
if (inode->i_mode != mode) {
inode->i_mode = mode;
mark_inode_dirty(inode);
}
} }
name = XATTR_NAME_POSIX_ACL_ACCESS; name = XATTR_NAME_POSIX_ACL_ACCESS;
name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1; name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
...@@ -604,8 +599,13 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, ...@@ -604,8 +599,13 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0); err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
if (err == -ENODATA && !size) if (err == -ENODATA && !size)
err = 0; /* Removing non existed xattr. */ err = 0; /* Removing non existed xattr. */
if (!err) if (!err) {
set_cached_acl(inode, type, acl); set_cached_acl(inode, type, acl);
if (inode->i_mode != mode) {
inode->i_mode = mode;
mark_inode_dirty(inode);
}
}
out: out:
kfree(value); kfree(value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment