Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3567866b
Commit
3567866b
authored
Aug 02, 2011
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RCUify freeing acls, let check_acl() go ahead in RCU mode if acl is cached
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
951c0d66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
20 deletions
+15
-20
fs/namei.c
fs/namei.c
+6
-11
include/linux/posix_acl.h
include/linux/posix_acl.h
+9
-9
No files found.
fs/namei.c
View file @
3567866b
...
...
@@ -179,19 +179,14 @@ static int check_acl(struct inode *inode, int mask)
#ifdef CONFIG_FS_POSIX_ACL
struct
posix_acl
*
acl
;
/*
* Under RCU walk, we cannot even do a "get_cached_acl()",
* because that involves locking and getting a refcount on
* a cached ACL.
*
* So the only case we handle during RCU walking is the
* case of a cached "no ACL at all", which needs no locks
* or refcounts.
*/
if
(
mask
&
MAY_NOT_BLOCK
)
{
if
(
negative_cached_acl
(
inode
,
ACL_TYPE_ACCESS
))
acl
=
get_cached_acl_rcu
(
inode
,
ACL_TYPE_ACCESS
);
if
(
!
acl
)
return
-
EAGAIN
;
/* no ->get_acl() calls in RCU mode... */
if
(
acl
==
ACL_NOT_CACHED
)
return
-
ECHILD
;
return
posix_acl_permission
(
inode
,
acl
,
mask
);
}
acl
=
get_cached_acl
(
inode
,
ACL_TYPE_ACCESS
);
...
...
include/linux/posix_acl.h
View file @
3567866b
...
...
@@ -9,6 +9,7 @@
#define __LINUX_POSIX_ACL_H
#include <linux/slab.h>
#include <linux/rcupdate.h>
#define ACL_UNDEFINED_ID (-1)
...
...
@@ -38,7 +39,10 @@ struct posix_acl_entry {
};
struct
posix_acl
{
union
{
atomic_t
a_refcount
;
struct
rcu_head
a_rcu
;
};
unsigned
int
a_count
;
struct
posix_acl_entry
a_entries
[
0
];
};
...
...
@@ -65,7 +69,7 @@ static inline void
posix_acl_release
(
struct
posix_acl
*
acl
)
{
if
(
acl
&&
atomic_dec_and_test
(
&
acl
->
a_refcount
))
kfree
(
acl
);
kfree
_rcu
(
acl
,
a_rcu
);
}
...
...
@@ -110,13 +114,9 @@ static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
return
acl
;
}
static
inline
int
negative_cached_acl
(
struct
inode
*
inode
,
int
type
)
static
inline
struct
posix_acl
*
get_cached_acl_rcu
(
struct
inode
*
inode
,
int
type
)
{
struct
posix_acl
**
p
=
acl_by_type
(
inode
,
type
);
struct
posix_acl
*
acl
=
ACCESS_ONCE
(
*
p
);
if
(
acl
)
return
0
;
return
1
;
return
rcu_dereference
(
*
acl_by_type
(
inode
,
type
));
}
static
inline
void
set_cached_acl
(
struct
inode
*
inode
,
...
...
@@ -127,7 +127,7 @@ static inline void set_cached_acl(struct inode *inode,
struct
posix_acl
*
old
;
spin_lock
(
&
inode
->
i_lock
);
old
=
*
p
;
*
p
=
posix_dup_acl
(
acl
);
rcu_assign_pointer
(
*
p
,
posix_acl_dup
(
acl
)
);
spin_unlock
(
&
inode
->
i_lock
);
if
(
old
!=
ACL_NOT_CACHED
)
posix_acl_release
(
old
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment