diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/acl.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index bd0fce964c41..3eb1ea846173 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c | |||
@@ -48,6 +48,10 @@ static struct posix_acl *gfs2_acl_get(struct gfs2_inode *ip, int type) | |||
48 | if (!ip->i_eattr) | 48 | if (!ip->i_eattr) |
49 | return NULL; | 49 | return NULL; |
50 | 50 | ||
51 | acl = get_cached_acl(&ip->i_inode, type); | ||
52 | if (acl != ACL_NOT_CACHED) | ||
53 | return acl; | ||
54 | |||
51 | name = gfs2_acl_name(type); | 55 | name = gfs2_acl_name(type); |
52 | if (name == NULL) | 56 | if (name == NULL) |
53 | return ERR_PTR(-EINVAL); | 57 | return ERR_PTR(-EINVAL); |
@@ -123,6 +127,8 @@ static int gfs2_acl_set(struct inode *inode, int type, struct posix_acl *acl) | |||
123 | if (error < 0) | 127 | if (error < 0) |
124 | goto out; | 128 | goto out; |
125 | error = gfs2_xattr_set(inode, GFS2_EATYPE_SYS, name, data, len, 0); | 129 | error = gfs2_xattr_set(inode, GFS2_EATYPE_SYS, name, data, len, 0); |
130 | if (!error) | ||
131 | set_cached_acl(inode, type, acl); | ||
126 | out: | 132 | out: |
127 | kfree(data); | 133 | kfree(data); |
128 | return error; | 134 | return error; |
@@ -209,6 +215,7 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr) | |||
209 | posix_acl_to_xattr(acl, data, len); | 215 | posix_acl_to_xattr(acl, data, len); |
210 | error = gfs2_xattr_acl_chmod(ip, attr, data); | 216 | error = gfs2_xattr_acl_chmod(ip, attr, data); |
211 | kfree(data); | 217 | kfree(data); |
218 | set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl); | ||
212 | } | 219 | } |
213 | 220 | ||
214 | out: | 221 | out: |
@@ -228,15 +235,25 @@ static int gfs2_acl_type(const char *name) | |||
228 | static int gfs2_xattr_system_get(struct inode *inode, const char *name, | 235 | static int gfs2_xattr_system_get(struct inode *inode, const char *name, |
229 | void *buffer, size_t size) | 236 | void *buffer, size_t size) |
230 | { | 237 | { |
238 | struct posix_acl *acl; | ||
231 | int type; | 239 | int type; |
240 | int error; | ||
232 | 241 | ||
233 | type = gfs2_acl_type(name); | 242 | type = gfs2_acl_type(name); |
234 | if (type < 0) | 243 | if (type < 0) |
235 | return type; | 244 | return type; |
236 | 245 | ||
237 | return gfs2_xattr_get(inode, GFS2_EATYPE_SYS, name, buffer, size); | 246 | acl = gfs2_acl_get(GFS2_I(inode), type); |
238 | } | 247 | if (IS_ERR(acl)) |
248 | return PTR_ERR(acl); | ||
249 | if (acl == NULL) | ||
250 | return -ENODATA; | ||
239 | 251 | ||
252 | error = posix_acl_to_xattr(acl, buffer, size); | ||
253 | posix_acl_release(acl); | ||
254 | |||
255 | return error; | ||
256 | } | ||
240 | 257 | ||
241 | static int gfs2_xattr_system_set(struct inode *inode, const char *name, | 258 | static int gfs2_xattr_system_set(struct inode *inode, const char *name, |
242 | const void *value, size_t size, int flags) | 259 | const void *value, size_t size, int flags) |
@@ -303,6 +320,12 @@ static int gfs2_xattr_system_set(struct inode *inode, const char *name, | |||
303 | 320 | ||
304 | set_acl: | 321 | set_acl: |
305 | error = gfs2_xattr_set(inode, GFS2_EATYPE_SYS, name, value, size, 0); | 322 | error = gfs2_xattr_set(inode, GFS2_EATYPE_SYS, name, value, size, 0); |
323 | if (!error) { | ||
324 | if (acl) | ||
325 | set_cached_acl(inode, type, acl); | ||
326 | else | ||
327 | forget_cached_acl(inode, type); | ||
328 | } | ||
306 | out_release: | 329 | out_release: |
307 | posix_acl_release(acl); | 330 | posix_acl_release(acl); |
308 | out: | 331 | out: |