alistair23-linux/fs/hfsplus
Andreas Gruenbacher b8a7a3a667 posix_acl: Inode acl caching fixes
When get_acl() is called for an inode whose ACL is not cached yet, the
get_acl inode operation is called to fetch the ACL from the filesystem.
The inode operation is responsible for updating the cached acl with
set_cached_acl().  This is done without locking at the VFS level, so
another task can call set_cached_acl() or forget_cached_acl() before the
get_acl inode operation gets to calling set_cached_acl(), and then
get_acl's call to set_cached_acl() results in caching an outdate ACL.

Prevent this from happening by setting the cached ACL pointer to a
task-specific sentinel value before calling the get_acl inode operation.
Move the responsibility for updating the cached ACL from the get_acl
inode operations to get_acl().  There, only set the cached ACL if the
sentinel value hasn't changed.

The sentinel values are chosen to have odd values.  Likewise, the value
of ACL_NOT_CACHED is odd.  In contrast, ACL object pointers always have
an even value (ACLs are aligned in memory).  This allows to distinguish
uncached ACLs values from ACL objects.

In addition, switch from guarding inode->i_acl and inode->i_default_acl
upates by the inode->i_lock spinlock to using xchg() and cmpxchg().

Filesystems that do not want ACLs returned from their get_acl inode
operations to be cached must call forget_cached_acl() to prevent the VFS
from doing so.

(Patch written by Al Viro and Andreas Gruenbacher.)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-03-31 00:30:15 -04:00
..
acl.h
attributes.c
bfind.c fs/hfsplus: replace if/BUG by BUG_ON 2015-04-17 09:04:05 -04:00
bitmap.c
bnode.c hfs,hfsplus: cache pages correctly between bnode_create and bnode_free 2015-09-10 13:29:01 -07:00
brec.c hfsplus: fix B-tree corruption after insertion at position 0 2015-03-25 16:20:31 -07:00
btree.c
catalog.c hfsplus: add missing curly braces in hfsplus_delete_cat() 2015-04-17 09:04:04 -04:00
dir.c wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
extents.c
hfsplus_fs.h fs: cleanup slight list_entry abuse 2015-06-23 18:01:59 -04:00
hfsplus_raw.h
inode.c wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
ioctl.c wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
Kconfig
Makefile
options.c fs: create and use seq_show_option for escaping 2015-09-04 16:54:41 -07:00
part_tbl.c
posix_acl.c posix_acl: Inode acl caching fixes 2016-03-31 00:30:15 -04:00
super.c kmemcg: account certain kmem allocations to memcg 2016-01-14 16:00:49 -08:00
tables.c
unicode.c
wrapper.c
xattr.c vfs: Distinguish between full xattr names and proper prefixes 2015-12-06 21:33:52 -05:00
xattr.h fs/hfsplus: move xattr_name allocation in hfsplus_setxattr() 2015-04-17 09:04:05 -04:00
xattr_security.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00
xattr_trusted.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00
xattr_user.c xattr handlers: Pass handler to operations instead of flags 2015-11-13 20:34:32 -05:00