linux-stable/fs/jfs
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
file.c wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
inode.c don't put symlink bodies in pagecache into highmem 2015-12-08 22:41:36 -05:00
ioctl.c wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
jfs_acl.h jfs: use generic posix ACL infrastructure 2014-01-25 23:58:22 -05:00
jfs_btree.h
jfs_debug.c
jfs_debug.h
jfs_dinode.h
jfs_discard.c jfs: Fix FITRIM argument handling 2012-10-17 09:18:38 -05:00
jfs_discard.h fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
jfs_dmap.c fs/jfs/jfs_dmap.c: replace min/casting by min_t 2014-06-03 14:14:00 -05:00
jfs_dmap.h fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
jfs_dtree.c jfs: get rid of homegrown endianness helpers 2014-12-23 17:01:24 -06:00
jfs_dtree.h [readdir] convert jfs 2013-06-29 12:56:42 +04:00
jfs_extent.c jfs: Update jfs_error 2013-06-05 14:47:19 -05:00
jfs_extent.h
jfs_filsys.h fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
jfs_imap.c jfs: Update jfs_error 2013-06-05 14:47:19 -05:00
jfs_imap.h
jfs_incore.h fs: cleanup slight list_entry abuse 2015-06-23 18:01:59 -04:00
jfs_inode.c jfs: Handle error from dquot_initialize() 2015-07-23 20:59:39 +02:00
jfs_inode.h fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers 2011-07-20 20:47:59 -04:00
jfs_lock.h
jfs_logmgr.c jfs: microoptimize get_zeroed_page / virt_to_page 2016-01-04 10:29:28 -05:00
jfs_logmgr.h Fix common misspellings 2011-03-31 11:26:23 -03:00
jfs_metapage.c block: add a bi_error field to struct bio 2015-07-29 08:55:15 -06:00
jfs_metapage.h fs, jfs: remove slab object constructor 2015-04-15 16:35:18 -07:00
jfs_mount.c
jfs_superblock.h jfs: Update jfs_error 2013-06-05 14:47:19 -05:00
jfs_txnmgr.c sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule() 2014-09-19 12:35:17 +02:00
jfs_txnmgr.h
jfs_types.h jfs: get rid of homegrown endianness helpers 2014-12-23 17:01:24 -06:00
jfs_umount.c jfs: flush journal completely before releasing metadata inodes 2011-08-01 12:41:00 -05:00
jfs_unicode.c
jfs_unicode.h
jfs_uniupr.c
jfs_xattr.h jfs: use generic posix ACL infrastructure 2014-01-25 23:58:22 -05:00
jfs_xtree.c jfs: Update jfs_error 2013-06-05 14:47:19 -05:00
jfs_xtree.h jfs: get rid of homegrown endianness helpers 2014-12-23 17:01:24 -06:00
Kconfig
Makefile fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
namei.c don't put symlink bodies in pagecache into highmem 2015-12-08 22:41:36 -05:00
resize.c jfs: Update jfs_error 2013-06-05 14:47:19 -05:00
super.c wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
symlink.c switch ->get_link() to delayed_call, kill ->put_link() 2015-12-30 13:01:03 -05:00
xattr.c VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00