linux-stable/fs/ceph
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.c posix_acl: Inode acl caching fixes 2016-03-31 00:30:15 -04:00
addr.c ceph: remove unnecessary NULL check 2016-03-25 18:51:54 +01:00
cache.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2016-01-24 12:34:13 -08:00
cache.h ceph: fscache: add an interface to synchronize object store limit 2014-04-03 10:33:53 +08:00
caps.c ceph: encode ctime in cap message 2016-03-25 18:51:40 +01:00
ceph_frag.c ceph: factor out libceph from Ceph file system 2010-10-20 15:37:28 -07:00
debugfs.c VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00
dir.c ceph: use kmem_cache_zalloc 2016-03-25 18:51:56 +01:00
export.c ceph: fix security xattr deadlock 2016-03-25 18:51:55 +01:00
file.c ceph: use kmem_cache_zalloc 2016-03-25 18:51:56 +01:00
inode.c ceph: use lookup request to revalidate dentry 2016-03-25 18:51:56 +01:00
ioctl.c ceph: fix divide-by-zero in __validate_layout() 2014-10-14 12:57:05 -07:00
ioctl.h ceph: fully initialize new layout 2012-05-16 14:28:27 -05:00
Kconfig ceph: add acl for cephfs 2013-12-31 20:32:01 +02:00
locks.c Move locks API users to locks_lock_inode_wait() 2015-10-22 14:57:36 -04:00
Makefile ceph: add acl for cephfs 2013-12-31 20:32:01 +02:00
mds_client.c ceph: fix security xattr deadlock 2016-03-25 18:51:55 +01:00
mds_client.h ceph: initial CEPH_FEATURE_FS_FILE_LAYOUT_V2 support 2016-03-04 21:00:37 +01:00
mdsmap.c fs/ceph: replace pr_warning by pr_warn 2014-06-06 16:08:06 -07:00
snap.c ceph: kill ceph_empty_snapc 2016-03-25 18:51:52 +01:00
strings.c ceph: rename snapshot support 2015-04-22 18:33:41 +03:00
super.c ceph: fix mounting same fs multiple times 2016-03-25 18:51:54 +01:00
super.h ceph: kill ceph_get_dentry_parent_inode() 2016-03-25 18:51:55 +01:00
xattr.c ceph: fix security xattr deadlock 2016-03-25 18:51:55 +01:00