aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jffs2/acl.c54
-rw-r--r--fs/jffs2/acl.h4
-rw-r--r--fs/jffs2/jffs2_fs_i.h4
-rw-r--r--fs/jffs2/os-linux.h4
-rw-r--r--fs/jffs2/readinode.c1
5 files changed, 19 insertions, 48 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 043740dde20c..ac16589ebbd1 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -158,10 +158,10 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
158 158
159static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **i_acl) 159static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **i_acl)
160{ 160{
161 struct posix_acl *acl = JFFS2_ACL_NOT_CACHED; 161 struct posix_acl *acl = ACL_NOT_CACHED;
162 162
163 spin_lock(&inode->i_lock); 163 spin_lock(&inode->i_lock);
164 if (*i_acl != JFFS2_ACL_NOT_CACHED) 164 if (*i_acl != ACL_NOT_CACHED)
165 acl = posix_acl_dup(*i_acl); 165 acl = posix_acl_dup(*i_acl);
166 spin_unlock(&inode->i_lock); 166 spin_unlock(&inode->i_lock);
167 return acl; 167 return acl;
@@ -170,7 +170,7 @@ static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **
170static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl) 170static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl)
171{ 171{
172 spin_lock(&inode->i_lock); 172 spin_lock(&inode->i_lock);
173 if (*i_acl != JFFS2_ACL_NOT_CACHED) 173 if (*i_acl != ACL_NOT_CACHED)
174 posix_acl_release(*i_acl); 174 posix_acl_release(*i_acl);
175 *i_acl = posix_acl_dup(acl); 175 *i_acl = posix_acl_dup(acl);
176 spin_unlock(&inode->i_lock); 176 spin_unlock(&inode->i_lock);
@@ -178,21 +178,20 @@ static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct
178 178
179static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) 179static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
180{ 180{
181 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
182 struct posix_acl *acl; 181 struct posix_acl *acl;
183 char *value = NULL; 182 char *value = NULL;
184 int rc, xprefix; 183 int rc, xprefix;
185 184
186 switch (type) { 185 switch (type) {
187 case ACL_TYPE_ACCESS: 186 case ACL_TYPE_ACCESS:
188 acl = jffs2_iget_acl(inode, &f->i_acl_access); 187 acl = jffs2_iget_acl(inode, &inode->i_acl);
189 if (acl != JFFS2_ACL_NOT_CACHED) 188 if (acl != ACL_NOT_CACHED)
190 return acl; 189 return acl;
191 xprefix = JFFS2_XPREFIX_ACL_ACCESS; 190 xprefix = JFFS2_XPREFIX_ACL_ACCESS;
192 break; 191 break;
193 case ACL_TYPE_DEFAULT: 192 case ACL_TYPE_DEFAULT:
194 acl = jffs2_iget_acl(inode, &f->i_acl_default); 193 acl = jffs2_iget_acl(inode, &inode->i_default_acl);
195 if (acl != JFFS2_ACL_NOT_CACHED) 194 if (acl != ACL_NOT_CACHED)
196 return acl; 195 return acl;
197 xprefix = JFFS2_XPREFIX_ACL_DEFAULT; 196 xprefix = JFFS2_XPREFIX_ACL_DEFAULT;
198 break; 197 break;
@@ -218,10 +217,10 @@ static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
218 if (!IS_ERR(acl)) { 217 if (!IS_ERR(acl)) {
219 switch (type) { 218 switch (type) {
220 case ACL_TYPE_ACCESS: 219 case ACL_TYPE_ACCESS:
221 jffs2_iset_acl(inode, &f->i_acl_access, acl); 220 jffs2_iset_acl(inode, &inode->i_acl, acl);
222 break; 221 break;
223 case ACL_TYPE_DEFAULT: 222 case ACL_TYPE_DEFAULT:
224 jffs2_iset_acl(inode, &f->i_acl_default, acl); 223 jffs2_iset_acl(inode, &inode->i_default_acl, acl);
225 break; 224 break;
226 } 225 }
227 } 226 }
@@ -249,7 +248,6 @@ static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *a
249 248
250static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) 249static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
251{ 250{
252 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
253 int rc, xprefix; 251 int rc, xprefix;
254 252
255 if (S_ISLNK(inode->i_mode)) 253 if (S_ISLNK(inode->i_mode))
@@ -288,10 +286,10 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
288 if (!rc) { 286 if (!rc) {
289 switch(type) { 287 switch(type) {
290 case ACL_TYPE_ACCESS: 288 case ACL_TYPE_ACCESS:
291 jffs2_iset_acl(inode, &f->i_acl_access, acl); 289 jffs2_iset_acl(inode, &inode->i_acl, acl);
292 break; 290 break;
293 case ACL_TYPE_DEFAULT: 291 case ACL_TYPE_DEFAULT:
294 jffs2_iset_acl(inode, &f->i_acl_default, acl); 292 jffs2_iset_acl(inode, &inode->i_default_acl, acl);
295 break; 293 break;
296 } 294 }
297 } 295 }
@@ -321,12 +319,11 @@ int jffs2_permission(struct inode *inode, int mask)
321 319
322int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode) 320int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
323{ 321{
324 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
325 struct posix_acl *acl, *clone; 322 struct posix_acl *acl, *clone;
326 int rc; 323 int rc;
327 324
328 f->i_acl_default = NULL; 325 inode->i_default_acl = NULL;
329 f->i_acl_access = NULL; 326 inode->i_acl = NULL;
330 327
331 if (S_ISLNK(*i_mode)) 328 if (S_ISLNK(*i_mode))
332 return 0; /* Symlink always has no-ACL */ 329 return 0; /* Symlink always has no-ACL */
@@ -339,7 +336,7 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
339 *i_mode &= ~current_umask(); 336 *i_mode &= ~current_umask();
340 } else { 337 } else {
341 if (S_ISDIR(*i_mode)) 338 if (S_ISDIR(*i_mode))
342 jffs2_iset_acl(inode, &f->i_acl_default, acl); 339 jffs2_iset_acl(inode, &inode->i_default_acl, acl);
343 340
344 clone = posix_acl_clone(acl, GFP_KERNEL); 341 clone = posix_acl_clone(acl, GFP_KERNEL);
345 if (!clone) 342 if (!clone)
@@ -350,7 +347,7 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
350 return rc; 347 return rc;
351 } 348 }
352 if (rc > 0) 349 if (rc > 0)
353 jffs2_iset_acl(inode, &f->i_acl_access, clone); 350 jffs2_iset_acl(inode, &inode->i_acl, clone);
354 351
355 posix_acl_release(clone); 352 posix_acl_release(clone);
356 } 353 }
@@ -359,17 +356,16 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
359 356
360int jffs2_init_acl_post(struct inode *inode) 357int jffs2_init_acl_post(struct inode *inode)
361{ 358{
362 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
363 int rc; 359 int rc;
364 360
365 if (f->i_acl_default) { 361 if (inode->i_default_acl) {
366 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, f->i_acl_default); 362 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, inode->i_default_acl);
367 if (rc) 363 if (rc)
368 return rc; 364 return rc;
369 } 365 }
370 366
371 if (f->i_acl_access) { 367 if (inode->i_acl) {
372 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, f->i_acl_access); 368 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, inode->i_acl);
373 if (rc) 369 if (rc)
374 return rc; 370 return rc;
375 } 371 }
@@ -377,18 +373,6 @@ int jffs2_init_acl_post(struct inode *inode)
377 return 0; 373 return 0;
378} 374}
379 375
380void jffs2_clear_acl(struct jffs2_inode_info *f)
381{
382 if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) {
383 posix_acl_release(f->i_acl_access);
384 f->i_acl_access = JFFS2_ACL_NOT_CACHED;
385 }
386 if (f->i_acl_default && f->i_acl_default != JFFS2_ACL_NOT_CACHED) {
387 posix_acl_release(f->i_acl_default);
388 f->i_acl_default = JFFS2_ACL_NOT_CACHED;
389 }
390}
391
392int jffs2_acl_chmod(struct inode *inode) 376int jffs2_acl_chmod(struct inode *inode)
393{ 377{
394 struct posix_acl *acl, *clone; 378 struct posix_acl *acl, *clone;
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h
index 8ca058aed384..fc929f2a14f6 100644
--- a/fs/jffs2/acl.h
+++ b/fs/jffs2/acl.h
@@ -26,13 +26,10 @@ struct jffs2_acl_header {
26 26
27#ifdef CONFIG_JFFS2_FS_POSIX_ACL 27#ifdef CONFIG_JFFS2_FS_POSIX_ACL
28 28
29#define JFFS2_ACL_NOT_CACHED ((void *)-1)
30
31extern int jffs2_permission(struct inode *, int); 29extern int jffs2_permission(struct inode *, int);
32extern int jffs2_acl_chmod(struct inode *); 30extern int jffs2_acl_chmod(struct inode *);
33extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); 31extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *);
34extern int jffs2_init_acl_post(struct inode *); 32extern int jffs2_init_acl_post(struct inode *);
35extern void jffs2_clear_acl(struct jffs2_inode_info *);
36 33
37extern struct xattr_handler jffs2_acl_access_xattr_handler; 34extern struct xattr_handler jffs2_acl_access_xattr_handler;
38extern struct xattr_handler jffs2_acl_default_xattr_handler; 35extern struct xattr_handler jffs2_acl_default_xattr_handler;
@@ -43,6 +40,5 @@ extern struct xattr_handler jffs2_acl_default_xattr_handler;
43#define jffs2_acl_chmod(inode) (0) 40#define jffs2_acl_chmod(inode) (0)
44#define jffs2_init_acl_pre(dir_i,inode,mode) (0) 41#define jffs2_init_acl_pre(dir_i,inode,mode) (0)
45#define jffs2_init_acl_post(inode) (0) 42#define jffs2_init_acl_post(inode) (0)
46#define jffs2_clear_acl(f)
47 43
48#endif /* CONFIG_JFFS2_FS_POSIX_ACL */ 44#endif /* CONFIG_JFFS2_FS_POSIX_ACL */
diff --git a/fs/jffs2/jffs2_fs_i.h b/fs/jffs2/jffs2_fs_i.h
index 4c41db91eaa4..c6923da98263 100644
--- a/fs/jffs2/jffs2_fs_i.h
+++ b/fs/jffs2/jffs2_fs_i.h
@@ -50,10 +50,6 @@ struct jffs2_inode_info {
50 uint16_t flags; 50 uint16_t flags;
51 uint8_t usercompr; 51 uint8_t usercompr;
52 struct inode vfs_inode; 52 struct inode vfs_inode;
53#ifdef CONFIG_JFFS2_FS_POSIX_ACL
54 struct posix_acl *i_acl_access;
55 struct posix_acl *i_acl_default;
56#endif
57}; 53};
58 54
59#endif /* _JFFS2_FS_I */ 55#endif /* _JFFS2_FS_I */
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 2228380c47b9..a7f03b7ebcb3 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -56,10 +56,6 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
56 f->target = NULL; 56 f->target = NULL;
57 f->flags = 0; 57 f->flags = 0;
58 f->usercompr = 0; 58 f->usercompr = 0;
59#ifdef CONFIG_JFFS2_FS_POSIX_ACL
60 f->i_acl_access = JFFS2_ACL_NOT_CACHED;
61 f->i_acl_default = JFFS2_ACL_NOT_CACHED;
62#endif
63} 59}
64 60
65 61
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 1fc1e92356ee..1a80301004b8 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -1424,7 +1424,6 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f)
1424 struct jffs2_full_dirent *fd, *fds; 1424 struct jffs2_full_dirent *fd, *fds;
1425 int deleted; 1425 int deleted;
1426 1426
1427 jffs2_clear_acl(f);
1428 jffs2_xattr_delete_inode(c, f->inocache); 1427 jffs2_xattr_delete_inode(c, f->inocache);
1429 mutex_lock(&f->sem); 1428 mutex_lock(&f->sem);
1430 deleted = f->inocache && !f->inocache->pino_nlink; 1429 deleted = f->inocache && !f->inocache->pino_nlink;