diff options
| -rw-r--r-- | fs/ceph/acl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 9ab312e49637..4c2d452c4bfc 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c | |||
| @@ -107,7 +107,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
| 107 | char *value = NULL; | 107 | char *value = NULL; |
| 108 | struct iattr newattrs; | 108 | struct iattr newattrs; |
| 109 | umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; | 109 | umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; |
| 110 | struct dentry *dentry = d_find_alias(inode); | 110 | struct dentry *dentry; |
| 111 | 111 | ||
| 112 | if (acl) { | 112 | if (acl) { |
| 113 | ret = posix_acl_valid(acl); | 113 | ret = posix_acl_valid(acl); |
| @@ -151,12 +151,13 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
| 151 | goto out_free; | 151 | goto out_free; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | dentry = d_find_alias(inode); | ||
| 154 | if (new_mode != old_mode) { | 155 | if (new_mode != old_mode) { |
| 155 | newattrs.ia_mode = new_mode; | 156 | newattrs.ia_mode = new_mode; |
| 156 | newattrs.ia_valid = ATTR_MODE; | 157 | newattrs.ia_valid = ATTR_MODE; |
| 157 | ret = ceph_setattr(dentry, &newattrs); | 158 | ret = ceph_setattr(dentry, &newattrs); |
| 158 | if (ret) | 159 | if (ret) |
| 159 | goto out_free; | 160 | goto out_dput; |
| 160 | } | 161 | } |
| 161 | 162 | ||
| 162 | if (value) | 163 | if (value) |
| @@ -170,11 +171,13 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
| 170 | newattrs.ia_valid = ATTR_MODE; | 171 | newattrs.ia_valid = ATTR_MODE; |
| 171 | ceph_setattr(dentry, &newattrs); | 172 | ceph_setattr(dentry, &newattrs); |
| 172 | } | 173 | } |
| 173 | goto out_free; | 174 | goto out_dput; |
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | ceph_set_cached_acl(inode, type, acl); | 177 | ceph_set_cached_acl(inode, type, acl); |
| 177 | 178 | ||
| 179 | out_dput: | ||
| 180 | dput(dentry); | ||
| 178 | out_free: | 181 | out_free: |
| 179 | kfree(value); | 182 | kfree(value); |
| 180 | out: | 183 | out: |
