aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2014-07-04 01:59:43 -0400
committerIlya Dryomov <ilya.dryomov@inktank.com>2014-07-08 07:08:47 -0400
commitf5f186474335ac385def69564542e6e4c6a3a8bd (patch)
treea76bfdb686f2aab83da0cb0af43ee6fa67af4e66 /fs/ceph
parent5aaa432ad9ecbfb6587f241747ac1d4a8f10e7e7 (diff)
ceph: properly apply umask when ACL is enabled
when ACL is enabled, posix_acl_create() may change inode's mode Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/acl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c
index 469f2e8657e8..cebf2ebefb55 100644
--- a/fs/ceph/acl.c
+++ b/fs/ceph/acl.c
@@ -172,14 +172,24 @@ out:
172int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) 172int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir)
173{ 173{
174 struct posix_acl *default_acl, *acl; 174 struct posix_acl *default_acl, *acl;
175 umode_t new_mode = inode->i_mode;
175 int error; 176 int error;
176 177
177 error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); 178 error = posix_acl_create(dir, &new_mode, &default_acl, &acl);
178 if (error) 179 if (error)
179 return error; 180 return error;
180 181
181 if (!default_acl && !acl) 182 if (!default_acl && !acl) {
182 cache_no_acl(inode); 183 cache_no_acl(inode);
184 if (new_mode != inode->i_mode) {
185 struct iattr newattrs = {
186 .ia_mode = new_mode,
187 .ia_valid = ATTR_MODE,
188 };
189 error = ceph_setattr(dentry, &newattrs);
190 }
191 return error;
192 }
183 193
184 if (default_acl) { 194 if (default_acl) {
185 error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); 195 error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);