summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/ext2/acl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 069c0dceda01..51f0aea70cb4 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -218,15 +218,22 @@ int
ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int error;
+ int update_mode = 0;
+ umode_t mode = inode->i_mode;
if (type == ACL_TYPE_ACCESS && acl) {
- error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+ error = posix_acl_update_mode(inode, &mode, &acl);
if (error)
return error;
+ update_mode = 1;
+ }
+ error = __ext2_set_acl(inode, acl, type);
+ if (!error && update_mode) {
+ inode->i_mode = mode;
inode->i_ctime = current_time(inode);
mark_inode_dirty(inode);
}
- return __ext2_set_acl(inode, acl, type);
+ return error;
}
/*