Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (23 commits)
switch xfs to generic acl caching helpers
helpers for acl caching + switch to those
switch shmem to inode->i_acl
switch reiserfs to inode->i_acl
switch reiserfs to usual conventions for caching ACLs
reiserfs: minimal fix for ACL caching
switch nilfs2 to inode->i_acl
switch btrfs to inode->i_acl
switch jffs2 to inode->i_acl
switch jfs to inode->i_acl
switch ext4 to inode->i_acl
switch ext3 to inode->i_acl
switch ext2 to inode->i_acl
add caching of ACLs in struct inode
fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
cleanup __writeback_single_inode
... and the same for vfsmount id/mount group id
Make allocation of anon devices cheaper
update Documentation/filesystems/Locking
devpts: remove module-related code
...

+453 -820
+21 -20
Documentation/filesystems/Locking
··· 109 109 110 110 locking rules: 111 111 All may block. 112 - BKL s_lock s_umount 113 - alloc_inode: no no no 114 - destroy_inode: no 115 - dirty_inode: no (must not sleep) 116 - write_inode: no 117 - drop_inode: no !!!inode_lock!!! 118 - delete_inode: no 119 - put_super: yes yes no 120 - write_super: no yes read 121 - sync_fs: no no read 122 - freeze_fs: ? 123 - unfreeze_fs: ? 124 - statfs: no no no 125 - remount_fs: yes yes maybe (see below) 126 - clear_inode: no 127 - umount_begin: yes no no 128 - show_options: no (vfsmount->sem) 129 - quota_read: no no no (see below) 130 - quota_write: no no no (see below) 112 + None have BKL 113 + s_umount 114 + alloc_inode: 115 + destroy_inode: 116 + dirty_inode: (must not sleep) 117 + write_inode: 118 + drop_inode: !!!inode_lock!!! 119 + delete_inode: 120 + put_super: write 121 + write_super: read 122 + sync_fs: read 123 + freeze_fs: read 124 + unfreeze_fs: read 125 + statfs: no 126 + remount_fs: maybe (see below) 127 + clear_inode: 128 + umount_begin: no 129 + show_options: no (namespace_sem) 130 + quota_read: no (see below) 131 + quota_write: no (see below) 131 132 132 - ->remount_fs() will have the s_umount lock if it's already mounted. 133 + ->remount_fs() will have the s_umount exclusive lock if it's already mounted. 133 134 When called from get_sb_single, it does NOT have the s_umount lock. 134 135 ->quota_read() and ->quota_write() functions are both guaranteed to 135 136 be the only ones operating on the quota file by the quota code (via
+9 -35
fs/btrfs/acl.c
··· 29 29 30 30 #ifdef CONFIG_FS_POSIX_ACL 31 31 32 - static void btrfs_update_cached_acl(struct inode *inode, 33 - struct posix_acl **p_acl, 34 - struct posix_acl *acl) 35 - { 36 - spin_lock(&inode->i_lock); 37 - if (*p_acl && *p_acl != BTRFS_ACL_NOT_CACHED) 38 - posix_acl_release(*p_acl); 39 - *p_acl = posix_acl_dup(acl); 40 - spin_unlock(&inode->i_lock); 41 - } 42 - 43 32 static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) 44 33 { 45 34 int size; 46 35 const char *name; 47 36 char *value = NULL; 48 - struct posix_acl *acl = NULL, **p_acl; 37 + struct posix_acl *acl; 38 + 39 + acl = get_cached_acl(inode, type); 40 + if (acl != ACL_NOT_CACHED) 41 + return acl; 49 42 50 43 switch (type) { 51 44 case ACL_TYPE_ACCESS: 52 45 name = POSIX_ACL_XATTR_ACCESS; 53 - p_acl = &BTRFS_I(inode)->i_acl; 54 46 break; 55 47 case ACL_TYPE_DEFAULT: 56 48 name = POSIX_ACL_XATTR_DEFAULT; 57 - p_acl = &BTRFS_I(inode)->i_default_acl; 58 49 break; 59 50 default: 60 - return ERR_PTR(-EINVAL); 51 + BUG(); 61 52 } 62 - 63 - /* Handle the cached NULL acl case without locking */ 64 - acl = ACCESS_ONCE(*p_acl); 65 - if (!acl) 66 - return acl; 67 - 68 - spin_lock(&inode->i_lock); 69 - acl = *p_acl; 70 - if (acl != BTRFS_ACL_NOT_CACHED) 71 - acl = posix_acl_dup(acl); 72 - spin_unlock(&inode->i_lock); 73 - 74 - if (acl != BTRFS_ACL_NOT_CACHED) 75 - return acl; 76 53 77 54 size = __btrfs_getxattr(inode, name, "", 0); 78 55 if (size > 0) { ··· 59 82 size = __btrfs_getxattr(inode, name, value, size); 60 83 if (size > 0) { 61 84 acl = posix_acl_from_xattr(value, size); 62 - btrfs_update_cached_acl(inode, p_acl, acl); 85 + set_cached_acl(inode, type, acl); 63 86 } 64 87 kfree(value); 65 88 } else if (size == -ENOENT || size == -ENODATA || size == 0) { 66 89 /* FIXME, who returns -ENOENT? I think nobody */ 67 90 acl = NULL; 68 - btrfs_update_cached_acl(inode, p_acl, acl); 91 + set_cached_acl(inode, type, acl); 69 92 } else { 70 93 acl = ERR_PTR(-EIO); 71 94 } ··· 98 121 { 99 122 int ret, size = 0; 100 123 const char *name; 101 - struct posix_acl **p_acl; 102 124 char *value = NULL; 103 125 mode_t mode; 104 126 ··· 117 141 ret = 0; 118 142 inode->i_mode = mode; 119 143 name = POSIX_ACL_XATTR_ACCESS; 120 - p_acl = &BTRFS_I(inode)->i_acl; 121 144 break; 122 145 case ACL_TYPE_DEFAULT: 123 146 if (!S_ISDIR(inode->i_mode)) 124 147 return acl ? -EINVAL : 0; 125 148 name = POSIX_ACL_XATTR_DEFAULT; 126 - p_acl = &BTRFS_I(inode)->i_default_acl; 127 149 break; 128 150 default: 129 151 return -EINVAL; ··· 146 172 kfree(value); 147 173 148 174 if (!ret) 149 - btrfs_update_cached_acl(inode, p_acl, acl); 175 + set_cached_acl(inode, type, acl); 150 176 151 177 return ret; 152 178 }
-4
fs/btrfs/btrfs_inode.h
··· 53 53 /* used to order data wrt metadata */ 54 54 struct btrfs_ordered_inode_tree ordered_tree; 55 55 56 - /* standard acl pointers */ 57 - struct posix_acl *i_acl; 58 - struct posix_acl *i_default_acl; 59 - 60 56 /* for keeping track of orphaned inodes */ 61 57 struct list_head i_orphan; 62 58
-2
fs/btrfs/ctree.h
··· 41 41 42 42 #define BTRFS_MAGIC "_BHRfS_M" 43 43 44 - #define BTRFS_ACL_NOT_CACHED ((void *)-1) 45 - 46 44 #define BTRFS_MAX_LEVEL 8 47 45 48 46 #define BTRFS_COMPAT_EXTENT_TREE_V0
+2 -14
fs/btrfs/inode.c
··· 2123 2123 */ 2124 2124 maybe_acls = acls_after_inode_item(leaf, path->slots[0], inode->i_ino); 2125 2125 if (!maybe_acls) { 2126 - BTRFS_I(inode)->i_acl = NULL; 2127 - BTRFS_I(inode)->i_default_acl = NULL; 2126 + inode->i_acl = NULL; 2127 + inode->i_default_acl = NULL; 2128 2128 } 2129 2129 2130 2130 BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0, ··· 3140 3140 static noinline void init_btrfs_i(struct inode *inode) 3141 3141 { 3142 3142 struct btrfs_inode *bi = BTRFS_I(inode); 3143 - 3144 - bi->i_acl = BTRFS_ACL_NOT_CACHED; 3145 - bi->i_default_acl = BTRFS_ACL_NOT_CACHED; 3146 3143 3147 3144 bi->generation = 0; 3148 3145 bi->sequence = 0; ··· 4637 4640 ei->last_trans = 0; 4638 4641 ei->logged_trans = 0; 4639 4642 btrfs_ordered_inode_tree_init(&ei->ordered_tree); 4640 - ei->i_acl = BTRFS_ACL_NOT_CACHED; 4641 - ei->i_default_acl = BTRFS_ACL_NOT_CACHED; 4642 4643 INIT_LIST_HEAD(&ei->i_orphan); 4643 4644 INIT_LIST_HEAD(&ei->ordered_operations); 4644 4645 return &ei->vfs_inode; ··· 4649 4654 4650 4655 WARN_ON(!list_empty(&inode->i_dentry)); 4651 4656 WARN_ON(inode->i_data.nrpages); 4652 - 4653 - if (BTRFS_I(inode)->i_acl && 4654 - BTRFS_I(inode)->i_acl != BTRFS_ACL_NOT_CACHED) 4655 - posix_acl_release(BTRFS_I(inode)->i_acl); 4656 - if (BTRFS_I(inode)->i_default_acl && 4657 - BTRFS_I(inode)->i_default_acl != BTRFS_ACL_NOT_CACHED) 4658 - posix_acl_release(BTRFS_I(inode)->i_default_acl); 4659 4657 4660 4658 /* 4661 4659 * Make sure we're properly removed from the ordered operation
+48
fs/compat_ioctl.c
··· 31 31 #include <linux/skbuff.h> 32 32 #include <linux/netlink.h> 33 33 #include <linux/vt.h> 34 + #include <linux/falloc.h> 34 35 #include <linux/fs.h> 35 36 #include <linux/file.h> 36 37 #include <linux/ppp_defs.h> ··· 1780 1779 return sys_ioctl(fd, cmd, (unsigned long)tn); 1781 1780 } 1782 1781 1782 + /* on ia32 l_start is on a 32-bit boundary */ 1783 + #if defined(CONFIG_IA64) || defined(CONFIG_X86_64) 1784 + struct space_resv_32 { 1785 + __s16 l_type; 1786 + __s16 l_whence; 1787 + __s64 l_start __attribute__((packed)); 1788 + /* len == 0 means until end of file */ 1789 + __s64 l_len __attribute__((packed)); 1790 + __s32 l_sysid; 1791 + __u32 l_pid; 1792 + __s32 l_pad[4]; /* reserve area */ 1793 + }; 1794 + 1795 + #define FS_IOC_RESVSP_32 _IOW ('X', 40, struct space_resv_32) 1796 + #define FS_IOC_RESVSP64_32 _IOW ('X', 42, struct space_resv_32) 1797 + 1798 + /* just account for different alignment */ 1799 + static int compat_ioctl_preallocate(struct file *file, unsigned long arg) 1800 + { 1801 + struct space_resv_32 __user *p32 = (void __user *)arg; 1802 + struct space_resv __user *p = compat_alloc_user_space(sizeof(*p)); 1803 + 1804 + if (copy_in_user(&p->l_type, &p32->l_type, sizeof(s16)) || 1805 + copy_in_user(&p->l_whence, &p32->l_whence, sizeof(s16)) || 1806 + copy_in_user(&p->l_start, &p32->l_start, sizeof(s64)) || 1807 + copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) || 1808 + copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) || 1809 + copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) || 1810 + copy_in_user(&p->l_pad, &p32->l_pad, 4*sizeof(u32))) 1811 + return -EFAULT; 1812 + 1813 + return ioctl_preallocate(file, p); 1814 + } 1815 + #endif 1816 + 1783 1817 1784 1818 typedef int (*ioctl_trans_handler_t)(unsigned int, unsigned int, 1785 1819 unsigned long, struct file *); ··· 2791 2755 case FIOASYNC: 2792 2756 case FIOQSIZE: 2793 2757 break; 2758 + 2759 + #if defined(CONFIG_IA64) || defined(CONFIG_X86_64) 2760 + case FS_IOC_RESVSP_32: 2761 + case FS_IOC_RESVSP64_32: 2762 + error = compat_ioctl_preallocate(filp, arg); 2763 + goto out_fput; 2764 + #else 2765 + case FS_IOC_RESVSP: 2766 + case FS_IOC_RESVSP64: 2767 + error = ioctl_preallocate(filp, (void __user *)arg); 2768 + goto out_fput; 2769 + #endif 2794 2770 2795 2771 case FIBMAP: 2796 2772 case FIGETBSZ:
-10
fs/devpts/inode.c
··· 423 423 } 424 424 425 425 static struct file_system_type devpts_fs_type = { 426 - .owner = THIS_MODULE, 427 426 .name = "devpts", 428 427 .get_sb = devpts_get_sb, 429 428 .kill_sb = devpts_kill_sb, ··· 563 564 } 564 565 return err; 565 566 } 566 - 567 - static void __exit exit_devpts_fs(void) 568 - { 569 - unregister_filesystem(&devpts_fs_type); 570 - mntput(devpts_mnt); 571 - } 572 - 573 567 module_init(init_devpts_fs) 574 - module_exit(exit_devpts_fs) 575 - MODULE_LICENSE("GPL");
+16 -63
fs/ext2/acl.c
··· 125 125 return ERR_PTR(-EINVAL); 126 126 } 127 127 128 - static inline struct posix_acl * 129 - ext2_iget_acl(struct inode *inode, struct posix_acl **i_acl) 130 - { 131 - struct posix_acl *acl = EXT2_ACL_NOT_CACHED; 132 - 133 - spin_lock(&inode->i_lock); 134 - if (*i_acl != EXT2_ACL_NOT_CACHED) 135 - acl = posix_acl_dup(*i_acl); 136 - spin_unlock(&inode->i_lock); 137 - 138 - return acl; 139 - } 140 - 141 - static inline void 142 - ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl, 143 - struct posix_acl *acl) 144 - { 145 - spin_lock(&inode->i_lock); 146 - if (*i_acl != EXT2_ACL_NOT_CACHED) 147 - posix_acl_release(*i_acl); 148 - *i_acl = posix_acl_dup(acl); 149 - spin_unlock(&inode->i_lock); 150 - } 151 - 152 128 /* 153 129 * inode->i_mutex: don't care 154 130 */ 155 131 static struct posix_acl * 156 132 ext2_get_acl(struct inode *inode, int type) 157 133 { 158 - struct ext2_inode_info *ei = EXT2_I(inode); 159 134 int name_index; 160 135 char *value = NULL; 161 136 struct posix_acl *acl; ··· 139 164 if (!test_opt(inode->i_sb, POSIX_ACL)) 140 165 return NULL; 141 166 142 - switch(type) { 143 - case ACL_TYPE_ACCESS: 144 - acl = ext2_iget_acl(inode, &ei->i_acl); 145 - if (acl != EXT2_ACL_NOT_CACHED) 146 - return acl; 147 - name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; 148 - break; 167 + acl = get_cached_acl(inode, type); 168 + if (acl != ACL_NOT_CACHED) 169 + return acl; 149 170 150 - case ACL_TYPE_DEFAULT: 151 - acl = ext2_iget_acl(inode, &ei->i_default_acl); 152 - if (acl != EXT2_ACL_NOT_CACHED) 153 - return acl; 154 - name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; 155 - break; 156 - 157 - default: 158 - return ERR_PTR(-EINVAL); 171 + switch (type) { 172 + case ACL_TYPE_ACCESS: 173 + name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; 174 + break; 175 + case ACL_TYPE_DEFAULT: 176 + name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; 177 + break; 178 + default: 179 + BUG(); 159 180 } 160 181 retval = ext2_xattr_get(inode, name_index, "", NULL, 0); 161 182 if (retval > 0) { ··· 168 197 acl = ERR_PTR(retval); 169 198 kfree(value); 170 199 171 - if (!IS_ERR(acl)) { 172 - switch(type) { 173 - case ACL_TYPE_ACCESS: 174 - ext2_iset_acl(inode, &ei->i_acl, acl); 175 - break; 200 + if (!IS_ERR(acl)) 201 + set_cached_acl(inode, type, acl); 176 202 177 - case ACL_TYPE_DEFAULT: 178 - ext2_iset_acl(inode, &ei->i_default_acl, acl); 179 - break; 180 - } 181 - } 182 203 return acl; 183 204 } 184 205 ··· 180 217 static int 181 218 ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) 182 219 { 183 - struct ext2_inode_info *ei = EXT2_I(inode); 184 220 int name_index; 185 221 void *value = NULL; 186 222 size_t size = 0; ··· 225 263 error = ext2_xattr_set(inode, name_index, "", value, size, 0); 226 264 227 265 kfree(value); 228 - if (!error) { 229 - switch(type) { 230 - case ACL_TYPE_ACCESS: 231 - ext2_iset_acl(inode, &ei->i_acl, acl); 232 - break; 233 - 234 - case ACL_TYPE_DEFAULT: 235 - ext2_iset_acl(inode, &ei->i_default_acl, acl); 236 - break; 237 - } 238 - } 266 + if (!error) 267 + set_cached_acl(inode, type, acl); 239 268 return error; 240 269 } 241 270
-4
fs/ext2/acl.h
··· 53 53 54 54 #ifdef CONFIG_EXT2_FS_POSIX_ACL 55 55 56 - /* Value for inode->u.ext2_i.i_acl and inode->u.ext2_i.i_default_acl 57 - if the ACL has not been cached */ 58 - #define EXT2_ACL_NOT_CACHED ((void *)-1) 59 - 60 56 /* acl.c */ 61 57 extern int ext2_permission (struct inode *, int); 62 58 extern int ext2_acl_chmod (struct inode *);
-4
fs/ext2/ext2.h
··· 47 47 */ 48 48 struct rw_semaphore xattr_sem; 49 49 #endif 50 - #ifdef CONFIG_EXT2_FS_POSIX_ACL 51 - struct posix_acl *i_acl; 52 - struct posix_acl *i_default_acl; 53 - #endif 54 50 rwlock_t i_meta_lock; 55 51 56 52 /*
-4
fs/ext2/inode.c
··· 1224 1224 return inode; 1225 1225 1226 1226 ei = EXT2_I(inode); 1227 - #ifdef CONFIG_EXT2_FS_POSIX_ACL 1228 - ei->i_acl = EXT2_ACL_NOT_CACHED; 1229 - ei->i_default_acl = EXT2_ACL_NOT_CACHED; 1230 - #endif 1231 1227 ei->i_block_alloc_info = NULL; 1232 1228 1233 1229 raw_inode = ext2_get_inode(inode->i_sb, ino, &bh);
-16
fs/ext2/super.c
··· 152 152 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL); 153 153 if (!ei) 154 154 return NULL; 155 - #ifdef CONFIG_EXT2_FS_POSIX_ACL 156 - ei->i_acl = EXT2_ACL_NOT_CACHED; 157 - ei->i_default_acl = EXT2_ACL_NOT_CACHED; 158 - #endif 159 155 ei->i_block_alloc_info = NULL; 160 156 ei->vfs_inode.i_version = 1; 161 157 return &ei->vfs_inode; ··· 194 198 static void ext2_clear_inode(struct inode *inode) 195 199 { 196 200 struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info; 197 - #ifdef CONFIG_EXT2_FS_POSIX_ACL 198 - struct ext2_inode_info *ei = EXT2_I(inode); 199 - 200 - if (ei->i_acl && ei->i_acl != EXT2_ACL_NOT_CACHED) { 201 - posix_acl_release(ei->i_acl); 202 - ei->i_acl = EXT2_ACL_NOT_CACHED; 203 - } 204 - if (ei->i_default_acl && ei->i_default_acl != EXT2_ACL_NOT_CACHED) { 205 - posix_acl_release(ei->i_default_acl); 206 - ei->i_default_acl = EXT2_ACL_NOT_CACHED; 207 - } 208 - #endif 209 201 ext2_discard_reservation(inode); 210 202 EXT2_I(inode)->i_block_alloc_info = NULL; 211 203 if (unlikely(rsv))
+18 -65
fs/ext3/acl.c
··· 126 126 return ERR_PTR(-EINVAL); 127 127 } 128 128 129 - static inline struct posix_acl * 130 - ext3_iget_acl(struct inode *inode, struct posix_acl **i_acl) 131 - { 132 - struct posix_acl *acl = ACCESS_ONCE(*i_acl); 133 - 134 - if (acl) { 135 - spin_lock(&inode->i_lock); 136 - acl = *i_acl; 137 - if (acl != EXT3_ACL_NOT_CACHED) 138 - acl = posix_acl_dup(acl); 139 - spin_unlock(&inode->i_lock); 140 - } 141 - 142 - return acl; 143 - } 144 - 145 - static inline void 146 - ext3_iset_acl(struct inode *inode, struct posix_acl **i_acl, 147 - struct posix_acl *acl) 148 - { 149 - spin_lock(&inode->i_lock); 150 - if (*i_acl != EXT3_ACL_NOT_CACHED) 151 - posix_acl_release(*i_acl); 152 - *i_acl = posix_acl_dup(acl); 153 - spin_unlock(&inode->i_lock); 154 - } 155 - 156 129 /* 157 130 * Inode operation get_posix_acl(). 158 131 * ··· 134 161 static struct posix_acl * 135 162 ext3_get_acl(struct inode *inode, int type) 136 163 { 137 - struct ext3_inode_info *ei = EXT3_I(inode); 138 164 int name_index; 139 165 char *value = NULL; 140 166 struct posix_acl *acl; ··· 142 170 if (!test_opt(inode->i_sb, POSIX_ACL)) 143 171 return NULL; 144 172 145 - switch(type) { 146 - case ACL_TYPE_ACCESS: 147 - acl = ext3_iget_acl(inode, &ei->i_acl); 148 - if (acl != EXT3_ACL_NOT_CACHED) 149 - return acl; 150 - name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS; 151 - break; 173 + acl = get_cached_acl(inode, type); 174 + if (acl != ACL_NOT_CACHED) 175 + return acl; 152 176 153 - case ACL_TYPE_DEFAULT: 154 - acl = ext3_iget_acl(inode, &ei->i_default_acl); 155 - if (acl != EXT3_ACL_NOT_CACHED) 156 - return acl; 157 - name_index = EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT; 158 - break; 159 - 160 - default: 161 - return ERR_PTR(-EINVAL); 177 + switch (type) { 178 + case ACL_TYPE_ACCESS: 179 + name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS; 180 + break; 181 + case ACL_TYPE_DEFAULT: 182 + name_index = EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT; 183 + break; 184 + default: 185 + BUG(); 162 186 } 187 + 163 188 retval = ext3_xattr_get(inode, name_index, "", NULL, 0); 164 189 if (retval > 0) { 165 190 value = kmalloc(retval, GFP_NOFS); ··· 172 203 acl = ERR_PTR(retval); 173 204 kfree(value); 174 205 175 - if (!IS_ERR(acl)) { 176 - switch(type) { 177 - case ACL_TYPE_ACCESS: 178 - ext3_iset_acl(inode, &ei->i_acl, acl); 179 - break; 206 + if (!IS_ERR(acl)) 207 + set_cached_acl(inode, type, acl); 180 208 181 - case ACL_TYPE_DEFAULT: 182 - ext3_iset_acl(inode, &ei->i_default_acl, acl); 183 - break; 184 - } 185 - } 186 209 return acl; 187 210 } 188 211 ··· 187 226 ext3_set_acl(handle_t *handle, struct inode *inode, int type, 188 227 struct posix_acl *acl) 189 228 { 190 - struct ext3_inode_info *ei = EXT3_I(inode); 191 229 int name_index; 192 230 void *value = NULL; 193 231 size_t size = 0; ··· 231 271 value, size, 0); 232 272 233 273 kfree(value); 234 - if (!error) { 235 - switch(type) { 236 - case ACL_TYPE_ACCESS: 237 - ext3_iset_acl(inode, &ei->i_acl, acl); 238 - break; 239 274 240 - case ACL_TYPE_DEFAULT: 241 - ext3_iset_acl(inode, &ei->i_default_acl, acl); 242 - break; 243 - } 244 - } 275 + if (!error) 276 + set_cached_acl(inode, type, acl); 277 + 245 278 return error; 246 279 } 247 280
-4
fs/ext3/acl.h
··· 53 53 54 54 #ifdef CONFIG_EXT3_FS_POSIX_ACL 55 55 56 - /* Value for inode->u.ext3_i.i_acl and inode->u.ext3_i.i_default_acl 57 - if the ACL has not been cached */ 58 - #define EXT3_ACL_NOT_CACHED ((void *)-1) 59 - 60 56 /* acl.c */ 61 57 extern int ext3_permission (struct inode *, int); 62 58 extern int ext3_acl_chmod (struct inode *);
-4
fs/ext3/inode.c
··· 2752 2752 return inode; 2753 2753 2754 2754 ei = EXT3_I(inode); 2755 - #ifdef CONFIG_EXT3_FS_POSIX_ACL 2756 - ei->i_acl = EXT3_ACL_NOT_CACHED; 2757 - ei->i_default_acl = EXT3_ACL_NOT_CACHED; 2758 - #endif 2759 2755 ei->i_block_alloc_info = NULL; 2760 2756 2761 2757 ret = __ext3_get_inode_loc(inode, &iloc, 0);
-16
fs/ext3/super.c
··· 464 464 ei = kmem_cache_alloc(ext3_inode_cachep, GFP_NOFS); 465 465 if (!ei) 466 466 return NULL; 467 - #ifdef CONFIG_EXT3_FS_POSIX_ACL 468 - ei->i_acl = EXT3_ACL_NOT_CACHED; 469 - ei->i_default_acl = EXT3_ACL_NOT_CACHED; 470 - #endif 471 467 ei->i_block_alloc_info = NULL; 472 468 ei->vfs_inode.i_version = 1; 473 469 return &ei->vfs_inode; ··· 514 518 static void ext3_clear_inode(struct inode *inode) 515 519 { 516 520 struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; 517 - #ifdef CONFIG_EXT3_FS_POSIX_ACL 518 - if (EXT3_I(inode)->i_acl && 519 - EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { 520 - posix_acl_release(EXT3_I(inode)->i_acl); 521 - EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; 522 - } 523 - if (EXT3_I(inode)->i_default_acl && 524 - EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { 525 - posix_acl_release(EXT3_I(inode)->i_default_acl); 526 - EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; 527 - } 528 - #endif 529 521 ext3_discard_reservation(inode); 530 522 EXT3_I(inode)->i_block_alloc_info = NULL; 531 523 if (unlikely(rsv))
+9 -58
fs/ext4/acl.c
··· 126 126 return ERR_PTR(-EINVAL); 127 127 } 128 128 129 - static inline struct posix_acl * 130 - ext4_iget_acl(struct inode *inode, struct posix_acl **i_acl) 131 - { 132 - struct posix_acl *acl = ACCESS_ONCE(*i_acl); 133 - 134 - if (acl) { 135 - spin_lock(&inode->i_lock); 136 - acl = *i_acl; 137 - if (acl != EXT4_ACL_NOT_CACHED) 138 - acl = posix_acl_dup(acl); 139 - spin_unlock(&inode->i_lock); 140 - } 141 - 142 - return acl; 143 - } 144 - 145 - static inline void 146 - ext4_iset_acl(struct inode *inode, struct posix_acl **i_acl, 147 - struct posix_acl *acl) 148 - { 149 - spin_lock(&inode->i_lock); 150 - if (*i_acl != EXT4_ACL_NOT_CACHED) 151 - posix_acl_release(*i_acl); 152 - *i_acl = posix_acl_dup(acl); 153 - spin_unlock(&inode->i_lock); 154 - } 155 - 156 129 /* 157 130 * Inode operation get_posix_acl(). 158 131 * ··· 134 161 static struct posix_acl * 135 162 ext4_get_acl(struct inode *inode, int type) 136 163 { 137 - struct ext4_inode_info *ei = EXT4_I(inode); 138 164 int name_index; 139 165 char *value = NULL; 140 166 struct posix_acl *acl; ··· 142 170 if (!test_opt(inode->i_sb, POSIX_ACL)) 143 171 return NULL; 144 172 173 + acl = get_cached_acl(inode, type); 174 + if (acl != ACL_NOT_CACHED) 175 + return acl; 176 + 145 177 switch (type) { 146 178 case ACL_TYPE_ACCESS: 147 - acl = ext4_iget_acl(inode, &ei->i_acl); 148 - if (acl != EXT4_ACL_NOT_CACHED) 149 - return acl; 150 179 name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; 151 180 break; 152 - 153 181 case ACL_TYPE_DEFAULT: 154 - acl = ext4_iget_acl(inode, &ei->i_default_acl); 155 - if (acl != EXT4_ACL_NOT_CACHED) 156 - return acl; 157 182 name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT; 158 183 break; 159 - 160 184 default: 161 - return ERR_PTR(-EINVAL); 185 + BUG(); 162 186 } 163 187 retval = ext4_xattr_get(inode, name_index, "", NULL, 0); 164 188 if (retval > 0) { ··· 171 203 acl = ERR_PTR(retval); 172 204 kfree(value); 173 205 174 - if (!IS_ERR(acl)) { 175 - switch (type) { 176 - case ACL_TYPE_ACCESS: 177 - ext4_iset_acl(inode, &ei->i_acl, acl); 178 - break; 206 + if (!IS_ERR(acl)) 207 + set_cached_acl(inode, type, acl); 179 208 180 - case ACL_TYPE_DEFAULT: 181 - ext4_iset_acl(inode, &ei->i_default_acl, acl); 182 - break; 183 - } 184 - } 185 209 return acl; 186 210 } 187 211 ··· 186 226 ext4_set_acl(handle_t *handle, struct inode *inode, int type, 187 227 struct posix_acl *acl) 188 228 { 189 - struct ext4_inode_info *ei = EXT4_I(inode); 190 229 int name_index; 191 230 void *value = NULL; 192 231 size_t size = 0; ··· 230 271 value, size, 0); 231 272 232 273 kfree(value); 233 - if (!error) { 234 - switch (type) { 235 - case ACL_TYPE_ACCESS: 236 - ext4_iset_acl(inode, &ei->i_acl, acl); 237 - break; 274 + if (!error) 275 + set_cached_acl(inode, type, acl); 238 276 239 - case ACL_TYPE_DEFAULT: 240 - ext4_iset_acl(inode, &ei->i_default_acl, acl); 241 - break; 242 - } 243 - } 244 277 return error; 245 278 } 246 279
-4
fs/ext4/acl.h
··· 53 53 54 54 #ifdef CONFIG_EXT4_FS_POSIX_ACL 55 55 56 - /* Value for inode->u.ext4_i.i_acl and inode->u.ext4_i.i_default_acl 57 - if the ACL has not been cached */ 58 - #define EXT4_ACL_NOT_CACHED ((void *)-1) 59 - 60 56 /* acl.c */ 61 57 extern int ext4_permission(struct inode *, int); 62 58 extern int ext4_acl_chmod(struct inode *);
-4
fs/ext4/ext4.h
··· 595 595 */ 596 596 struct rw_semaphore xattr_sem; 597 597 #endif 598 - #ifdef CONFIG_EXT4_FS_POSIX_ACL 599 - struct posix_acl *i_acl; 600 - struct posix_acl *i_default_acl; 601 - #endif 602 598 603 599 struct list_head i_orphan; /* unlinked but open inodes */ 604 600
-4
fs/ext4/inode.c
··· 4453 4453 return inode; 4454 4454 4455 4455 ei = EXT4_I(inode); 4456 - #ifdef CONFIG_EXT4_FS_POSIX_ACL 4457 - ei->i_acl = EXT4_ACL_NOT_CACHED; 4458 - ei->i_default_acl = EXT4_ACL_NOT_CACHED; 4459 - #endif 4460 4456 4461 4457 ret = __ext4_get_inode_loc(inode, &iloc, 0); 4462 4458 if (ret < 0)
-16
fs/ext4/super.c
··· 666 666 if (!ei) 667 667 return NULL; 668 668 669 - #ifdef CONFIG_EXT4_FS_POSIX_ACL 670 - ei->i_acl = EXT4_ACL_NOT_CACHED; 671 - ei->i_default_acl = EXT4_ACL_NOT_CACHED; 672 - #endif 673 669 ei->vfs_inode.i_version = 1; 674 670 ei->vfs_inode.i_data.writeback_index = 0; 675 671 memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache)); ··· 731 735 732 736 static void ext4_clear_inode(struct inode *inode) 733 737 { 734 - #ifdef CONFIG_EXT4_FS_POSIX_ACL 735 - if (EXT4_I(inode)->i_acl && 736 - EXT4_I(inode)->i_acl != EXT4_ACL_NOT_CACHED) { 737 - posix_acl_release(EXT4_I(inode)->i_acl); 738 - EXT4_I(inode)->i_acl = EXT4_ACL_NOT_CACHED; 739 - } 740 - if (EXT4_I(inode)->i_default_acl && 741 - EXT4_I(inode)->i_default_acl != EXT4_ACL_NOT_CACHED) { 742 - posix_acl_release(EXT4_I(inode)->i_default_acl); 743 - EXT4_I(inode)->i_default_acl = EXT4_ACL_NOT_CACHED; 744 - } 745 - #endif 746 738 ext4_discard_preallocations(inode); 747 739 if (EXT4_JOURNAL(inode)) 748 740 jbd2_journal_release_jbd_inode(EXT4_SB(inode->i_sb)->s_journal,
+50 -50
fs/fs-writeback.c
··· 278 278 EXPORT_SYMBOL(sb_has_dirty_inodes); 279 279 280 280 /* 281 - * Write a single inode's dirty pages and inode data out to disk. 281 + * Wait for writeback on an inode to complete. 282 + */ 283 + static void inode_wait_for_writeback(struct inode *inode) 284 + { 285 + DEFINE_WAIT_BIT(wq, &inode->i_state, __I_SYNC); 286 + wait_queue_head_t *wqh; 287 + 288 + wqh = bit_waitqueue(&inode->i_state, __I_SYNC); 289 + do { 290 + spin_unlock(&inode_lock); 291 + __wait_on_bit(wqh, &wq, inode_wait, TASK_UNINTERRUPTIBLE); 292 + spin_lock(&inode_lock); 293 + } while (inode->i_state & I_SYNC); 294 + } 295 + 296 + /* 297 + * Write out an inode's dirty pages. Called under inode_lock. Either the 298 + * caller has ref on the inode (either via __iget or via syscall against an fd) 299 + * or the inode has I_WILL_FREE set (via generic_forget_inode) 300 + * 282 301 * If `wait' is set, wait on the writeout. 283 302 * 284 303 * The whole writeout design is quite complex and fragile. We want to avoid ··· 307 288 * Called under inode_lock. 308 289 */ 309 290 static int 310 - __sync_single_inode(struct inode *inode, struct writeback_control *wbc) 291 + writeback_single_inode(struct inode *inode, struct writeback_control *wbc) 311 292 { 312 - unsigned dirty; 313 293 struct address_space *mapping = inode->i_mapping; 314 294 int wait = wbc->sync_mode == WB_SYNC_ALL; 295 + unsigned dirty; 315 296 int ret; 297 + 298 + if (!atomic_read(&inode->i_count)) 299 + WARN_ON(!(inode->i_state & (I_WILL_FREE|I_FREEING))); 300 + else 301 + WARN_ON(inode->i_state & I_WILL_FREE); 302 + 303 + if (inode->i_state & I_SYNC) { 304 + /* 305 + * If this inode is locked for writeback and we are not doing 306 + * writeback-for-data-integrity, move it to s_more_io so that 307 + * writeback can proceed with the other inodes on s_io. 308 + * 309 + * We'll have another go at writing back this inode when we 310 + * completed a full scan of s_io. 311 + */ 312 + if (!wait) { 313 + requeue_io(inode); 314 + return 0; 315 + } 316 + 317 + /* 318 + * It's a data-integrity sync. We must wait. 319 + */ 320 + inode_wait_for_writeback(inode); 321 + } 316 322 317 323 BUG_ON(inode->i_state & I_SYNC); 318 324 ··· 434 390 } 435 391 436 392 /* 437 - * Write out an inode's dirty pages. Called under inode_lock. Either the 438 - * caller has ref on the inode (either via __iget or via syscall against an fd) 439 - * or the inode has I_WILL_FREE set (via generic_forget_inode) 440 - */ 441 - static int 442 - __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) 443 - { 444 - wait_queue_head_t *wqh; 445 - 446 - if (!atomic_read(&inode->i_count)) 447 - WARN_ON(!(inode->i_state & (I_WILL_FREE|I_FREEING))); 448 - else 449 - WARN_ON(inode->i_state & I_WILL_FREE); 450 - 451 - if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_SYNC)) { 452 - /* 453 - * We're skipping this inode because it's locked, and we're not 454 - * doing writeback-for-data-integrity. Move it to s_more_io so 455 - * that writeback can proceed with the other inodes on s_io. 456 - * We'll have another go at writing back this inode when we 457 - * completed a full scan of s_io. 458 - */ 459 - requeue_io(inode); 460 - return 0; 461 - } 462 - 463 - /* 464 - * It's a data-integrity sync. We must wait. 465 - */ 466 - if (inode->i_state & I_SYNC) { 467 - DEFINE_WAIT_BIT(wq, &inode->i_state, __I_SYNC); 468 - 469 - wqh = bit_waitqueue(&inode->i_state, __I_SYNC); 470 - do { 471 - spin_unlock(&inode_lock); 472 - __wait_on_bit(wqh, &wq, inode_wait, 473 - TASK_UNINTERRUPTIBLE); 474 - spin_lock(&inode_lock); 475 - } while (inode->i_state & I_SYNC); 476 - } 477 - return __sync_single_inode(inode, wbc); 478 - } 479 - 480 - /* 481 393 * Write out a superblock's list of dirty inodes. A wait will be performed 482 394 * upon no inodes, all inodes or the final one, depending upon sync_mode. 483 395 * ··· 526 526 BUG_ON(inode->i_state & (I_FREEING | I_CLEAR)); 527 527 __iget(inode); 528 528 pages_skipped = wbc->pages_skipped; 529 - __writeback_single_inode(inode, wbc); 529 + writeback_single_inode(inode, wbc); 530 530 if (current_is_pdflush()) 531 531 writeback_release(bdi); 532 532 if (wbc->pages_skipped != pages_skipped) { ··· 708 708 709 709 might_sleep(); 710 710 spin_lock(&inode_lock); 711 - ret = __writeback_single_inode(inode, &wbc); 711 + ret = writeback_single_inode(inode, &wbc); 712 712 spin_unlock(&inode_lock); 713 713 if (sync) 714 714 inode_sync_wait(inode); ··· 732 732 int ret; 733 733 734 734 spin_lock(&inode_lock); 735 - ret = __writeback_single_inode(inode, wbc); 735 + ret = writeback_single_inode(inode, wbc); 736 736 spin_unlock(&inode_lock); 737 737 return ret; 738 738 }
+10
fs/inode.c
··· 25 25 #include <linux/fsnotify.h> 26 26 #include <linux/mount.h> 27 27 #include <linux/async.h> 28 + #include <linux/posix_acl.h> 28 29 29 30 /* 30 31 * This is needed for the following functions: ··· 190 189 } 191 190 inode->i_private = NULL; 192 191 inode->i_mapping = mapping; 192 + #ifdef CONFIG_FS_POSIX_ACL 193 + inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED; 194 + #endif 193 195 194 196 #ifdef CONFIG_FSNOTIFY 195 197 inode->i_fsnotify_mask = 0; ··· 231 227 ima_inode_free(inode); 232 228 security_inode_free(inode); 233 229 fsnotify_inode_delete(inode); 230 + #ifdef CONFIG_FS_POSIX_ACL 231 + if (inode->i_acl && inode->i_acl != ACL_NOT_CACHED) 232 + posix_acl_release(inode->i_acl); 233 + if (inode->i_default_acl && inode->i_default_acl != ACL_NOT_CACHED) 234 + posix_acl_release(inode->i_default_acl); 235 + #endif 234 236 if (inode->i_sb->s_op->destroy_inode) 235 237 inode->i_sb->s_op->destroy_inode(inode); 236 238 else
+35
fs/ioctl.c
··· 15 15 #include <linux/uaccess.h> 16 16 #include <linux/writeback.h> 17 17 #include <linux/buffer_head.h> 18 + #include <linux/falloc.h> 18 19 19 20 #include <asm/ioctls.h> 20 21 ··· 404 403 405 404 #endif /* CONFIG_BLOCK */ 406 405 406 + /* 407 + * This provides compatibility with legacy XFS pre-allocation ioctls 408 + * which predate the fallocate syscall. 409 + * 410 + * Only the l_start, l_len and l_whence fields of the 'struct space_resv' 411 + * are used here, rest are ignored. 412 + */ 413 + int ioctl_preallocate(struct file *filp, void __user *argp) 414 + { 415 + struct inode *inode = filp->f_path.dentry->d_inode; 416 + struct space_resv sr; 417 + 418 + if (copy_from_user(&sr, argp, sizeof(sr))) 419 + return -EFAULT; 420 + 421 + switch (sr.l_whence) { 422 + case SEEK_SET: 423 + break; 424 + case SEEK_CUR: 425 + sr.l_start += filp->f_pos; 426 + break; 427 + case SEEK_END: 428 + sr.l_start += i_size_read(inode); 429 + break; 430 + default: 431 + return -EINVAL; 432 + } 433 + 434 + return do_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len); 435 + } 436 + 407 437 static int file_ioctl(struct file *filp, unsigned int cmd, 408 438 unsigned long arg) 409 439 { ··· 446 414 return ioctl_fibmap(filp, p); 447 415 case FIONREAD: 448 416 return put_user(i_size_read(inode) - filp->f_pos, p); 417 + case FS_IOC_RESVSP: 418 + case FS_IOC_RESVSP64: 419 + return ioctl_preallocate(filp, p); 449 420 } 450 421 451 422 return vfs_ioctl(filp, cmd, arg);
+17 -71
fs/jffs2/acl.c
··· 156 156 return ERR_PTR(-EINVAL); 157 157 } 158 158 159 - static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **i_acl) 160 - { 161 - struct posix_acl *acl = JFFS2_ACL_NOT_CACHED; 162 - 163 - spin_lock(&inode->i_lock); 164 - if (*i_acl != JFFS2_ACL_NOT_CACHED) 165 - acl = posix_acl_dup(*i_acl); 166 - spin_unlock(&inode->i_lock); 167 - return acl; 168 - } 169 - 170 - static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl) 171 - { 172 - spin_lock(&inode->i_lock); 173 - if (*i_acl != JFFS2_ACL_NOT_CACHED) 174 - posix_acl_release(*i_acl); 175 - *i_acl = posix_acl_dup(acl); 176 - spin_unlock(&inode->i_lock); 177 - } 178 - 179 159 static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) 180 160 { 181 - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 182 161 struct posix_acl *acl; 183 162 char *value = NULL; 184 163 int rc, xprefix; 185 164 165 + acl = get_cached_acl(inode, type); 166 + if (acl != ACL_NOT_CACHED) 167 + return acl; 168 + 186 169 switch (type) { 187 170 case ACL_TYPE_ACCESS: 188 - acl = jffs2_iget_acl(inode, &f->i_acl_access); 189 - if (acl != JFFS2_ACL_NOT_CACHED) 190 - return acl; 191 171 xprefix = JFFS2_XPREFIX_ACL_ACCESS; 192 172 break; 193 173 case ACL_TYPE_DEFAULT: 194 - acl = jffs2_iget_acl(inode, &f->i_acl_default); 195 - if (acl != JFFS2_ACL_NOT_CACHED) 196 - return acl; 197 174 xprefix = JFFS2_XPREFIX_ACL_DEFAULT; 198 175 break; 199 176 default: 200 - return ERR_PTR(-EINVAL); 177 + BUG(); 201 178 } 202 179 rc = do_jffs2_getxattr(inode, xprefix, "", NULL, 0); 203 180 if (rc > 0) { ··· 192 215 } 193 216 if (value) 194 217 kfree(value); 195 - if (!IS_ERR(acl)) { 196 - switch (type) { 197 - case ACL_TYPE_ACCESS: 198 - jffs2_iset_acl(inode, &f->i_acl_access, acl); 199 - break; 200 - case ACL_TYPE_DEFAULT: 201 - jffs2_iset_acl(inode, &f->i_acl_default, acl); 202 - break; 203 - } 204 - } 218 + if (!IS_ERR(acl)) 219 + set_cached_acl(inode, type, acl); 205 220 return acl; 206 221 } 207 222 ··· 218 249 219 250 static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) 220 251 { 221 - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 222 252 int rc, xprefix; 223 253 224 254 if (S_ISLNK(inode->i_mode)) ··· 253 285 return -EINVAL; 254 286 } 255 287 rc = __jffs2_set_acl(inode, xprefix, acl); 256 - if (!rc) { 257 - switch(type) { 258 - case ACL_TYPE_ACCESS: 259 - jffs2_iset_acl(inode, &f->i_acl_access, acl); 260 - break; 261 - case ACL_TYPE_DEFAULT: 262 - jffs2_iset_acl(inode, &f->i_acl_default, acl); 263 - break; 264 - } 265 - } 288 + if (!rc) 289 + set_cached_acl(inode, type, acl); 266 290 return rc; 267 291 } 268 292 ··· 281 321 282 322 int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode) 283 323 { 284 - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 285 324 struct posix_acl *acl, *clone; 286 325 int rc; 287 326 288 - f->i_acl_default = NULL; 289 - f->i_acl_access = NULL; 327 + inode->i_default_acl = NULL; 328 + inode->i_acl = NULL; 290 329 291 330 if (S_ISLNK(*i_mode)) 292 331 return 0; /* Symlink always has no-ACL */ ··· 298 339 *i_mode &= ~current_umask(); 299 340 } else { 300 341 if (S_ISDIR(*i_mode)) 301 - jffs2_iset_acl(inode, &f->i_acl_default, acl); 342 + set_cached_acl(inode, ACL_TYPE_DEFAULT, acl); 302 343 303 344 clone = posix_acl_clone(acl, GFP_KERNEL); 304 345 if (!clone) ··· 309 350 return rc; 310 351 } 311 352 if (rc > 0) 312 - jffs2_iset_acl(inode, &f->i_acl_access, clone); 353 + set_cached_acl(inode, ACL_TYPE_ACCESS, clone); 313 354 314 355 posix_acl_release(clone); 315 356 } ··· 318 359 319 360 int jffs2_init_acl_post(struct inode *inode) 320 361 { 321 - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 322 362 int rc; 323 363 324 - if (f->i_acl_default) { 325 - rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, f->i_acl_default); 364 + if (inode->i_default_acl) { 365 + rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, inode->i_default_acl); 326 366 if (rc) 327 367 return rc; 328 368 } 329 369 330 - if (f->i_acl_access) { 331 - rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, f->i_acl_access); 370 + if (inode->i_acl) { 371 + rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, inode->i_acl); 332 372 if (rc) 333 373 return rc; 334 374 } 335 375 336 376 return 0; 337 - } 338 - 339 - void jffs2_clear_acl(struct jffs2_inode_info *f) 340 - { 341 - if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) { 342 - posix_acl_release(f->i_acl_access); 343 - f->i_acl_access = JFFS2_ACL_NOT_CACHED; 344 - } 345 - if (f->i_acl_default && f->i_acl_default != JFFS2_ACL_NOT_CACHED) { 346 - posix_acl_release(f->i_acl_default); 347 - f->i_acl_default = JFFS2_ACL_NOT_CACHED; 348 - } 349 377 } 350 378 351 379 int jffs2_acl_chmod(struct inode *inode)
-4
fs/jffs2/acl.h
··· 26 26 27 27 #ifdef CONFIG_JFFS2_FS_POSIX_ACL 28 28 29 - #define JFFS2_ACL_NOT_CACHED ((void *)-1) 30 - 31 29 extern int jffs2_permission(struct inode *, int); 32 30 extern int jffs2_acl_chmod(struct inode *); 33 31 extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); 34 32 extern int jffs2_init_acl_post(struct inode *); 35 - extern void jffs2_clear_acl(struct jffs2_inode_info *); 36 33 37 34 extern struct xattr_handler jffs2_acl_access_xattr_handler; 38 35 extern struct xattr_handler jffs2_acl_default_xattr_handler; ··· 40 43 #define jffs2_acl_chmod(inode) (0) 41 44 #define jffs2_init_acl_pre(dir_i,inode,mode) (0) 42 45 #define jffs2_init_acl_post(inode) (0) 43 - #define jffs2_clear_acl(f) 44 46 45 47 #endif /* CONFIG_JFFS2_FS_POSIX_ACL */
-4
fs/jffs2/jffs2_fs_i.h
··· 50 50 uint16_t flags; 51 51 uint8_t usercompr; 52 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 55 #endif /* _JFFS2_FS_I */
-4
fs/jffs2/os-linux.h
··· 56 56 f->target = NULL; 57 57 f->flags = 0; 58 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
-1
fs/jffs2/readinode.c
··· 1424 1424 struct jffs2_full_dirent *fd, *fds; 1425 1425 int deleted; 1426 1426 1427 - jffs2_clear_acl(f); 1428 1427 jffs2_xattr_delete_inode(c, f->inocache); 1429 1428 mutex_lock(&f->sem); 1430 1429 deleted = f->inocache && !f->inocache->pino_nlink;
+16 -26
fs/jfs/acl.c
··· 31 31 { 32 32 struct posix_acl *acl; 33 33 char *ea_name; 34 - struct jfs_inode_info *ji = JFS_IP(inode); 35 - struct posix_acl **p_acl; 36 34 int size; 37 35 char *value = NULL; 36 + 37 + acl = get_cached_acl(inode, type); 38 + if (acl != ACL_NOT_CACHED) 39 + return acl; 38 40 39 41 switch(type) { 40 42 case ACL_TYPE_ACCESS: 41 43 ea_name = POSIX_ACL_XATTR_ACCESS; 42 - p_acl = &ji->i_acl; 43 44 break; 44 45 case ACL_TYPE_DEFAULT: 45 46 ea_name = POSIX_ACL_XATTR_DEFAULT; 46 - p_acl = &ji->i_default_acl; 47 47 break; 48 48 default: 49 49 return ERR_PTR(-EINVAL); 50 50 } 51 - 52 - if (*p_acl != JFS_ACL_NOT_CACHED) 53 - return posix_acl_dup(*p_acl); 54 51 55 52 size = __jfs_getxattr(inode, ea_name, NULL, 0); 56 53 ··· 59 62 } 60 63 61 64 if (size < 0) { 62 - if (size == -ENODATA) { 63 - *p_acl = NULL; 65 + if (size == -ENODATA) 64 66 acl = NULL; 65 - } else 67 + else 66 68 acl = ERR_PTR(size); 67 69 } else { 68 70 acl = posix_acl_from_xattr(value, size); 69 - if (!IS_ERR(acl)) 70 - *p_acl = posix_acl_dup(acl); 71 71 } 72 72 kfree(value); 73 + if (!IS_ERR(acl)) { 74 + set_cached_acl(inode, type, acl); 75 + posix_acl_release(acl); 76 + } 73 77 return acl; 74 78 } 75 79 ··· 78 80 struct posix_acl *acl) 79 81 { 80 82 char *ea_name; 81 - struct jfs_inode_info *ji = JFS_IP(inode); 82 - struct posix_acl **p_acl; 83 83 int rc; 84 84 int size = 0; 85 85 char *value = NULL; ··· 88 92 switch(type) { 89 93 case ACL_TYPE_ACCESS: 90 94 ea_name = POSIX_ACL_XATTR_ACCESS; 91 - p_acl = &ji->i_acl; 92 95 break; 93 96 case ACL_TYPE_DEFAULT: 94 97 ea_name = POSIX_ACL_XATTR_DEFAULT; 95 - p_acl = &ji->i_default_acl; 96 98 if (!S_ISDIR(inode->i_mode)) 97 99 return acl ? -EACCES : 0; 98 100 break; ··· 110 116 out: 111 117 kfree(value); 112 118 113 - if (!rc) { 114 - if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) 115 - posix_acl_release(*p_acl); 116 - *p_acl = posix_acl_dup(acl); 117 - } 119 + if (!rc) 120 + set_cached_acl(inode, type, acl); 121 + 118 122 return rc; 119 123 } 120 124 121 125 static int jfs_check_acl(struct inode *inode, int mask) 122 126 { 123 - struct jfs_inode_info *ji = JFS_IP(inode); 124 - 125 - if (ji->i_acl == JFS_ACL_NOT_CACHED) { 127 + if (inode->i_acl == ACL_NOT_CACHED) { 126 128 struct posix_acl *acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); 127 129 if (IS_ERR(acl)) 128 130 return PTR_ERR(acl); 129 131 posix_acl_release(acl); 130 132 } 131 133 132 - if (ji->i_acl) 133 - return posix_acl_permission(inode, ji->i_acl, mask); 134 + if (inode->i_acl) 135 + return posix_acl_permission(inode, inode->i_acl, mask); 134 136 return -EAGAIN; 135 137 } 136 138
-6
fs/jfs/jfs_incore.h
··· 74 74 /* xattr_sem allows us to access the xattrs without taking i_mutex */ 75 75 struct rw_semaphore xattr_sem; 76 76 lid_t xtlid; /* lid of xtree lock on directory */ 77 - #ifdef CONFIG_JFS_POSIX_ACL 78 - struct posix_acl *i_acl; 79 - struct posix_acl *i_default_acl; 80 - #endif 81 77 union { 82 78 struct { 83 79 xtpage_t _xtroot; /* 288: xtree root */ ··· 102 106 #define i_dtroot u.dir._dtroot 103 107 #define i_inline u.link._inline 104 108 #define i_inline_ea u.link._inline_ea 105 - 106 - #define JFS_ACL_NOT_CACHED ((void *)-1) 107 109 108 110 #define IREAD_LOCK(ip, subclass) \ 109 111 down_read_nested(&JFS_IP(ip)->rdwrlock, subclass)
-16
fs/jfs/super.c
··· 128 128 ji->active_ag = -1; 129 129 } 130 130 spin_unlock_irq(&ji->ag_lock); 131 - 132 - #ifdef CONFIG_JFS_POSIX_ACL 133 - if (ji->i_acl != JFS_ACL_NOT_CACHED) { 134 - posix_acl_release(ji->i_acl); 135 - ji->i_acl = JFS_ACL_NOT_CACHED; 136 - } 137 - if (ji->i_default_acl != JFS_ACL_NOT_CACHED) { 138 - posix_acl_release(ji->i_default_acl); 139 - ji->i_default_acl = JFS_ACL_NOT_CACHED; 140 - } 141 - #endif 142 - 143 131 kmem_cache_free(jfs_inode_cachep, ji); 144 132 } 145 133 ··· 786 798 init_rwsem(&jfs_ip->xattr_sem); 787 799 spin_lock_init(&jfs_ip->ag_lock); 788 800 jfs_ip->active_ag = -1; 789 - #ifdef CONFIG_JFS_POSIX_ACL 790 - jfs_ip->i_acl = JFS_ACL_NOT_CACHED; 791 - jfs_ip->i_default_acl = JFS_ACL_NOT_CACHED; 792 - #endif 793 801 inode_init_once(&jfs_ip->vfs_inode); 794 802 } 795 803
+2 -8
fs/jfs/xattr.c
··· 727 727 /* 728 728 * We're changing the ACL. Get rid of the cached one 729 729 */ 730 - acl =JFS_IP(inode)->i_acl; 731 - if (acl != JFS_ACL_NOT_CACHED) 732 - posix_acl_release(acl); 733 - JFS_IP(inode)->i_acl = JFS_ACL_NOT_CACHED; 730 + forget_cached_acl(inode, ACL_TYPE_ACCESS); 734 731 735 732 return 0; 736 733 } else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) { ··· 743 746 /* 744 747 * We're changing the default ACL. Get rid of the cached one 745 748 */ 746 - acl =JFS_IP(inode)->i_default_acl; 747 - if (acl && (acl != JFS_ACL_NOT_CACHED)) 748 - posix_acl_release(acl); 749 - JFS_IP(inode)->i_default_acl = JFS_ACL_NOT_CACHED; 749 + forget_cached_acl(inode, ACL_TYPE_DEFAULT); 750 750 751 751 return 0; 752 752 }
+10 -1
fs/namei.c
··· 1698 1698 if (error) 1699 1699 return ERR_PTR(error); 1700 1700 error = path_walk(pathname, &nd); 1701 - if (error) 1701 + if (error) { 1702 + if (nd.root.mnt) 1703 + path_put(&nd.root); 1702 1704 return ERR_PTR(error); 1705 + } 1703 1706 if (unlikely(!audit_dummy_context())) 1704 1707 audit_inode(pathname, nd.path.dentry); 1705 1708 ··· 1762 1759 } 1763 1760 filp = nameidata_to_filp(&nd, open_flag); 1764 1761 mnt_drop_write(nd.path.mnt); 1762 + if (nd.root.mnt) 1763 + path_put(&nd.root); 1765 1764 return filp; 1766 1765 } 1767 1766 ··· 1824 1819 */ 1825 1820 if (will_write) 1826 1821 mnt_drop_write(nd.path.mnt); 1822 + if (nd.root.mnt) 1823 + path_put(&nd.root); 1827 1824 return filp; 1828 1825 1829 1826 exit_mutex_unlock: ··· 1866 1859 * with "intent.open". 1867 1860 */ 1868 1861 release_open_intent(&nd); 1862 + if (nd.root.mnt) 1863 + path_put(&nd.root); 1869 1864 return ERR_PTR(error); 1870 1865 } 1871 1866 nd.flags &= ~LOOKUP_PARENT;
+24 -13
fs/namespace.c
··· 42 42 static int event; 43 43 static DEFINE_IDA(mnt_id_ida); 44 44 static DEFINE_IDA(mnt_group_ida); 45 + static int mnt_id_start = 0; 46 + static int mnt_group_start = 1; 45 47 46 48 static struct list_head *mount_hashtable __read_mostly; 47 49 static struct kmem_cache *mnt_cache __read_mostly; ··· 71 69 retry: 72 70 ida_pre_get(&mnt_id_ida, GFP_KERNEL); 73 71 spin_lock(&vfsmount_lock); 74 - res = ida_get_new(&mnt_id_ida, &mnt->mnt_id); 72 + res = ida_get_new_above(&mnt_id_ida, mnt_id_start, &mnt->mnt_id); 73 + if (!res) 74 + mnt_id_start = mnt->mnt_id + 1; 75 75 spin_unlock(&vfsmount_lock); 76 76 if (res == -EAGAIN) 77 77 goto retry; ··· 83 79 84 80 static void mnt_free_id(struct vfsmount *mnt) 85 81 { 82 + int id = mnt->mnt_id; 86 83 spin_lock(&vfsmount_lock); 87 - ida_remove(&mnt_id_ida, mnt->mnt_id); 84 + ida_remove(&mnt_id_ida, id); 85 + if (mnt_id_start > id) 86 + mnt_id_start = id; 88 87 spin_unlock(&vfsmount_lock); 89 88 } 90 89 ··· 98 91 */ 99 92 static int mnt_alloc_group_id(struct vfsmount *mnt) 100 93 { 94 + int res; 95 + 101 96 if (!ida_pre_get(&mnt_group_ida, GFP_KERNEL)) 102 97 return -ENOMEM; 103 98 104 - return ida_get_new_above(&mnt_group_ida, 1, &mnt->mnt_group_id); 99 + res = ida_get_new_above(&mnt_group_ida, 100 + mnt_group_start, 101 + &mnt->mnt_group_id); 102 + if (!res) 103 + mnt_group_start = mnt->mnt_group_id + 1; 104 + 105 + return res; 105 106 } 106 107 107 108 /* ··· 117 102 */ 118 103 void mnt_release_group_id(struct vfsmount *mnt) 119 104 { 120 - ida_remove(&mnt_group_ida, mnt->mnt_group_id); 105 + int id = mnt->mnt_group_id; 106 + ida_remove(&mnt_group_ida, id); 107 + if (mnt_group_start > id) 108 + mnt_group_start = id; 121 109 mnt->mnt_group_id = 0; 122 110 } 123 111 ··· 2240 2222 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); 2241 2223 if (IS_ERR(mnt)) 2242 2224 panic("Can't create rootfs"); 2243 - ns = kmalloc(sizeof(*ns), GFP_KERNEL); 2244 - if (!ns) 2225 + ns = create_mnt_ns(mnt); 2226 + if (IS_ERR(ns)) 2245 2227 panic("Can't allocate initial namespace"); 2246 - atomic_set(&ns->count, 1); 2247 - INIT_LIST_HEAD(&ns->list); 2248 - init_waitqueue_head(&ns->poll); 2249 - ns->event = 0; 2250 - list_add(&mnt->mnt_list, &ns->list); 2251 - ns->root = mnt; 2252 - mnt->mnt_ns = ns; 2253 2228 2254 2229 init_task.nsproxy->mnt_ns = ns; 2255 2230 get_mnt_ns(ns);
-8
fs/nilfs2/inode.c
··· 309 309 /* ii->i_file_acl = 0; */ 310 310 /* ii->i_dir_acl = 0; */ 311 311 ii->i_dir_start_lookup = 0; 312 - #ifdef CONFIG_NILFS_FS_POSIX_ACL 313 - ii->i_acl = NULL; 314 - ii->i_default_acl = NULL; 315 - #endif 316 312 ii->i_cno = 0; 317 313 nilfs_set_inode_flags(inode); 318 314 spin_lock(&sbi->s_next_gen_lock); ··· 430 434 431 435 raw_inode = nilfs_ifile_map_inode(sbi->s_ifile, ino, bh); 432 436 433 - #ifdef CONFIG_NILFS_FS_POSIX_ACL 434 - ii->i_acl = NILFS_ACL_NOT_CACHED; 435 - ii->i_default_acl = NILFS_ACL_NOT_CACHED; 436 - #endif 437 437 if (nilfs_read_inode_common(inode, raw_inode)) 438 438 goto failed_unmap; 439 439
-4
fs/nilfs2/nilfs.h
··· 58 58 */ 59 59 struct rw_semaphore xattr_sem; 60 60 #endif 61 - #ifdef CONFIG_NILFS_POSIX_ACL 62 - struct posix_acl *i_acl; 63 - struct posix_acl *i_default_acl; 64 - #endif 65 61 struct buffer_head *i_bh; /* i_bh contains a new or dirty 66 62 disk inode */ 67 63 struct inode vfs_inode;
-10
fs/nilfs2/super.c
··· 189 189 { 190 190 struct nilfs_inode_info *ii = NILFS_I(inode); 191 191 192 - #ifdef CONFIG_NILFS_POSIX_ACL 193 - if (ii->i_acl && ii->i_acl != NILFS_ACL_NOT_CACHED) { 194 - posix_acl_release(ii->i_acl); 195 - ii->i_acl = NILFS_ACL_NOT_CACHED; 196 - } 197 - if (ii->i_default_acl && ii->i_default_acl != NILFS_ACL_NOT_CACHED) { 198 - posix_acl_release(ii->i_default_acl); 199 - ii->i_default_acl = NILFS_ACL_NOT_CACHED; 200 - } 201 - #endif 202 192 /* 203 193 * Free resources allocated in nilfs_read_inode(), here. 204 194 */
+29 -29
fs/open.c
··· 378 378 #endif 379 379 #endif /* BITS_PER_LONG == 32 */ 380 380 381 - SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) 381 + 382 + int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) 382 383 { 383 - struct file *file; 384 - struct inode *inode; 385 - long ret = -EINVAL; 384 + struct inode *inode = file->f_path.dentry->d_inode; 385 + long ret; 386 386 387 387 if (offset < 0 || len <= 0) 388 - goto out; 388 + return -EINVAL; 389 389 390 390 /* Return error if mode is not supported */ 391 - ret = -EOPNOTSUPP; 392 391 if (mode && !(mode & FALLOC_FL_KEEP_SIZE)) 393 - goto out; 392 + return -EOPNOTSUPP; 394 393 395 - ret = -EBADF; 396 - file = fget(fd); 397 - if (!file) 398 - goto out; 399 394 if (!(file->f_mode & FMODE_WRITE)) 400 - goto out_fput; 395 + return -EBADF; 401 396 /* 402 397 * Revalidate the write permissions, in case security policy has 403 398 * changed since the files were opened. 404 399 */ 405 400 ret = security_file_permission(file, MAY_WRITE); 406 401 if (ret) 407 - goto out_fput; 402 + return ret; 408 403 409 - inode = file->f_path.dentry->d_inode; 410 - 411 - ret = -ESPIPE; 412 404 if (S_ISFIFO(inode->i_mode)) 413 - goto out_fput; 405 + return -ESPIPE; 414 406 415 - ret = -ENODEV; 416 407 /* 417 408 * Let individual file system decide if it supports preallocation 418 409 * for directories or not. 419 410 */ 420 411 if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) 421 - goto out_fput; 412 + return -ENODEV; 422 413 423 - ret = -EFBIG; 424 414 /* Check for wrap through zero too */ 425 415 if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) 426 - goto out_fput; 416 + return -EFBIG; 427 417 428 - if (inode->i_op->fallocate) 429 - ret = inode->i_op->fallocate(inode, mode, offset, len); 430 - else 431 - ret = -EOPNOTSUPP; 418 + if (!inode->i_op->fallocate) 419 + return -EOPNOTSUPP; 432 420 433 - out_fput: 434 - fput(file); 435 - out: 436 - return ret; 421 + return inode->i_op->fallocate(inode, mode, offset, len); 437 422 } 423 + 424 + SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) 425 + { 426 + struct file *file; 427 + int error = -EBADF; 428 + 429 + file = fget(fd); 430 + if (file) { 431 + error = do_fallocate(file, mode, offset, len); 432 + fput(file); 433 + } 434 + 435 + return error; 436 + } 437 + 438 438 #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 439 439 asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len) 440 440 {
-4
fs/reiserfs/inode.c
··· 1131 1131 REISERFS_I(inode)->i_trans_id = 0; 1132 1132 REISERFS_I(inode)->i_jl = NULL; 1133 1133 mutex_init(&(REISERFS_I(inode)->i_mmap)); 1134 - reiserfs_init_acl_access(inode); 1135 - reiserfs_init_acl_default(inode); 1136 1134 reiserfs_init_xattr_rwsem(inode); 1137 1135 1138 1136 if (stat_data_v1(ih)) { ··· 1832 1834 REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK; 1833 1835 sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode); 1834 1836 mutex_init(&(REISERFS_I(inode)->i_mmap)); 1835 - reiserfs_init_acl_access(inode); 1836 - reiserfs_init_acl_default(inode); 1837 1837 reiserfs_init_xattr_rwsem(inode); 1838 1838 1839 1839 /* key to search for correct place for new stat data */
-1
fs/reiserfs/resize.c
··· 82 82 if (reiserfs_allocate_list_bitmaps(s, jbitmap, bmap_nr_new) < 0) { 83 83 printk 84 84 ("reiserfs_resize: unable to allocate memory for journal bitmaps\n"); 85 - unlock_super(s); 86 85 return -ENOMEM; 87 86 } 88 87 /* the new journal bitmaps are zero filled, now we copy in the bitmap
-24
fs/reiserfs/super.c
··· 529 529 530 530 INIT_LIST_HEAD(&ei->i_prealloc_list); 531 531 inode_init_once(&ei->vfs_inode); 532 - #ifdef CONFIG_REISERFS_FS_POSIX_ACL 533 - ei->i_acl_access = NULL; 534 - ei->i_acl_default = NULL; 535 - #endif 536 532 } 537 533 538 534 static int init_inodecache(void) ··· 576 580 reiserfs_write_unlock(inode->i_sb); 577 581 } 578 582 579 - #ifdef CONFIG_REISERFS_FS_POSIX_ACL 580 - static void reiserfs_clear_inode(struct inode *inode) 581 - { 582 - struct posix_acl *acl; 583 - 584 - acl = REISERFS_I(inode)->i_acl_access; 585 - if (acl && !IS_ERR(acl)) 586 - posix_acl_release(acl); 587 - REISERFS_I(inode)->i_acl_access = NULL; 588 - 589 - acl = REISERFS_I(inode)->i_acl_default; 590 - if (acl && !IS_ERR(acl)) 591 - posix_acl_release(acl); 592 - REISERFS_I(inode)->i_acl_default = NULL; 593 - } 594 - #else 595 - #define reiserfs_clear_inode NULL 596 - #endif 597 - 598 583 #ifdef CONFIG_QUOTA 599 584 static ssize_t reiserfs_quota_write(struct super_block *, int, const char *, 600 585 size_t, loff_t); ··· 589 612 .write_inode = reiserfs_write_inode, 590 613 .dirty_inode = reiserfs_dirty_inode, 591 614 .delete_inode = reiserfs_delete_inode, 592 - .clear_inode = reiserfs_clear_inode, 593 615 .put_super = reiserfs_put_super, 594 616 .write_super = reiserfs_write_super, 595 617 .sync_fs = reiserfs_sync_fs,
+11 -47
fs/reiserfs/xattr_acl.c
··· 188 188 return ERR_PTR(-EINVAL); 189 189 } 190 190 191 - static inline void iset_acl(struct inode *inode, struct posix_acl **i_acl, 192 - struct posix_acl *acl) 193 - { 194 - spin_lock(&inode->i_lock); 195 - if (*i_acl != ERR_PTR(-ENODATA)) 196 - posix_acl_release(*i_acl); 197 - *i_acl = posix_acl_dup(acl); 198 - spin_unlock(&inode->i_lock); 199 - } 200 - 201 - static inline struct posix_acl *iget_acl(struct inode *inode, 202 - struct posix_acl **i_acl) 203 - { 204 - struct posix_acl *acl = ERR_PTR(-ENODATA); 205 - 206 - spin_lock(&inode->i_lock); 207 - if (*i_acl != ERR_PTR(-ENODATA)) 208 - acl = posix_acl_dup(*i_acl); 209 - spin_unlock(&inode->i_lock); 210 - 211 - return acl; 212 - } 213 - 214 191 /* 215 192 * Inode operation get_posix_acl(). 216 193 * ··· 197 220 struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) 198 221 { 199 222 char *name, *value; 200 - struct posix_acl *acl, **p_acl; 223 + struct posix_acl *acl; 201 224 int size; 202 225 int retval; 203 - struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); 226 + 227 + acl = get_cached_acl(inode, type); 228 + if (acl != ACL_NOT_CACHED) 229 + return acl; 204 230 205 231 switch (type) { 206 232 case ACL_TYPE_ACCESS: 207 233 name = POSIX_ACL_XATTR_ACCESS; 208 - p_acl = &reiserfs_i->i_acl_access; 209 234 break; 210 235 case ACL_TYPE_DEFAULT: 211 236 name = POSIX_ACL_XATTR_DEFAULT; 212 - p_acl = &reiserfs_i->i_acl_default; 213 237 break; 214 238 default: 215 - return ERR_PTR(-EINVAL); 239 + BUG(); 216 240 } 217 - 218 - acl = iget_acl(inode, p_acl); 219 - if (acl && !IS_ERR(acl)) 220 - return acl; 221 - else if (PTR_ERR(acl) == -ENODATA) 222 - return NULL; 223 241 224 242 size = reiserfs_xattr_get(inode, name, NULL, 0); 225 243 if (size < 0) { 226 244 if (size == -ENODATA || size == -ENOSYS) { 227 - *p_acl = ERR_PTR(-ENODATA); 245 + set_cached_acl(inode, type, NULL); 228 246 return NULL; 229 247 } 230 248 return ERR_PTR(size); ··· 234 262 /* This shouldn't actually happen as it should have 235 263 been caught above.. but just in case */ 236 264 acl = NULL; 237 - *p_acl = ERR_PTR(-ENODATA); 238 265 } else if (retval < 0) { 239 266 acl = ERR_PTR(retval); 240 267 } else { 241 268 acl = posix_acl_from_disk(value, retval); 242 - if (!IS_ERR(acl)) 243 - iset_acl(inode, p_acl, acl); 244 269 } 270 + if (!IS_ERR(acl)) 271 + set_cached_acl(inode, type, acl); 245 272 246 273 kfree(value); 247 274 return acl; ··· 258 287 { 259 288 char *name; 260 289 void *value = NULL; 261 - struct posix_acl **p_acl; 262 290 size_t size = 0; 263 291 int error; 264 - struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); 265 292 266 293 if (S_ISLNK(inode->i_mode)) 267 294 return -EOPNOTSUPP; ··· 267 298 switch (type) { 268 299 case ACL_TYPE_ACCESS: 269 300 name = POSIX_ACL_XATTR_ACCESS; 270 - p_acl = &reiserfs_i->i_acl_access; 271 301 if (acl) { 272 302 mode_t mode = inode->i_mode; 273 303 error = posix_acl_equiv_mode(acl, &mode); ··· 281 313 break; 282 314 case ACL_TYPE_DEFAULT: 283 315 name = POSIX_ACL_XATTR_DEFAULT; 284 - p_acl = &reiserfs_i->i_acl_default; 285 316 if (!S_ISDIR(inode->i_mode)) 286 317 return acl ? -EACCES : 0; 287 318 break; ··· 313 346 kfree(value); 314 347 315 348 if (!error) 316 - iset_acl(inode, p_acl, acl); 349 + set_cached_acl(inode, type, acl); 317 350 318 351 return error; 319 352 } ··· 346 379 } 347 380 348 381 acl = reiserfs_get_acl(dir, ACL_TYPE_DEFAULT); 349 - if (IS_ERR(acl)) { 350 - if (PTR_ERR(acl) == -ENODATA) 351 - goto apply_umask; 382 + if (IS_ERR(acl)) 352 383 return PTR_ERR(acl); 353 - } 354 384 355 385 if (acl) { 356 386 struct posix_acl *acl_copy;
+8 -1
fs/super.c
··· 608 608 609 609 static DEFINE_IDA(unnamed_dev_ida); 610 610 static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ 611 + static int unnamed_dev_start = 0; /* don't bother trying below it */ 611 612 612 613 int set_anon_super(struct super_block *s, void *data) 613 614 { ··· 619 618 if (ida_pre_get(&unnamed_dev_ida, GFP_ATOMIC) == 0) 620 619 return -ENOMEM; 621 620 spin_lock(&unnamed_dev_lock); 622 - error = ida_get_new(&unnamed_dev_ida, &dev); 621 + error = ida_get_new_above(&unnamed_dev_ida, unnamed_dev_start, &dev); 622 + if (!error) 623 + unnamed_dev_start = dev + 1; 623 624 spin_unlock(&unnamed_dev_lock); 624 625 if (error == -EAGAIN) 625 626 /* We raced and lost with another CPU. */ ··· 632 629 if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) { 633 630 spin_lock(&unnamed_dev_lock); 634 631 ida_remove(&unnamed_dev_ida, dev); 632 + if (unnamed_dev_start > dev) 633 + unnamed_dev_start = dev; 635 634 spin_unlock(&unnamed_dev_lock); 636 635 return -EMFILE; 637 636 } ··· 650 645 generic_shutdown_super(sb); 651 646 spin_lock(&unnamed_dev_lock); 652 647 ida_remove(&unnamed_dev_ida, slot); 648 + if (slot < unnamed_dev_start) 649 + unnamed_dev_start = slot; 653 650 spin_unlock(&unnamed_dev_lock); 654 651 } 655 652
+1 -1
fs/ubifs/xattr.c
··· 55 55 * ACL support is not implemented. 56 56 */ 57 57 58 + #include "ubifs.h" 58 59 #include <linux/xattr.h> 59 60 #include <linux/posix_acl_xattr.h> 60 - #include "ubifs.h" 61 61 62 62 /* 63 63 * Limit the number of extended attributes per inode so that the total size
+9 -64
fs/xfs/linux-2.6/xfs_acl.c
··· 25 25 #include <linux/posix_acl_xattr.h> 26 26 27 27 28 - #define XFS_ACL_NOT_CACHED ((void *)-1) 29 - 30 28 /* 31 29 * Locking scheme: 32 30 * - all ACL updates are protected by inode->i_mutex, which is taken before 33 31 * calling into this file. 34 - * - access and updates to the ip->i_acl and ip->i_default_acl pointers are 35 - * protected by inode->i_lock. 36 32 */ 37 33 38 34 STATIC struct posix_acl * ··· 98 102 } 99 103 } 100 104 101 - /* 102 - * Update the cached ACL pointer in the inode. 103 - * 104 - * Because we don't hold any locks while reading/writing the attribute 105 - * from/to disk another thread could have raced and updated the cached 106 - * ACL value before us. In that case we release the previous cached value 107 - * and update it with our new value. 108 - */ 109 - STATIC void 110 - xfs_update_cached_acl(struct inode *inode, struct posix_acl **p_acl, 111 - struct posix_acl *acl) 112 - { 113 - spin_lock(&inode->i_lock); 114 - if (*p_acl && *p_acl != XFS_ACL_NOT_CACHED) 115 - posix_acl_release(*p_acl); 116 - *p_acl = posix_acl_dup(acl); 117 - spin_unlock(&inode->i_lock); 118 - } 119 - 120 105 struct posix_acl * 121 106 xfs_get_acl(struct inode *inode, int type) 122 107 { 123 108 struct xfs_inode *ip = XFS_I(inode); 124 - struct posix_acl *acl = NULL, **p_acl; 109 + struct posix_acl *acl; 125 110 struct xfs_acl *xfs_acl; 126 111 int len = sizeof(struct xfs_acl); 127 112 char *ea_name; 128 113 int error; 129 114 115 + acl = get_cached_acl(inode, type); 116 + if (acl != ACL_NOT_CACHED) 117 + return acl; 118 + 130 119 switch (type) { 131 120 case ACL_TYPE_ACCESS: 132 121 ea_name = SGI_ACL_FILE; 133 - p_acl = &ip->i_acl; 134 122 break; 135 123 case ACL_TYPE_DEFAULT: 136 124 ea_name = SGI_ACL_DEFAULT; 137 - p_acl = &ip->i_default_acl; 138 125 break; 139 126 default: 140 - return ERR_PTR(-EINVAL); 127 + BUG(); 141 128 } 142 - 143 - spin_lock(&inode->i_lock); 144 - if (*p_acl != XFS_ACL_NOT_CACHED) 145 - acl = posix_acl_dup(*p_acl); 146 - spin_unlock(&inode->i_lock); 147 129 148 130 /* 149 131 * If we have a cached ACLs value just return it, not need to 150 132 * go out to the disk. 151 133 */ 152 - if (acl) 153 - return acl; 154 134 155 135 xfs_acl = kzalloc(sizeof(struct xfs_acl), GFP_KERNEL); 156 136 if (!xfs_acl) ··· 137 165 /* 138 166 * If the attribute doesn't exist make sure we have a negative 139 167 * cache entry, for any other error assume it is transient and 140 - * leave the cache entry as XFS_ACL_NOT_CACHED. 168 + * leave the cache entry as ACL_NOT_CACHED. 141 169 */ 142 170 if (error == -ENOATTR) { 143 171 acl = NULL; ··· 151 179 goto out; 152 180 153 181 out_update_cache: 154 - xfs_update_cached_acl(inode, p_acl, acl); 182 + set_cached_acl(inode, type, acl); 155 183 out: 156 184 kfree(xfs_acl); 157 185 return acl; ··· 161 189 xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) 162 190 { 163 191 struct xfs_inode *ip = XFS_I(inode); 164 - struct posix_acl **p_acl; 165 192 char *ea_name; 166 193 int error; 167 194 ··· 170 199 switch (type) { 171 200 case ACL_TYPE_ACCESS: 172 201 ea_name = SGI_ACL_FILE; 173 - p_acl = &ip->i_acl; 174 202 break; 175 203 case ACL_TYPE_DEFAULT: 176 204 if (!S_ISDIR(inode->i_mode)) 177 205 return acl ? -EACCES : 0; 178 206 ea_name = SGI_ACL_DEFAULT; 179 - p_acl = &ip->i_default_acl; 180 207 break; 181 208 default: 182 209 return -EINVAL; ··· 211 242 } 212 243 213 244 if (!error) 214 - xfs_update_cached_acl(inode, p_acl, acl); 245 + set_cached_acl(inode, type, acl); 215 246 return error; 216 247 } 217 248 ··· 352 383 posix_acl_release(clone); 353 384 return error; 354 385 } 355 - 356 - void 357 - xfs_inode_init_acls(struct xfs_inode *ip) 358 - { 359 - /* 360 - * No need for locking, inode is not live yet. 361 - */ 362 - ip->i_acl = XFS_ACL_NOT_CACHED; 363 - ip->i_default_acl = XFS_ACL_NOT_CACHED; 364 - } 365 - 366 - void 367 - xfs_inode_clear_acls(struct xfs_inode *ip) 368 - { 369 - /* 370 - * No need for locking here, the inode is not live anymore 371 - * and just about to be freed. 372 - */ 373 - if (ip->i_acl != XFS_ACL_NOT_CACHED) 374 - posix_acl_release(ip->i_acl); 375 - if (ip->i_default_acl != XFS_ACL_NOT_CACHED) 376 - posix_acl_release(ip->i_default_acl); 377 - } 378 - 379 386 380 387 /* 381 388 * System xattr handlers.
-4
fs/xfs/xfs_acl.h
··· 46 46 extern struct posix_acl *xfs_get_acl(struct inode *inode, int type); 47 47 extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl); 48 48 extern int xfs_acl_chmod(struct inode *inode); 49 - extern void xfs_inode_init_acls(struct xfs_inode *ip); 50 - extern void xfs_inode_clear_acls(struct xfs_inode *ip); 51 49 extern int posix_acl_access_exists(struct inode *inode); 52 50 extern int posix_acl_default_exists(struct inode *inode); 53 51 ··· 55 57 # define xfs_get_acl(inode, type) NULL 56 58 # define xfs_inherit_acl(inode, default_acl) 0 57 59 # define xfs_acl_chmod(inode) 0 58 - # define xfs_inode_init_acls(ip) 59 - # define xfs_inode_clear_acls(ip) 60 60 # define posix_acl_access_exists(inode) 0 61 61 # define posix_acl_default_exists(inode) 0 62 62 #endif /* CONFIG_XFS_POSIX_ACL */
-2
fs/xfs/xfs_iget.c
··· 83 83 memset(&ip->i_d, 0, sizeof(xfs_icdinode_t)); 84 84 ip->i_size = 0; 85 85 ip->i_new_size = 0; 86 - xfs_inode_init_acls(ip); 87 86 88 87 /* 89 88 * Initialize inode's trace buffers. ··· 559 560 ASSERT(atomic_read(&ip->i_pincount) == 0); 560 561 ASSERT(!spin_is_locked(&ip->i_flags_lock)); 561 562 ASSERT(completion_done(&ip->i_flush)); 562 - xfs_inode_clear_acls(ip); 563 563 kmem_zone_free(xfs_inode_zone, ip); 564 564 } 565 565
-5
fs/xfs/xfs_inode.h
··· 273 273 /* VFS inode */ 274 274 struct inode i_vnode; /* embedded VFS inode */ 275 275 276 - #ifdef CONFIG_XFS_POSIX_ACL 277 - struct posix_acl *i_acl; 278 - struct posix_acl *i_default_acl; 279 - #endif 280 - 281 276 /* Trace buffers per inode. */ 282 277 #ifdef XFS_INODE_TRACE 283 278 struct ktrace *i_trace; /* general inode trace */
-4
include/linux/ext3_fs_i.h
··· 103 103 */ 104 104 struct rw_semaphore xattr_sem; 105 105 #endif 106 - #ifdef CONFIG_EXT3_FS_POSIX_ACL 107 - struct posix_acl *i_acl; 108 - struct posix_acl *i_default_acl; 109 - #endif 110 106 111 107 struct list_head i_orphan; /* unlinked but open inodes */ 112 108
+21
include/linux/falloc.h
··· 3 3 4 4 #define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ 5 5 6 + #ifdef __KERNEL__ 7 + 8 + /* 9 + * Space reservation ioctls and argument structure 10 + * are designed to be compatible with the legacy XFS ioctls. 11 + */ 12 + struct space_resv { 13 + __s16 l_type; 14 + __s16 l_whence; 15 + __s64 l_start; 16 + __s64 l_len; /* len == 0 means until end of file */ 17 + __s32 l_sysid; 18 + __u32 l_pid; 19 + __s32 l_pad[4]; /* reserved area */ 20 + }; 21 + 22 + #define FS_IOC_RESVSP _IOW('X', 40, struct space_resv) 23 + #define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv) 24 + 25 + #endif /* __KERNEL__ */ 26 + 6 27 #endif /* _FALLOC_H_ */
+13
include/linux/fs.h
··· 710 710 #define i_size_ordered_init(inode) do { } while (0) 711 711 #endif 712 712 713 + struct posix_acl; 714 + #define ACL_NOT_CACHED ((void *)(-1)) 715 + 713 716 struct inode { 714 717 struct hlist_node i_hash; 715 718 struct list_head i_list; ··· 775 772 atomic_t i_writecount; 776 773 #ifdef CONFIG_SECURITY 777 774 void *i_security; 775 + #endif 776 + #ifdef CONFIG_FS_POSIX_ACL 777 + struct posix_acl *i_acl; 778 + struct posix_acl *i_default_acl; 778 779 #endif 779 780 void *i_private; /* fs or device private pointer */ 780 781 }; ··· 1913 1906 1914 1907 extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, 1915 1908 struct file *filp); 1909 + extern int do_fallocate(struct file *file, int mode, loff_t offset, 1910 + loff_t len); 1916 1911 extern long do_sys_open(int dfd, const char __user *filename, int flags, 1917 1912 int mode); 1918 1913 extern struct file *filp_open(const char *, int, int); ··· 1922 1913 const struct cred *); 1923 1914 extern int filp_close(struct file *, fl_owner_t id); 1924 1915 extern char * getname(const char __user *); 1916 + 1917 + /* fs/ioctl.c */ 1918 + 1919 + extern int ioctl_preallocate(struct file *filp, void __user *argp); 1925 1920 1926 1921 /* fs/dcache.c */ 1927 1922 extern void __init vfs_caches_init_early(void);
+64
include/linux/posix_acl.h
··· 83 83 extern struct posix_acl *get_posix_acl(struct inode *, int); 84 84 extern int set_posix_acl(struct inode *, int, struct posix_acl *); 85 85 86 + static inline struct posix_acl *get_cached_acl(struct inode *inode, int type) 87 + { 88 + struct posix_acl **p, *acl; 89 + switch (type) { 90 + case ACL_TYPE_ACCESS: 91 + p = &inode->i_acl; 92 + break; 93 + case ACL_TYPE_DEFAULT: 94 + p = &inode->i_default_acl; 95 + break; 96 + default: 97 + return ERR_PTR(-EINVAL); 98 + } 99 + acl = ACCESS_ONCE(*p); 100 + if (acl) { 101 + spin_lock(&inode->i_lock); 102 + acl = *p; 103 + if (acl != ACL_NOT_CACHED) 104 + acl = posix_acl_dup(acl); 105 + spin_unlock(&inode->i_lock); 106 + } 107 + return acl; 108 + } 109 + 110 + static inline void set_cached_acl(struct inode *inode, 111 + int type, 112 + struct posix_acl *acl) 113 + { 114 + struct posix_acl *old = NULL; 115 + spin_lock(&inode->i_lock); 116 + switch (type) { 117 + case ACL_TYPE_ACCESS: 118 + old = inode->i_acl; 119 + inode->i_acl = posix_acl_dup(acl); 120 + break; 121 + case ACL_TYPE_DEFAULT: 122 + old = inode->i_default_acl; 123 + inode->i_default_acl = posix_acl_dup(acl); 124 + break; 125 + } 126 + spin_unlock(&inode->i_lock); 127 + if (old != ACL_NOT_CACHED) 128 + posix_acl_release(old); 129 + } 130 + 131 + static inline void forget_cached_acl(struct inode *inode, int type) 132 + { 133 + struct posix_acl *old = NULL; 134 + spin_lock(&inode->i_lock); 135 + switch (type) { 136 + case ACL_TYPE_ACCESS: 137 + old = inode->i_acl; 138 + inode->i_acl = ACL_NOT_CACHED; 139 + break; 140 + case ACL_TYPE_DEFAULT: 141 + old = inode->i_default_acl; 142 + inode->i_default_acl = ACL_NOT_CACHED; 143 + break; 144 + } 145 + spin_unlock(&inode->i_lock); 146 + if (old != ACL_NOT_CACHED) 147 + posix_acl_release(old); 148 + } 149 + 86 150 #endif /* __LINUX_POSIX_ACL_H */
-17
include/linux/reiserfs_acl.h
··· 56 56 extern struct xattr_handler reiserfs_posix_acl_default_handler; 57 57 extern struct xattr_handler reiserfs_posix_acl_access_handler; 58 58 59 - static inline void reiserfs_init_acl_access(struct inode *inode) 60 - { 61 - REISERFS_I(inode)->i_acl_access = NULL; 62 - } 63 - 64 - static inline void reiserfs_init_acl_default(struct inode *inode) 65 - { 66 - REISERFS_I(inode)->i_acl_default = NULL; 67 - } 68 59 #else 69 60 70 61 #define reiserfs_cache_default_acl(inode) 0 ··· 76 85 struct inode *inode) 77 86 { 78 87 return 0; 79 - } 80 - 81 - static inline void reiserfs_init_acl_access(struct inode *inode) 82 - { 83 - } 84 - 85 - static inline void reiserfs_init_acl_default(struct inode *inode) 86 - { 87 88 } 88 89 #endif
-4
include/linux/reiserfs_fs_i.h
··· 54 54 unsigned int i_trans_id; 55 55 struct reiserfs_journal_list *i_jl; 56 56 struct mutex i_mmap; 57 - #ifdef CONFIG_REISERFS_FS_POSIX_ACL 58 - struct posix_acl *i_acl_access; 59 - struct posix_acl *i_acl_default; 60 - #endif 61 57 #ifdef CONFIG_REISERFS_FS_XATTR 62 58 struct rw_semaphore i_xattr_sem; 63 59 #endif
-8
include/linux/shmem_fs.h
··· 19 19 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ 20 20 struct list_head swaplist; /* chain of maybes on swap */ 21 21 struct inode vfs_inode; 22 - #ifdef CONFIG_TMPFS_POSIX_ACL 23 - struct posix_acl *i_acl; 24 - struct posix_acl *i_default_acl; 25 - #endif 26 22 }; 27 23 28 24 struct shmem_sb_info { ··· 41 45 #ifdef CONFIG_TMPFS_POSIX_ACL 42 46 int shmem_permission(struct inode *, int); 43 47 int shmem_acl_init(struct inode *, struct inode *); 44 - void shmem_acl_destroy_inode(struct inode *); 45 48 46 49 extern struct xattr_handler shmem_xattr_acl_access_handler; 47 50 extern struct xattr_handler shmem_xattr_acl_default_handler; ··· 51 56 static inline int shmem_acl_init(struct inode *inode, struct inode *dir) 52 57 { 53 58 return 0; 54 - } 55 - static inline void shmem_acl_destroy_inode(struct inode *inode) 56 - { 57 59 } 58 60 #endif /* CONFIG_TMPFS_POSIX_ACL */ 59 61
+4 -5
mm/shmem.c
··· 2379 2379 p = (struct shmem_inode_info *)kmem_cache_alloc(shmem_inode_cachep, GFP_KERNEL); 2380 2380 if (!p) 2381 2381 return NULL; 2382 + #ifdef CONFIG_TMPFS_POSIX_ACL 2383 + p->vfs_inode.i_acl = NULL; 2384 + p->vfs_inode.i_default_acl = NULL; 2385 + #endif 2382 2386 return &p->vfs_inode; 2383 2387 } 2384 2388 ··· 2392 2388 /* only struct inode is valid if it's an inline symlink */ 2393 2389 mpol_free_shared_policy(&SHMEM_I(inode)->policy); 2394 2390 } 2395 - shmem_acl_destroy_inode(inode); 2396 2391 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); 2397 2392 } 2398 2393 ··· 2400 2397 struct shmem_inode_info *p = (struct shmem_inode_info *) foo; 2401 2398 2402 2399 inode_init_once(&p->vfs_inode); 2403 - #ifdef CONFIG_TMPFS_POSIX_ACL 2404 - p->i_acl = NULL; 2405 - p->i_default_acl = NULL; 2406 - #endif 2407 2400 } 2408 2401 2409 2402 static int init_inodecache(void)
+6 -23
mm/shmem_acl.c
··· 22 22 spin_lock(&inode->i_lock); 23 23 switch(type) { 24 24 case ACL_TYPE_ACCESS: 25 - acl = posix_acl_dup(SHMEM_I(inode)->i_acl); 25 + acl = posix_acl_dup(inode->i_acl); 26 26 break; 27 27 28 28 case ACL_TYPE_DEFAULT: 29 - acl = posix_acl_dup(SHMEM_I(inode)->i_default_acl); 29 + acl = posix_acl_dup(inode->i_default_acl); 30 30 break; 31 31 } 32 32 spin_unlock(&inode->i_lock); ··· 45 45 spin_lock(&inode->i_lock); 46 46 switch(type) { 47 47 case ACL_TYPE_ACCESS: 48 - free = SHMEM_I(inode)->i_acl; 49 - SHMEM_I(inode)->i_acl = posix_acl_dup(acl); 48 + free = inode->i_acl; 49 + inode->i_acl = posix_acl_dup(acl); 50 50 break; 51 51 52 52 case ACL_TYPE_DEFAULT: 53 - free = SHMEM_I(inode)->i_default_acl; 54 - SHMEM_I(inode)->i_default_acl = posix_acl_dup(acl); 53 + free = inode->i_default_acl; 54 + inode->i_default_acl = posix_acl_dup(acl); 55 55 break; 56 56 } 57 57 spin_unlock(&inode->i_lock); ··· 152 152 shmem_acl_init(struct inode *inode, struct inode *dir) 153 153 { 154 154 return generic_acl_init(inode, dir, &shmem_acl_ops); 155 - } 156 - 157 - /** 158 - * shmem_acl_destroy_inode - destroy acls hanging off the in-memory inode 159 - * 160 - * This is done before destroying the actual inode. 161 - */ 162 - 163 - void 164 - shmem_acl_destroy_inode(struct inode *inode) 165 - { 166 - if (SHMEM_I(inode)->i_acl) 167 - posix_acl_release(SHMEM_I(inode)->i_acl); 168 - SHMEM_I(inode)->i_acl = NULL; 169 - if (SHMEM_I(inode)->i_default_acl) 170 - posix_acl_release(SHMEM_I(inode)->i_default_acl); 171 - SHMEM_I(inode)->i_default_acl = NULL; 172 155 } 173 156 174 157 /**