summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/acl.c24
-rw-r--r--fs/ocfs2/acl.h1
-rw-r--r--fs/ocfs2/file.c4
3 files changed, 27 insertions, 2 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 0cdf497c91ef..749d3bc41232 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -322,3 +322,27 @@ struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
322 brelse(di_bh); 322 brelse(di_bh);
323 return acl; 323 return acl;
324} 324}
325
326int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)
327{
328 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
329 struct posix_acl *acl;
330 int ret;
331
332 if (S_ISLNK(inode->i_mode))
333 return -EOPNOTSUPP;
334
335 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
336 return 0;
337
338 acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh);
339 if (IS_ERR(acl) || !acl)
340 return PTR_ERR(acl);
341 ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
342 if (ret)
343 return ret;
344 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
345 acl, NULL, NULL);
346 posix_acl_release(acl);
347 return ret;
348}
diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
index 3fce68d08625..035e5878db06 100644
--- a/fs/ocfs2/acl.h
+++ b/fs/ocfs2/acl.h
@@ -35,5 +35,6 @@ int ocfs2_set_acl(handle_t *handle,
35 struct posix_acl *acl, 35 struct posix_acl *acl,
36 struct ocfs2_alloc_context *meta_ac, 36 struct ocfs2_alloc_context *meta_ac,
37 struct ocfs2_alloc_context *data_ac); 37 struct ocfs2_alloc_context *data_ac);
38extern int ocfs2_acl_chmod(struct inode *, struct buffer_head *);
38 39
39#endif /* OCFS2_ACL_H */ 40#endif /* OCFS2_ACL_H */
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 5308841756be..59cce53c91d8 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1268,20 +1268,20 @@ bail_unlock_rw:
1268 if (size_change) 1268 if (size_change)
1269 ocfs2_rw_unlock(inode, 1); 1269 ocfs2_rw_unlock(inode, 1);
1270bail: 1270bail:
1271 brelse(bh);
1272 1271
1273 /* Release quota pointers in case we acquired them */ 1272 /* Release quota pointers in case we acquired them */
1274 for (qtype = 0; qtype < OCFS2_MAXQUOTAS; qtype++) 1273 for (qtype = 0; qtype < OCFS2_MAXQUOTAS; qtype++)
1275 dqput(transfer_to[qtype]); 1274 dqput(transfer_to[qtype]);
1276 1275
1277 if (!status && attr->ia_valid & ATTR_MODE) { 1276 if (!status && attr->ia_valid & ATTR_MODE) {
1278 status = posix_acl_chmod(inode, inode->i_mode); 1277 status = ocfs2_acl_chmod(inode, bh);
1279 if (status < 0) 1278 if (status < 0)
1280 mlog_errno(status); 1279 mlog_errno(status);
1281 } 1280 }
1282 if (inode_locked) 1281 if (inode_locked)
1283 ocfs2_inode_unlock(inode, 1); 1282 ocfs2_inode_unlock(inode, 1);
1284 1283
1284 brelse(bh);
1285 return status; 1285 return status;
1286} 1286}
1287 1287