diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2010-09-27 14:57:40 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-10-28 10:08:46 -0400 |
commit | ad77dbce567128d59b37a14c9562c8af6f63aeca (patch) | |
tree | b178b4766e568013c3f58446aca27b1771a3694b /fs/9p/acl.c | |
parent | 6e8dc55550273084b7fb5846df2f44439f5d03d9 (diff) |
fs/9p: Implement create time inheritance
Inherit default ACL on create
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/acl.c')
-rw-r--r-- | fs/9p/acl.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 8f2acde74c05..8b3c54a4958c 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
@@ -152,6 +152,58 @@ int v9fs_acl_chmod(struct dentry *dentry) | |||
152 | return retval; | 152 | return retval; |
153 | } | 153 | } |
154 | 154 | ||
155 | int v9fs_set_create_acl(struct dentry *dentry, | ||
156 | struct posix_acl *dpacl, struct posix_acl *pacl) | ||
157 | { | ||
158 | if (dpacl) | ||
159 | v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, dpacl); | ||
160 | if (pacl) | ||
161 | v9fs_set_acl(dentry, ACL_TYPE_ACCESS, pacl); | ||
162 | posix_acl_release(dpacl); | ||
163 | posix_acl_release(pacl); | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | int v9fs_acl_mode(struct inode *dir, mode_t *modep, | ||
168 | struct posix_acl **dpacl, struct posix_acl **pacl) | ||
169 | { | ||
170 | int retval = 0; | ||
171 | mode_t mode = *modep; | ||
172 | struct posix_acl *acl = NULL; | ||
173 | |||
174 | if (!S_ISLNK(mode)) { | ||
175 | acl = v9fs_get_cached_acl(dir, ACL_TYPE_DEFAULT); | ||
176 | if (IS_ERR(acl)) | ||
177 | return PTR_ERR(acl); | ||
178 | if (!acl) | ||
179 | mode &= ~current_umask(); | ||
180 | } | ||
181 | if (acl) { | ||
182 | struct posix_acl *clone; | ||
183 | |||
184 | if (S_ISDIR(mode)) | ||
185 | *dpacl = acl; | ||
186 | clone = posix_acl_clone(acl, GFP_NOFS); | ||
187 | retval = -ENOMEM; | ||
188 | if (!clone) | ||
189 | goto cleanup; | ||
190 | |||
191 | retval = posix_acl_create_masq(clone, &mode); | ||
192 | if (retval < 0) { | ||
193 | posix_acl_release(clone); | ||
194 | goto cleanup; | ||
195 | } | ||
196 | if (retval > 0) | ||
197 | *pacl = clone; | ||
198 | } | ||
199 | *modep = mode; | ||
200 | return 0; | ||
201 | cleanup: | ||
202 | posix_acl_release(acl); | ||
203 | return retval; | ||
204 | |||
205 | } | ||
206 | |||
155 | static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, | 207 | static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, |
156 | void *buffer, size_t size, int type) | 208 | void *buffer, size_t size, int type) |
157 | { | 209 | { |