Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 25 Jul 2011 19:53:15 +0000 (12:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 25 Jul 2011 19:53:15 +0000 (12:53 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
  fs: take the ACL checks to common code
  bury posix_acl_..._masq() variants
  kill boilerplates around posix_acl_create_masq()
  generic_acl: no need to clone acl just to push it to set_cached_acl()
  kill boilerplate around posix_acl_chmod_masq()
  reiserfs: cache negative ACLs for v1 stat format
  xfs: cache negative ACLs if there is no attribute fork
  9p: do no return 0 from ->check_acl without actually checking
  vfs: move ACL cache lookup into generic code
  CIFS: Fix oops while mounting with prefixpath
  xfs: Fix wrong return value of xfs_file_aio_write
  fix devtmpfs race
  caam: don't pass bogus S_IFCHR to debugfs_create_...()
  get rid of create_proc_entry() abuses - proc_mkdir() is there for purpose
  asus-wmi: ->is_visible() can't return negative
  fix jffs2 ACLs on big-endian with 16bit mode_t
  9p: close ACL leaks
  ocfs2_init_acl(): fix a leak
  VFS : mount lock scalability for internal mounts

76 files changed:
Documentation/filesystems/Locking
Documentation/filesystems/porting
Documentation/filesystems/vfs.txt
arch/arm/mach-bcmring/dma.c
drivers/base/devtmpfs.c
drivers/crypto/caam/ctrl.c
drivers/mtd/mtdchar.c
drivers/platform/x86/asus-wmi.c
drivers/staging/rtl8187se/r8180_core.c
drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
drivers/staging/rtl8192e/r8192E_core.c
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
drivers/staging/rtl8192u/r8192U_core.c
fs/9p/acl.c
fs/9p/acl.h
fs/9p/vfs_inode_dotl.c
fs/anon_inodes.c
fs/btrfs/acl.c
fs/btrfs/ctree.h
fs/btrfs/inode.c
fs/cifs/dir.c
fs/ext2/acl.c
fs/ext2/acl.h
fs/ext2/file.c
fs/ext2/namei.c
fs/ext3/acl.c
fs/ext3/acl.h
fs/ext3/file.c
fs/ext3/namei.c
fs/ext4/acl.c
fs/ext4/acl.h
fs/ext4/file.c
fs/ext4/namei.c
fs/generic_acl.c
fs/gfs2/acl.c
fs/gfs2/acl.h
fs/gfs2/inode.c
fs/hugetlbfs/inode.c
fs/jffs2/acl.c
fs/jffs2/acl.h
fs/jffs2/dir.c
fs/jffs2/file.c
fs/jffs2/fs.c
fs/jffs2/os-linux.h
fs/jffs2/symlink.c
fs/jfs/acl.c
fs/jfs/file.c
fs/jfs/jfs_acl.h
fs/jfs/namei.c
fs/namei.c
fs/namespace.c
fs/nfs/nfs3acl.c
fs/ocfs2/acl.c
fs/ocfs2/acl.h
fs/ocfs2/file.c
fs/ocfs2/namei.c
fs/pipe.c
fs/posix_acl.c
fs/reiserfs/file.c
fs/reiserfs/inode.c
fs/reiserfs/namei.c
fs/reiserfs/xattr.c
fs/reiserfs/xattr_acl.c
fs/xfs/linux-2.6/xfs_acl.c
fs/xfs/linux-2.6/xfs_file.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/linux-2.6/xfs_trace.h
fs/xfs/xfs_acl.h
include/linux/fs.h
include/linux/generic_acl.h
include/linux/posix_acl.h
include/linux/reiserfs_acl.h
include/linux/reiserfs_xattr.h
mm/shmem.c
security/selinux/selinuxfs.c
sound/core/info.c

index ca7e25292542a6934f4d3210846167e4343228c4..7e4699146fe172d15fed459d8e702cc38035b59b 100644 (file)
@@ -52,7 +52,7 @@ ata *);
        void (*put_link) (struct dentry *, struct nameidata *, void *);
        void (*truncate) (struct inode *);
        int (*permission) (struct inode *, int, unsigned int);
-       int (*check_acl)(struct inode *, int);
+       int (*get_acl)(struct inode *, int);
        int (*setattr) (struct dentry *, struct iattr *);
        int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
        int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -80,7 +80,7 @@ put_link:     no
 truncate:      yes             (see below)
 setattr:       yes
 permission:    no (may not block if called in rcu-walk mode)
-check_acl:     no
+get_acl:       no
 getattr:       no
 setxattr:      yes
 getxattr:      no
index 7f8861d341ea83321092db0b94e79953c795b5e1..b4a3d765ff9ac07aa41e8d12ddbd4e97be5b9bc6 100644 (file)
@@ -407,10 +407,11 @@ to some pointer to returning that pointer.  On errors return ERR_PTR(...).
 
 --
 [mandatory]
-       ->permission(), generic_permission() and ->check_acl() have lost flags
+       ->permission() and generic_permission()have lost flags
 argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask.
-       generic_permission() has also lost the check_acl argument; if you want
-non-NULL to be used for that inode, put it into ->i_op->check_acl.
+       generic_permission() has also lost the check_acl argument; ACL checking
+has been taken to VFS and filesystems need to provide a non-NULL ->i_op->get_acl
+to read an ACL from disk.
 
 --
 [mandatory]
index eff6617c9a0f6fe7c3824926c8a79b26ccd5b290..52d8fb81cffffdffe3cb8f4ddb1cd65d586855fb 100644 (file)
@@ -356,7 +356,7 @@ struct inode_operations {
         void (*put_link) (struct dentry *, struct nameidata *, void *);
        void (*truncate) (struct inode *);
        int (*permission) (struct inode *, int);
-       int (*check_acl)(struct inode *, int);
+       int (*get_acl)(struct inode *, int);
        int (*setattr) (struct dentry *, struct iattr *);
        int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
        int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
index d87ad30dda35a8c2ed5689e3c50590b2320e7b5a..9f2a948e0e72a61083cf3038a03f4aa2bae4520c 100644 (file)
@@ -835,7 +835,7 @@ int dma_init(void)
 
        /* Create /proc/dma/channels and /proc/dma/devices */
 
-       gDmaDir = create_proc_entry("dma", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
+       gDmaDir = proc_mkdir("dma", NULL);
 
        if (gDmaDir == NULL) {
                printk(KERN_ERR "Unable to create /proc/dma\n");
index 6d678c99512e383ea9c7dee9dd1c5519151768ef..b89fffc1d777b277abd7bac4221b0fbc98e265ff 100644 (file)
@@ -406,9 +406,10 @@ static int devtmpfsd(void *p)
                        requests = NULL;
                        spin_unlock(&req_lock);
                        while (req) {
+                               struct req *next = req->next;
                                req->err = handle(req->name, req->mode, req->dev);
                                complete(&req->done);
-                               req = req->next;
+                               req = next;
                        }
                        spin_lock(&req_lock);
                }
index fc2d9ed22470890cbd1bd07807c4d7ae2fcda232..73988bb7322abde6822094851801a0beb97b9169 100644 (file)
@@ -166,52 +166,52 @@ static int caam_probe(struct platform_device *pdev)
        /* Controller-level - performance monitor counters */
        ctrlpriv->ctl_rq_dequeued =
                debugfs_create_u64("rq_dequeued",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->req_dequeued);
        ctrlpriv->ctl_ob_enc_req =
                debugfs_create_u64("ob_rq_encrypted",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->ob_enc_req);
        ctrlpriv->ctl_ib_dec_req =
                debugfs_create_u64("ib_rq_decrypted",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->ib_dec_req);
        ctrlpriv->ctl_ob_enc_bytes =
                debugfs_create_u64("ob_bytes_encrypted",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->ob_enc_bytes);
        ctrlpriv->ctl_ob_prot_bytes =
                debugfs_create_u64("ob_bytes_protected",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->ob_prot_bytes);
        ctrlpriv->ctl_ib_dec_bytes =
                debugfs_create_u64("ib_bytes_decrypted",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->ib_dec_bytes);
        ctrlpriv->ctl_ib_valid_bytes =
                debugfs_create_u64("ib_bytes_validated",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->ib_valid_bytes);
 
        /* Controller level - global status values */
        ctrlpriv->ctl_faultaddr =
                debugfs_create_u64("fault_addr",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->faultaddr);
        ctrlpriv->ctl_faultdetail =
                debugfs_create_u32("fault_detail",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->faultdetail);
        ctrlpriv->ctl_faultstatus =
                debugfs_create_u32("fault_status",
-                                  S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH,
+                                  S_IRUSR | S_IRGRP | S_IROTH,
                                   ctrlpriv->ctl, &perfmon->status);
 
        /* Internal covering keys (useful in non-secure mode only) */
        ctrlpriv->ctl_kek_wrap.data = &ctrlpriv->ctrl->kek[0];
        ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
        ctrlpriv->ctl_kek = debugfs_create_blob("kek",
-                                               S_IFCHR | S_IRUSR |
+                                               S_IRUSR |
                                                S_IRGRP | S_IROTH,
                                                ctrlpriv->ctl,
                                                &ctrlpriv->ctl_kek_wrap);
@@ -219,7 +219,7 @@ static int caam_probe(struct platform_device *pdev)
        ctrlpriv->ctl_tkek_wrap.data = &ctrlpriv->ctrl->tkek[0];
        ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
        ctrlpriv->ctl_tkek = debugfs_create_blob("tkek",
-                                                S_IFCHR | S_IRUSR |
+                                                S_IRUSR |
                                                 S_IRGRP | S_IROTH,
                                                 ctrlpriv->ctl,
                                                 &ctrlpriv->ctl_tkek_wrap);
@@ -227,7 +227,7 @@ static int caam_probe(struct platform_device *pdev)
        ctrlpriv->ctl_tdsk_wrap.data = &ctrlpriv->ctrl->tdsk[0];
        ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
        ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk",
-                                                S_IFCHR | S_IRUSR |
+                                                S_IRUSR |
                                                 S_IRGRP | S_IROTH,
                                                 ctrlpriv->ctl,
                                                 &ctrlpriv->ctl_tdsk_wrap);
index 3f92731a5b9ebf288ed83602c36972e5d32dee8d..f1af2228a1b1ec2e90ee2cb19958a68f0d7bb0da 100644 (file)
@@ -1192,7 +1192,7 @@ err_unregister_chdev:
 static void __exit cleanup_mtdchar(void)
 {
        unregister_mtd_user(&mtdchar_notifier);
-       mntput(mtd_inode_mnt);
+       kern_unmount(mtd_inode_mnt);
        unregister_filesystem(&mtd_inodefs_type);
        __unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
 }
index 3c7857c71a230e12b2fc1bac6446c08af0e0c893..65b66aa44c786f64dba15a94d607b292260630e7 100644 (file)
@@ -857,7 +857,7 @@ static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
                int err = asus_wmi_get_devstate(asus, dev_id, &value);
 
                if (err < 0)
-                       return err;
+                       return 0; /* can't return negative here */
        }
 
        if (dev_id == ASUS_WMI_DEVID_FAN_CTRL) {
index bae7d85fe831a56234b234ee413c146da1b1719b..4c6651aac30793ffab9ade20bd167acd3303de7d 100644 (file)
@@ -307,7 +307,7 @@ static int proc_get_stats_tx(char *page, char **start,
 void rtl8180_proc_module_init(void)
 {
        DMESG("Initializing proc filesystem");
-       rtl8180_proc = create_proc_entry(RTL8180_MODULE_NAME, S_IFDIR, init_net.proc_net);
+       rtl8180_proc = proc_mkdir(RTL8180_MODULE_NAME, init_net.proc_net);
 }
 
 void rtl8180_proc_module_remove(void)
index 663b0b8e109500fd4baf376b8171a1e98eb567ff..c2901b50dbfe116912119b67fe1e4e4a7f165587 100644 (file)
@@ -311,7 +311,7 @@ int __init ieee80211_rtl_init(void)
        }
 
        ieee80211_debug_level = debug;
-       ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
+       ieee80211_proc = proc_mkdir(DRV_NAME, init_net.proc_net);
        if (ieee80211_proc == NULL) {
                IEEE80211_ERROR("Unable to create " DRV_NAME
                                " proc directory\n");
index 19a9a07224a2f12ee39346f6b1809c34b1187397..8550794c6b91be30079428f989659a3519d74028 100644 (file)
@@ -508,7 +508,7 @@ static int proc_get_stats_rx(char *page, char **start,
 static void rtl8192_proc_module_init(void)
 {
        RT_TRACE(COMP_INIT, "Initializing proc filesystem\n");
-       rtl8192_proc=create_proc_entry(RTL819xE_MODULE_NAME, S_IFDIR, init_net.proc_net);
+       rtl8192_proc = proc_mkdir(RTL819xE_MODULE_NAME, init_net.proc_net);
 }
 
 
@@ -540,9 +540,7 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
        struct net_device *dev = priv->ieee80211->dev;
        struct proc_dir_entry *e;
 
-       priv->dir_dev = create_proc_entry(dev->name,
-                                         S_IFDIR | S_IRUGO | S_IXUGO,
-                                         rtl8192_proc);
+       priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
        if (!priv->dir_dev) {
                RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
                      dev->name);
index fe978f359f91d9b9caba2aee28253fa682b4f19f..d315b256b7a7cfd63aa9cfb8996e0ed8bf7aa6bd 100644 (file)
@@ -283,7 +283,7 @@ int __init ieee80211_debug_init(void)
 
        ieee80211_debug_level = debug;
 
-       ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
+       ieee80211_proc = proc_mkdir(DRV_NAME, init_net.proc_net);
        if (ieee80211_proc == NULL) {
                IEEE80211_ERROR("Unable to create " DRV_NAME
                                " proc directory\n");
index e81b8ab6aa9d160c6a8c30327a751d9d6b82ef48..6a1b5c179027b955ce50a04fb8c28fd680653acf 100644 (file)
@@ -671,7 +671,7 @@ static int proc_get_stats_rx(char *page, char **start,
 void rtl8192_proc_module_init(void)
 {
        RT_TRACE(COMP_INIT, "Initializing proc filesystem");
-       rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net);
+       rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net);
 }
 
 
@@ -706,9 +706,7 @@ void rtl8192_proc_init_one(struct net_device *dev)
 {
        struct proc_dir_entry *e;
        struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-       priv->dir_dev = create_proc_entry(dev->name,
-                                         S_IFDIR | S_IRUGO | S_IXUGO,
-                                         rtl8192_proc);
+       priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
        if (!priv->dir_dev) {
                RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
                      dev->name);
index e98f56d3787dff9f68bbd80772f8690f903ee114..814be079c185277e5fde8f186cd1d2611e32e73d 100644 (file)
@@ -96,14 +96,11 @@ static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
        return acl;
 }
 
-int v9fs_check_acl(struct inode *inode, int mask)
+struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        struct v9fs_session_info *v9ses;
 
-       if (mask & MAY_NOT_BLOCK)
-               return -ECHILD;
-
        v9ses = v9fs_inode2v9ses(inode);
        if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
                        ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {
@@ -111,18 +108,10 @@ int v9fs_check_acl(struct inode *inode, int mask)
                 * On access = client  and acl = on mode get the acl
                 * values from the server
                 */
-               return 0;
+               return NULL;
        }
-       acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
+       return v9fs_get_cached_acl(inode, type);
 
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-       return -EAGAIN;
 }
 
 static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
@@ -165,32 +154,32 @@ err_free_out:
 int v9fs_acl_chmod(struct dentry *dentry)
 {
        int retval = 0;
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        struct inode *inode = dentry->d_inode;
 
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
        acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
        if (acl) {
-               clone = posix_acl_clone(acl, GFP_KERNEL);
+               retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+               if (retval)
+                       return retval;
+               retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, acl);
                posix_acl_release(acl);
-               if (!clone)
-                       return -ENOMEM;
-               retval = posix_acl_chmod_masq(clone, inode->i_mode);
-               if (!retval)
-                       retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, clone);
-               posix_acl_release(clone);
        }
        return retval;
 }
 
 int v9fs_set_create_acl(struct dentry *dentry,
-                       struct posix_acl *dpacl, struct posix_acl *pacl)
+                       struct posix_acl **dpacl, struct posix_acl **pacl)
 {
-       v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, dpacl);
-       v9fs_set_acl(dentry, ACL_TYPE_ACCESS, pacl);
-       posix_acl_release(dpacl);
-       posix_acl_release(pacl);
+       if (dentry) {
+               v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, *dpacl);
+               v9fs_set_acl(dentry, ACL_TYPE_ACCESS, *pacl);
+       }
+       posix_acl_release(*dpacl);
+       posix_acl_release(*pacl);
+       *dpacl = *pacl = NULL;
        return 0;
 }
 
@@ -209,29 +198,18 @@ int v9fs_acl_mode(struct inode *dir, mode_t *modep,
                        mode &= ~current_umask();
        }
        if (acl) {
-               struct posix_acl *clone;
-
                if (S_ISDIR(mode))
-                       *dpacl = acl;
-               clone = posix_acl_clone(acl, GFP_NOFS);
-               retval = -ENOMEM;
-               if (!clone)
-                       goto cleanup;
-
-               retval = posix_acl_create_masq(clone, &mode);
-               if (retval < 0) {
-                       posix_acl_release(clone);
-                       goto cleanup;
-               }
+                       *dpacl = posix_acl_dup(acl);
+               retval = posix_acl_create(&acl, GFP_NOFS, &mode);
+               if (retval < 0)
+                       return retval;
                if (retval > 0)
-                       *pacl = clone;
+                       *pacl = acl;
+               else
+                       posix_acl_release(acl);
        }
        *modep  = mode;
        return 0;
-cleanup:
-       posix_acl_release(acl);
-       return retval;
-
 }
 
 static int v9fs_remote_get_acl(struct dentry *dentry, const char *name,
index 59e18c2e8c7e6ba3b7e1fd4386155bad519adc9e..ddb7ae19d9718933398fad6d18ac11bcc15c116c 100644 (file)
 
 #ifdef CONFIG_9P_FS_POSIX_ACL
 extern int v9fs_get_acl(struct inode *, struct p9_fid *);
-extern int v9fs_check_acl(struct inode *inode, int mask);
+extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
 extern int v9fs_acl_chmod(struct dentry *);
 extern int v9fs_set_create_acl(struct dentry *,
-                              struct posix_acl *, struct posix_acl *);
+                              struct posix_acl **, struct posix_acl **);
 extern int v9fs_acl_mode(struct inode *dir, mode_t *modep,
                         struct posix_acl **dpacl, struct posix_acl **pacl);
 #else
-#define v9fs_check_acl NULL
+#define v9fs_iop_get_acl NULL
 static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
 {
        return 0;
@@ -33,8 +33,8 @@ static inline int v9fs_acl_chmod(struct dentry *dentry)
        return 0;
 }
 static inline int v9fs_set_create_acl(struct dentry *dentry,
-                                     struct posix_acl *dpacl,
-                                     struct posix_acl *pacl)
+                                     struct posix_acl **dpacl,
+                                     struct posix_acl **pacl)
 {
        return 0;
 }
index 276f4a69ecd459e029f665c6acf0959d536009c1..9a26dce5a99f023e9d2d53b95dd8fb5286cf30b0 100644 (file)
@@ -287,7 +287,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
                goto error;
 
        /* Now set the ACL based on the default value */
-       v9fs_set_create_acl(dentry, dacl, pacl);
+       v9fs_set_create_acl(dentry, &dacl, &pacl);
 
        v9inode = V9FS_I(inode);
        mutex_lock(&v9inode->v_mutex);
@@ -328,6 +328,7 @@ error:
 err_clunk_old_fid:
        if (ofid)
                p9_client_clunk(ofid);
+       v9fs_set_create_acl(NULL, &dacl, &pacl);
        return err;
 }
 
@@ -421,12 +422,13 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
                d_instantiate(dentry, inode);
        }
        /* Now set the ACL based on the default value */
-       v9fs_set_create_acl(dentry, dacl, pacl);
+       v9fs_set_create_acl(dentry, &dacl, &pacl);
        inc_nlink(dir);
        v9fs_invalidate_inode_attr(dir);
 error:
        if (fid)
                p9_client_clunk(fid);
+       v9fs_set_create_acl(NULL, &dacl, &pacl);
        return err;
 }
 
@@ -826,10 +828,11 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
                d_instantiate(dentry, inode);
        }
        /* Now set the ACL based on the default value */
-       v9fs_set_create_acl(dentry, dacl, pacl);
+       v9fs_set_create_acl(dentry, &dacl, &pacl);
 error:
        if (fid)
                p9_client_clunk(fid);
+       v9fs_set_create_acl(NULL, &dacl, &pacl);
        return err;
 }
 
@@ -914,7 +917,7 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = {
        .getxattr = generic_getxattr,
        .removexattr = generic_removexattr,
        .listxattr = v9fs_listxattr,
-       .check_acl = v9fs_check_acl,
+       .get_acl = v9fs_iop_get_acl,
 };
 
 const struct inode_operations v9fs_file_inode_operations_dotl = {
@@ -924,7 +927,7 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
        .getxattr = generic_getxattr,
        .removexattr = generic_removexattr,
        .listxattr = v9fs_listxattr,
-       .check_acl = v9fs_check_acl,
+       .get_acl = v9fs_iop_get_acl,
 };
 
 const struct inode_operations v9fs_symlink_inode_operations_dotl = {
index c5567cb784325a7fa6f745c63e473edea592c4fb..4d433d34736f2e45784142012e1969f712443c93 100644 (file)
@@ -233,7 +233,7 @@ static int __init anon_inode_init(void)
        return 0;
 
 err_mntput:
-       mntput(anon_inode_mnt);
+       kern_unmount(anon_inode_mnt);
 err_unregister_filesystem:
        unregister_filesystem(&anon_inode_fs_type);
 err_exit:
index 9f62ab2a7282ed49aeacc560ef8586b09ce37b24..65a735d8f6e44443c6044d6b71a59e5acf91f546 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
 
-static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
+struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 {
        int size;
        const char *name;
@@ -195,27 +195,6 @@ out:
        return ret;
 }
 
-int btrfs_check_acl(struct inode *inode, int mask)
-{
-       int error = -EAGAIN;
-
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       error = -ECHILD;
-       } else {
-               struct posix_acl *acl;
-               acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
-               if (IS_ERR(acl))
-                       return PTR_ERR(acl);
-               if (acl) {
-                       error = posix_acl_permission(inode, acl, mask);
-                       posix_acl_release(acl);
-               }
-       }
-
-       return error;
-}
-
 /*
  * btrfs_init_acl is already generally called under fs_mutex, so the locking
  * stuff has been fixed to work with that.  If the locking stuff changes, we
@@ -243,8 +222,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
        }
 
        if (IS_POSIXACL(dir) && acl) {
-               struct posix_acl *clone;
-               mode_t mode;
+               mode_t mode = inode->i_mode;
 
                if (S_ISDIR(inode->i_mode)) {
                        ret = btrfs_set_acl(trans, inode, acl,
@@ -252,22 +230,15 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
                        if (ret)
                                goto failed;
                }
-               clone = posix_acl_clone(acl, GFP_NOFS);
-               ret = -ENOMEM;
-               if (!clone)
-                       goto failed;
+               ret = posix_acl_create(&acl, GFP_NOFS, &mode);
+               if (ret < 0)
+                       return ret;
 
-               mode = inode->i_mode;
-               ret = posix_acl_create_masq(clone, &mode);
-               if (ret >= 0) {
-                       inode->i_mode = mode;
-                       if (ret > 0) {
-                               /* we need an acl */
-                               ret = btrfs_set_acl(trans, inode, clone,
-                                                   ACL_TYPE_ACCESS);
-                       }
+               inode->i_mode = mode;
+               if (ret > 0) {
+                       /* we need an acl */
+                       ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
                }
-               posix_acl_release(clone);
        }
 failed:
        posix_acl_release(acl);
@@ -277,7 +248,7 @@ failed:
 
 int btrfs_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int ret = 0;
 
        if (S_ISLNK(inode->i_mode))
@@ -290,17 +261,11 @@ int btrfs_acl_chmod(struct inode *inode)
        if (IS_ERR_OR_NULL(acl))
                return PTR_ERR(acl);
 
-       clone = posix_acl_clone(acl, GFP_KERNEL);
+       ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (ret)
+               return ret;
+       ret = btrfs_set_acl(NULL, inode, acl, ACL_TYPE_ACCESS);
        posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-
-       ret = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!ret)
-               ret = btrfs_set_acl(NULL, inode, clone, ACL_TYPE_ACCESS);
-
-       posix_acl_release(clone);
-
        return ret;
 }
 
index 82be74efbb26dd833a8a0b32bbf108ecfc63baca..fe9287b064969d503e0e2c44f8c7446a8767ce9b 100644 (file)
@@ -2645,9 +2645,9 @@ do {                                                              \
 
 /* acl.c */
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
-int btrfs_check_acl(struct inode *inode, int mask);
+struct posix_acl *btrfs_get_acl(struct inode *inode, int type);
 #else
-#define btrfs_check_acl NULL
+#define btrfs_get_acl NULL
 #endif
 int btrfs_init_acl(struct btrfs_trans_handle *trans,
                   struct inode *inode, struct inode *dir);
index 2548a04a0230c0f515bb45f71f1e3357727a7616..e91b097e7252a911dcaa61eed0188bfeae500d2a 100644 (file)
@@ -7351,12 +7351,12 @@ static const struct inode_operations btrfs_dir_inode_operations = {
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 static const struct inode_operations btrfs_dir_ro_inode_operations = {
        .lookup         = btrfs_lookup,
        .permission     = btrfs_permission,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 
 static const struct file_operations btrfs_dir_file_operations = {
@@ -7425,7 +7425,7 @@ static const struct inode_operations btrfs_file_inode_operations = {
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
        .fiemap         = btrfs_fiemap,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 static const struct inode_operations btrfs_special_inode_operations = {
        .getattr        = btrfs_getattr,
@@ -7435,7 +7435,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
        .getxattr       = btrfs_getxattr,
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 static const struct inode_operations btrfs_symlink_inode_operations = {
        .readlink       = generic_readlink,
@@ -7447,7 +7447,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
        .getxattr       = btrfs_getxattr,
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 
 const struct dentry_operations btrfs_dentry_operations = {
index 14d602f178c29de58a5429ba2a099b424f7c771f..499f27fc85760becc9f9f623b933eba3512eb8c7 100644 (file)
@@ -641,7 +641,7 @@ lookup_out:
 static int
 cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
 {
-       if (nd->flags & LOOKUP_RCU)
+       if (nd && (nd->flags & LOOKUP_RCU))
                return -ECHILD;
 
        if (direntry->d_inode) {
index bfe651f9ae1631ab0abd40281d92f18974530565..52c053763942eb0db19f72b7fb4618bbeeffd012 100644 (file)
@@ -128,7 +128,7 @@ fail:
 /*
  * inode->i_mutex: don't care
  */
-static struct posix_acl *
+struct posix_acl *
 ext2_get_acl(struct inode *inode, int type)
 {
        int name_index;
@@ -231,29 +231,6 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return error;
 }
 
-int
-ext2_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       return -ECHILD;
-               return -EAGAIN;
-       }
-
-       acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 /*
  * Initialize the ACLs of a new inode. Called from ext2_new_inode.
  *
@@ -276,29 +253,20 @@ ext2_init_acl(struct inode *inode, struct inode *dir)
                        inode->i_mode &= ~current_umask();
        }
        if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
-               struct posix_acl *clone;
-              mode_t mode;
-
+               mode_t mode = inode->i_mode;
                if (S_ISDIR(inode->i_mode)) {
                        error = ext2_set_acl(inode, ACL_TYPE_DEFAULT, acl);
                        if (error)
                                goto cleanup;
                }
-               clone = posix_acl_clone(acl, GFP_KERNEL);
-               error = -ENOMEM;
-               if (!clone)
-                       goto cleanup;
-               mode = inode->i_mode;
-               error = posix_acl_create_masq(clone, &mode);
-               if (error >= 0) {
-                       inode->i_mode = mode;
-                       if (error > 0) {
-                               /* This is an extended ACL */
-                               error = ext2_set_acl(inode,
-                                                    ACL_TYPE_ACCESS, clone);
-                       }
+               error = posix_acl_create(&acl, GFP_KERNEL, &mode);
+               if (error < 0)
+                       return error;
+               inode->i_mode = mode;
+               if (error > 0) {
+                       /* This is an extended ACL */
+                       error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl);
                }
-               posix_acl_release(clone);
        }
 cleanup:
        posix_acl_release(acl);
@@ -322,7 +290,7 @@ cleanup:
 int
 ext2_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
         int error;
 
        if (!test_opt(inode->i_sb, POSIX_ACL))
@@ -332,14 +300,11 @@ ext2_acl_chmod(struct inode *inode)
        acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
+       error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (error)
+               return error;
+       error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl);
        posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       error = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!error)
-               error = ext2_set_acl(inode, ACL_TYPE_ACCESS, clone);
-       posix_acl_release(clone);
        return error;
 }
 
index 3ff6cbb9ac4486e2c6bc4e7b0ca83485ab01fd1f..5c0a6a4fb052c78a3d14df3b25bfc47a26b5fe9b 100644 (file)
@@ -54,13 +54,13 @@ static inline int ext2_acl_count(size_t size)
 #ifdef CONFIG_EXT2_FS_POSIX_ACL
 
 /* acl.c */
-extern int ext2_check_acl (struct inode *, int);
+extern struct posix_acl *ext2_get_acl(struct inode *inode, int type);
 extern int ext2_acl_chmod (struct inode *);
 extern int ext2_init_acl (struct inode *, struct inode *);
 
 #else
 #include <linux/sched.h>
-#define ext2_check_acl NULL
+#define ext2_get_acl   NULL
 #define ext2_get_acl   NULL
 #define ext2_set_acl   NULL
 
index 82e06321de359176c20c9603ba1a9dee2b15b638..a5b3a5db31206f8f3c84781362f7c45e919ddf0e 100644 (file)
@@ -102,6 +102,6 @@ const struct inode_operations ext2_file_inode_operations = {
        .removexattr    = generic_removexattr,
 #endif
        .setattr        = ext2_setattr,
-       .check_acl      = ext2_check_acl,
+       .get_acl        = ext2_get_acl,
        .fiemap         = ext2_fiemap,
 };
index d60b7099e2db3c649be7707924575891bd3d77d1..761fde807fc910f7961d494db363c341fa5f2baf 100644 (file)
@@ -408,7 +408,7 @@ const struct inode_operations ext2_dir_inode_operations = {
        .removexattr    = generic_removexattr,
 #endif
        .setattr        = ext2_setattr,
-       .check_acl      = ext2_check_acl,
+       .get_acl        = ext2_get_acl,
 };
 
 const struct inode_operations ext2_special_inode_operations = {
@@ -419,5 +419,5 @@ const struct inode_operations ext2_special_inode_operations = {
        .removexattr    = generic_removexattr,
 #endif
        .setattr        = ext2_setattr,
-       .check_acl      = ext2_check_acl,
+       .get_acl        = ext2_get_acl,
 };
index edfeb293d4cb601457339ca97d5ceeae64416623..6c29bf0df04a0d0ed619a3b886e2d24847ab7a45 100644 (file)
@@ -131,7 +131,7 @@ fail:
  *
  * inode->i_mutex: don't care
  */
-static struct posix_acl *
+struct posix_acl *
 ext3_get_acl(struct inode *inode, int type)
 {
        int name_index;
@@ -239,29 +239,6 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
        return error;
 }
 
-int
-ext3_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       return -ECHILD;
-               return -EAGAIN;
-       }
-
-       acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 /*
  * Initialize the ACLs of a new inode. Called from ext3_new_inode.
  *
@@ -284,8 +261,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
                        inode->i_mode &= ~current_umask();
        }
        if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
-               struct posix_acl *clone;
-               mode_t mode;
+               mode_t mode = inode->i_mode;
 
                if (S_ISDIR(inode->i_mode)) {
                        error = ext3_set_acl(handle, inode,
@@ -293,22 +269,15 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
                        if (error)
                                goto cleanup;
                }
-               clone = posix_acl_clone(acl, GFP_NOFS);
-               error = -ENOMEM;
-               if (!clone)
-                       goto cleanup;
-
-               mode = inode->i_mode;
-               error = posix_acl_create_masq(clone, &mode);
-               if (error >= 0) {
-                       inode->i_mode = mode;
-                       if (error > 0) {
-                               /* This is an extended ACL */
-                               error = ext3_set_acl(handle, inode,
-                                                    ACL_TYPE_ACCESS, clone);
-                       }
+               error = posix_acl_create(&acl, GFP_NOFS, &mode);
+               if (error < 0)
+                       return error;
+
+               inode->i_mode = mode;
+               if (error > 0) {
+                       /* This is an extended ACL */
+                       error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
                }
-               posix_acl_release(clone);
        }
 cleanup:
        posix_acl_release(acl);
@@ -332,7 +301,9 @@ cleanup:
 int
 ext3_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
+       handle_t *handle;
+       int retries = 0;
         int error;
 
        if (S_ISLNK(inode->i_mode))
@@ -342,31 +313,24 @@ ext3_acl_chmod(struct inode *inode)
        acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
-       posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       error = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!error) {
-               handle_t *handle;
-               int retries = 0;
-
-       retry:
-               handle = ext3_journal_start(inode,
-                               EXT3_DATA_TRANS_BLOCKS(inode->i_sb));
-               if (IS_ERR(handle)) {
-                       error = PTR_ERR(handle);
-                       ext3_std_error(inode->i_sb, error);
-                       goto out;
-               }
-               error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
-               ext3_journal_stop(handle);
-               if (error == -ENOSPC &&
-                   ext3_should_retry_alloc(inode->i_sb, &retries))
-                       goto retry;
+       error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (error)
+               return error;
+retry:
+       handle = ext3_journal_start(inode,
+                       EXT3_DATA_TRANS_BLOCKS(inode->i_sb));
+       if (IS_ERR(handle)) {
+               error = PTR_ERR(handle);
+               ext3_std_error(inode->i_sb, error);
+               goto out;
        }
+       error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
+       ext3_journal_stop(handle);
+       if (error == -ENOSPC &&
+           ext3_should_retry_alloc(inode->i_sb, &retries))
+               goto retry;
 out:
-       posix_acl_release(clone);
+       posix_acl_release(acl);
        return error;
 }
 
index 597334626de93aee68631305d98a823e815058c4..dbc921e458c5599177fb86fc6e3fc95481cf06ab 100644 (file)
@@ -54,13 +54,13 @@ static inline int ext3_acl_count(size_t size)
 #ifdef CONFIG_EXT3_FS_POSIX_ACL
 
 /* acl.c */
-extern int ext3_check_acl (struct inode *, int);
+extern struct posix_acl *ext3_get_acl(struct inode *inode, int type);
 extern int ext3_acl_chmod (struct inode *);
 extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
 
 #else  /* CONFIG_EXT3_FS_POSIX_ACL */
 #include <linux/sched.h>
-#define ext3_check_acl NULL
+#define ext3_get_acl NULL
 
 static inline int
 ext3_acl_chmod(struct inode *inode)
index f55df0e61cbded50f25db7dc094c0ffc5a8dc7a3..2be5b99097f13ad44f2db41ca680bfc82a3fa741 100644 (file)
@@ -79,7 +79,7 @@ const struct inode_operations ext3_file_inode_operations = {
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext3_check_acl,
+       .get_acl        = ext3_get_acl,
        .fiemap         = ext3_fiemap,
 };
 
index c095cf5640c79c4462ed0a60cd7aed5fd8c5472f..3b57230a17bbf9adad3748d790cc3376e7b3f9c2 100644 (file)
@@ -2529,7 +2529,7 @@ const struct inode_operations ext3_dir_inode_operations = {
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext3_check_acl,
+       .get_acl        = ext3_get_acl,
 };
 
 const struct inode_operations ext3_special_inode_operations = {
@@ -2540,5 +2540,5 @@ const struct inode_operations ext3_special_inode_operations = {
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext3_check_acl,
+       .get_acl        = ext3_get_acl,
 };
index 60d900fcc3dbbee54bba6d8ef4c77c8a3aa3bc39..dca2d1ded931eafbad76cda7cd9b0f07bf7fa6f8 100644 (file)
@@ -131,7 +131,7 @@ fail:
  *
  * inode->i_mutex: don't care
  */
-static struct posix_acl *
+struct posix_acl *
 ext4_get_acl(struct inode *inode, int type)
 {
        int name_index;
@@ -237,29 +237,6 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
        return error;
 }
 
-int
-ext4_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       return -ECHILD;
-               return -EAGAIN;
-       }
-
-       acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 /*
  * Initialize the ACLs of a new inode. Called from ext4_new_inode.
  *
@@ -282,8 +259,7 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
                        inode->i_mode &= ~current_umask();
        }
        if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
-               struct posix_acl *clone;
-               mode_t mode;
+               mode_t mode = inode->i_mode;
 
                if (S_ISDIR(inode->i_mode)) {
                        error = ext4_set_acl(handle, inode,
@@ -291,22 +267,15 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
                        if (error)
                                goto cleanup;
                }
-               clone = posix_acl_clone(acl, GFP_NOFS);
-               error = -ENOMEM;
-               if (!clone)
-                       goto cleanup;
-
-               mode = inode->i_mode;
-               error = posix_acl_create_masq(clone, &mode);
-               if (error >= 0) {
-                       inode->i_mode = mode;
-                       if (error > 0) {
-                               /* This is an extended ACL */
-                               error = ext4_set_acl(handle, inode,
-                                                    ACL_TYPE_ACCESS, clone);
-                       }
+               error = posix_acl_create(&acl, GFP_NOFS, &mode);
+               if (error < 0)
+                       return error;
+
+               inode->i_mode = mode;
+               if (error > 0) {
+                       /* This is an extended ACL */
+                       error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
                }
-               posix_acl_release(clone);
        }
 cleanup:
        posix_acl_release(acl);
@@ -330,9 +299,12 @@ cleanup:
 int
 ext4_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
+       handle_t *handle;
+       int retries = 0;
        int error;
 
+
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
        if (!test_opt(inode->i_sb, POSIX_ACL))
@@ -340,31 +312,24 @@ ext4_acl_chmod(struct inode *inode)
        acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
-       posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       error = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!error) {
-               handle_t *handle;
-               int retries = 0;
-
-       retry:
-               handle = ext4_journal_start(inode,
-                               EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
-               if (IS_ERR(handle)) {
-                       error = PTR_ERR(handle);
-                       ext4_std_error(inode->i_sb, error);
-                       goto out;
-               }
-               error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
-               ext4_journal_stop(handle);
-               if (error == -ENOSPC &&
-                   ext4_should_retry_alloc(inode->i_sb, &retries))
-                       goto retry;
+       error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (error)
+               return error;
+retry:
+       handle = ext4_journal_start(inode,
+                       EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
+       if (IS_ERR(handle)) {
+               error = PTR_ERR(handle);
+               ext4_std_error(inode->i_sb, error);
+               goto out;
        }
+       error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
+       ext4_journal_stop(handle);
+       if (error == -ENOSPC &&
+           ext4_should_retry_alloc(inode->i_sb, &retries))
+               goto retry;
 out:
-       posix_acl_release(clone);
+       posix_acl_release(acl);
        return error;
 }
 
index 9d843d5deac402593b8b557e27c6ed25aafe401d..18cb39ed7c7bbb88dfb72f67150b40cf859e2a58 100644 (file)
@@ -54,13 +54,13 @@ static inline int ext4_acl_count(size_t size)
 #ifdef CONFIG_EXT4_FS_POSIX_ACL
 
 /* acl.c */
-extern int ext4_check_acl(struct inode *, int);
+struct posix_acl *ext4_get_acl(struct inode *inode, int type);
 extern int ext4_acl_chmod(struct inode *);
 extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
 
 #else  /* CONFIG_EXT4_FS_POSIX_ACL */
 #include <linux/sched.h>
-#define ext4_check_acl NULL
+#define ext4_get_acl NULL
 
 static inline int
 ext4_acl_chmod(struct inode *inode)
index ce766f974b1d49509941552983936e5e9ea62141..e4095e988ebacb379a7784f72f52f78f51176ac4 100644 (file)
@@ -301,7 +301,7 @@ const struct inode_operations ext4_file_inode_operations = {
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext4_check_acl,
+       .get_acl        = ext4_get_acl,
        .fiemap         = ext4_fiemap,
 };
 
index 707d605bf76985dfe0b873b8fccda9c6459682b1..8c9babac43dc941fa62ece2773f234044b8a5b7b 100644 (file)
@@ -2590,7 +2590,7 @@ const struct inode_operations ext4_dir_inode_operations = {
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext4_check_acl,
+       .get_acl        = ext4_get_acl,
        .fiemap         = ext4_fiemap,
 };
 
@@ -2602,5 +2602,5 @@ const struct inode_operations ext4_special_inode_operations = {
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext4_check_acl,
+       .get_acl        = ext4_get_acl,
 };
index 70e90b4974cedd355467552653eae47ab3b07cd0..d5e33a077a67e7bb7cce426b5a4c5616e201c686 100644 (file)
@@ -132,31 +132,17 @@ generic_acl_init(struct inode *inode, struct inode *dir)
        if (!S_ISLNK(inode->i_mode))
                acl = get_cached_acl(dir, ACL_TYPE_DEFAULT);
        if (acl) {
-               struct posix_acl *clone;
-
-               if (S_ISDIR(inode->i_mode)) {
-                       clone = posix_acl_clone(acl, GFP_KERNEL);
-                       error = -ENOMEM;
-                       if (!clone)
-                               goto cleanup;
-                       set_cached_acl(inode, ACL_TYPE_DEFAULT, clone);
-                       posix_acl_release(clone);
-               }
-               clone = posix_acl_clone(acl, GFP_KERNEL);
-               error = -ENOMEM;
-               if (!clone)
-                       goto cleanup;
-               error = posix_acl_create_masq(clone, &mode);
-               if (error >= 0) {
-                       inode->i_mode = mode;
-                       if (error > 0)
-                               set_cached_acl(inode, ACL_TYPE_ACCESS, clone);
-               }
-               posix_acl_release(clone);
+               if (S_ISDIR(inode->i_mode))
+                       set_cached_acl(inode, ACL_TYPE_DEFAULT, acl);
+               error = posix_acl_create(&acl, GFP_KERNEL, &mode);
+               if (error < 0)
+                       return error;
+               inode->i_mode = mode;
+               if (error > 0)
+                       set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
        }
        error = 0;
 
-cleanup:
        posix_acl_release(acl);
        return error;
 }
@@ -170,44 +156,22 @@ cleanup:
 int
 generic_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int error = 0;
 
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
        acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
        if (acl) {
-               clone = posix_acl_clone(acl, GFP_KERNEL);
+               error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+               if (error)
+                       return error;
+               set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
                posix_acl_release(acl);
-               if (!clone)
-                       return -ENOMEM;
-               error = posix_acl_chmod_masq(clone, inode->i_mode);
-               if (!error)
-                       set_cached_acl(inode, ACL_TYPE_ACCESS, clone);
-               posix_acl_release(clone);
        }
        return error;
 }
 
-int
-generic_check_acl(struct inode *inode, int mask)
-{
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       return -ECHILD;
-       } else {
-               struct posix_acl *acl;
-
-               acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
-               if (acl) {
-                       int error = posix_acl_permission(inode, acl, mask);
-                       posix_acl_release(acl);
-                       return error;
-               }
-       }
-       return -EAGAIN;
-}
-
 const struct xattr_handler generic_acl_access_handler = {
        .prefix = POSIX_ACL_XATTR_ACCESS,
        .flags  = ACL_TYPE_ACCESS,
index 8ef1079f166503e9c4c1a16dd9ea0eb57f2c5875..884c9af0542fac0658cf5108d7869e5a08668e5a 100644 (file)
@@ -67,36 +67,9 @@ static struct posix_acl *gfs2_acl_get(struct gfs2_inode *ip, int type)
        return acl;
 }
 
-/**
- * gfs2_check_acl - Check an ACL to see if we're allowed to do something
- * @inode: the file we want to do something to
- * @mask: what we want to do
- *
- * Returns: errno
- */
-
-int gfs2_check_acl(struct inode *inode, int mask)
+struct posix_acl *gfs2_get_acl(struct inode *inode, int type)
 {
-       struct posix_acl *acl;
-       int error;
-
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       return -ECHILD;
-               return -EAGAIN;
-       }
-
-       acl = gfs2_acl_get(GFS2_I(inode), ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-
-       if (acl) {
-               error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
+       return gfs2_acl_get(GFS2_I(inode), type);
 }
 
 static int gfs2_set_mode(struct inode *inode, mode_t mode)
@@ -143,7 +116,7 @@ out:
 int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        mode_t mode = inode->i_mode;
        int error = 0;
 
@@ -168,16 +141,10 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode)
                        goto out;
        }
 
-       clone = posix_acl_clone(acl, GFP_NOFS);
-       error = -ENOMEM;
-       if (!clone)
-               goto out;
-       posix_acl_release(acl);
-       acl = clone;
-
-       error = posix_acl_create_masq(acl, &mode);
+       error = posix_acl_create(&acl, GFP_NOFS, &mode);
        if (error < 0)
-               goto out;
+               return error;
+
        if (error == 0)
                goto munge;
 
@@ -193,7 +160,7 @@ out:
 
 int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        char *data;
        unsigned int len;
        int error;
@@ -204,25 +171,19 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
        if (!acl)
                return gfs2_setattr_simple(ip, attr);
 
-       clone = posix_acl_clone(acl, GFP_NOFS);
+       error = posix_acl_chmod(&acl, GFP_NOFS, attr->ia_mode);
+       if (error)
+               return error;
+
+       len = posix_acl_to_xattr(acl, NULL, 0);
+       data = kmalloc(len, GFP_NOFS);
        error = -ENOMEM;
-       if (!clone)
+       if (data == NULL)
                goto out;
-       posix_acl_release(acl);
-       acl = clone;
-
-       error = posix_acl_chmod_masq(acl, attr->ia_mode);
-       if (!error) {
-               len = posix_acl_to_xattr(acl, NULL, 0);
-               data = kmalloc(len, GFP_NOFS);
-               error = -ENOMEM;
-               if (data == NULL)
-                       goto out;
-               posix_acl_to_xattr(acl, data, len);
-               error = gfs2_xattr_acl_chmod(ip, attr, data);
-               kfree(data);
-               set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl);
-       }
+       posix_acl_to_xattr(acl, data, len);
+       error = gfs2_xattr_acl_chmod(ip, attr, data);
+       kfree(data);
+       set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl);
 
 out:
        posix_acl_release(acl);
index b522b0cb39eaa12798649c2a8bd2b1e952a746f9..0da38dc7efec24959a1ad656ff2cda8b561db1e0 100644 (file)
@@ -16,7 +16,7 @@
 #define GFS2_POSIX_ACL_DEFAULT         "posix_acl_default"
 #define GFS2_ACL_MAX_ENTRIES           25
 
-extern int gfs2_check_acl(struct inode *inode, int mask);
+extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type);
 extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode);
 extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr);
 extern const struct xattr_handler gfs2_xattr_system_handler;
index 0fb51a96eff0a8bb743fc83b2961a16465d8fa0c..900cf986aadcc155d26028971f71bc6fa9a972ec 100644 (file)
@@ -1846,7 +1846,7 @@ const struct inode_operations gfs2_file_iops = {
        .listxattr = gfs2_listxattr,
        .removexattr = gfs2_removexattr,
        .fiemap = gfs2_fiemap,
-       .check_acl = gfs2_check_acl,
+       .get_acl = gfs2_get_acl,
 };
 
 const struct inode_operations gfs2_dir_iops = {
@@ -1867,7 +1867,7 @@ const struct inode_operations gfs2_dir_iops = {
        .listxattr = gfs2_listxattr,
        .removexattr = gfs2_removexattr,
        .fiemap = gfs2_fiemap,
-       .check_acl = gfs2_check_acl,
+       .get_acl = gfs2_get_acl,
 };
 
 const struct inode_operations gfs2_symlink_iops = {
@@ -1882,6 +1882,6 @@ const struct inode_operations gfs2_symlink_iops = {
        .listxattr = gfs2_listxattr,
        .removexattr = gfs2_removexattr,
        .fiemap = gfs2_fiemap,
-       .check_acl = gfs2_check_acl,
+       .get_acl = gfs2_get_acl,
 };
 
index 7aafeb8fa3005eb14fd09f75d94c17dbeefe8481..0b686cec9976b39bfd50f37b4a5ad8d7690d4e29 100644 (file)
@@ -1030,6 +1030,7 @@ static int __init init_hugetlbfs_fs(void)
 static void __exit exit_hugetlbfs_fs(void)
 {
        kmem_cache_destroy(hugetlbfs_inode_cachep);
+       kern_unmount(hugetlbfs_vfsmount);
        unregister_filesystem(&hugetlbfs_fs_type);
        bdi_destroy(&hugetlbfs_backing_dev_info);
 }
index 3675b3cdee8921e9d958338489ab2e00b6e3a58d..27c511a1cf053f3dbbae46e76588af66f2bff7aa 100644 (file)
@@ -156,7 +156,7 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
        return ERR_PTR(-EINVAL);
 }
 
-static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
+struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        char *value = NULL;
@@ -259,30 +259,11 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return rc;
 }
 
-int jffs2_check_acl(struct inode *inode, int mask)
+int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode)
 {
        struct posix_acl *acl;
        int rc;
 
-       if (mask & MAY_NOT_BLOCK)
-               return -ECHILD;
-
-       acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               rc = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return rc;
-       }
-       return -EAGAIN;
-}
-
-int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
-{
-       struct posix_acl *acl, *clone;
-       int rc;
-
        cache_no_acl(inode);
 
        if (S_ISLNK(*i_mode))
@@ -298,18 +279,13 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
                if (S_ISDIR(*i_mode))
                        set_cached_acl(inode, ACL_TYPE_DEFAULT, acl);
 
-               clone = posix_acl_clone(acl, GFP_KERNEL);
-               if (!clone)
-                       return -ENOMEM;
-               rc = posix_acl_create_masq(clone, (mode_t *)i_mode);
-               if (rc < 0) {
-                       posix_acl_release(clone);
+               rc = posix_acl_create(&acl, GFP_KERNEL, i_mode);
+               if (rc < 0)
                        return rc;
-               }
                if (rc > 0)
-                       set_cached_acl(inode, ACL_TYPE_ACCESS, clone);
+                       set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
 
-               posix_acl_release(clone);
+               posix_acl_release(acl);
        }
        return 0;
 }
@@ -335,7 +311,7 @@ int jffs2_init_acl_post(struct inode *inode)
 
 int jffs2_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int rc;
 
        if (S_ISLNK(inode->i_mode))
@@ -343,14 +319,11 @@ int jffs2_acl_chmod(struct inode *inode)
        acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
+       rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (rc)
+               return rc;
+       rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, acl);
        posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       rc = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!rc)
-               rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, clone);
-       posix_acl_release(clone);
        return rc;
 }
 
index 5e42de8d954126a46664125678cdd037a76470a7..b3421c78d9f85482be72d045fdde7194e2bb63d8 100644 (file)
@@ -26,9 +26,9 @@ struct jffs2_acl_header {
 
 #ifdef CONFIG_JFFS2_FS_POSIX_ACL
 
-extern int jffs2_check_acl(struct inode *, int);
+struct posix_acl *jffs2_get_acl(struct inode *inode, int type);
 extern int jffs2_acl_chmod(struct inode *);
-extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *);
+extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *);
 extern int jffs2_init_acl_post(struct inode *);
 
 extern const struct xattr_handler jffs2_acl_access_xattr_handler;
@@ -36,7 +36,7 @@ extern const struct xattr_handler jffs2_acl_default_xattr_handler;
 
 #else
 
-#define jffs2_check_acl                                (NULL)
+#define jffs2_get_acl                          (NULL)
 #define jffs2_acl_chmod(inode)                 (0)
 #define jffs2_init_acl_pre(dir_i,inode,mode)   (0)
 #define jffs2_init_acl_post(inode)             (0)
index 5f243cd63afc330e817f1dbfa1a52cb5eb83b33c..9659b7c00468064cdc9e51be4d68d06229fc85eb 100644 (file)
@@ -56,7 +56,7 @@ const struct inode_operations jffs2_dir_inode_operations =
        .rmdir =        jffs2_rmdir,
        .mknod =        jffs2_mknod,
        .rename =       jffs2_rename,
-       .check_acl =    jffs2_check_acl,
+       .get_acl =      jffs2_get_acl,
        .setattr =      jffs2_setattr,
        .setxattr =     jffs2_setxattr,
        .getxattr =     jffs2_getxattr,
index 3989f7e09f7f649c96ad9e5737de886697c018b4..61e6723535b9d56f6cf727328ca7ae8d2a94090a 100644 (file)
@@ -63,7 +63,7 @@ const struct file_operations jffs2_file_operations =
 
 const struct inode_operations jffs2_file_inode_operations =
 {
-       .check_acl =    jffs2_check_acl,
+       .get_acl =      jffs2_get_acl,
        .setattr =      jffs2_setattr,
        .setxattr =     jffs2_setxattr,
        .getxattr =     jffs2_getxattr,
index 46ad619b6124fdd92ab0ac83e439311a58c4ca9b..eeead33d8ef0e617901fc7762891e8d24cde4c8f 100644 (file)
@@ -406,7 +406,7 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
 
 /* jffs2_new_inode: allocate a new inode and inocache, add it to the hash,
    fill in the raw_inode while you're at it. */
-struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_inode *ri)
+struct inode *jffs2_new_inode (struct inode *dir_i, mode_t mode, struct jffs2_raw_inode *ri)
 {
        struct inode *inode;
        struct super_block *sb = dir_i->i_sb;
index 9c252835e8e59507c8d9b56ddd985c5ed3e9ed84..526979c607b6b91e5354b16e35f825aa0ef21d11 100644 (file)
@@ -173,7 +173,7 @@ int jffs2_do_setattr (struct inode *, struct iattr *);
 struct inode *jffs2_iget(struct super_block *, unsigned long);
 void jffs2_evict_inode (struct inode *);
 void jffs2_dirty_inode(struct inode *inode, int flags);
-struct inode *jffs2_new_inode (struct inode *dir_i, int mode,
+struct inode *jffs2_new_inode (struct inode *dir_i, mode_t mode,
                               struct jffs2_raw_inode *ri);
 int jffs2_statfs (struct dentry *, struct kstatfs *);
 int jffs2_remount_fs (struct super_block *, int *, char *);
index b955626071c28acb8be9728b88399f8c9cdd7ab4..e3035afb18145e60add43a86640b1464fdac5aa4 100644 (file)
@@ -20,7 +20,7 @@ const struct inode_operations jffs2_symlink_inode_operations =
 {
        .readlink =     generic_readlink,
        .follow_link =  jffs2_follow_link,
-       .check_acl =    jffs2_check_acl,
+       .get_acl =      jffs2_get_acl,
        .setattr =      jffs2_setattr,
        .setxattr =     jffs2_setxattr,
        .getxattr =     jffs2_getxattr,
index 8a0a0666d5a6f141e4f1f5f387d3b69db9a02938..b3a32caf2b4596d8ce0fa8a53c5084787088c4cc 100644 (file)
@@ -27,7 +27,7 @@
 #include "jfs_xattr.h"
 #include "jfs_acl.h"
 
-static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
+struct posix_acl *jfs_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        char *ea_name;
@@ -114,30 +114,9 @@ out:
        return rc;
 }
 
-int jfs_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       if (mask & MAY_NOT_BLOCK)
-               return -ECHILD;
-
-       acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
 {
        struct posix_acl *acl = NULL;
-       struct posix_acl *clone;
-       mode_t mode;
        int rc = 0;
 
        if (S_ISLNK(inode->i_mode))
@@ -148,25 +127,18 @@ int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
                return PTR_ERR(acl);
 
        if (acl) {
+               mode_t mode = inode->i_mode;
                if (S_ISDIR(inode->i_mode)) {
                        rc = jfs_set_acl(tid, inode, ACL_TYPE_DEFAULT, acl);
                        if (rc)
                                goto cleanup;
                }
-               clone = posix_acl_clone(acl, GFP_KERNEL);
-               if (!clone) {
-                       rc = -ENOMEM;
-                       goto cleanup;
-               }
-               mode = inode->i_mode;
-               rc = posix_acl_create_masq(clone, &mode);
-               if (rc >= 0) {
-                       inode->i_mode = mode;
-                       if (rc > 0)
-                               rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS,
-                                                clone);
-               }
-               posix_acl_release(clone);
+               rc = posix_acl_create(&acl, GFP_KERNEL, &mode);
+               if (rc < 0)
+                       goto cleanup; /* posix_acl_release(NULL) is no-op */
+               inode->i_mode = mode;
+               if (rc > 0)
+                       rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, acl);
 cleanup:
                posix_acl_release(acl);
        } else
@@ -180,8 +152,9 @@ cleanup:
 
 int jfs_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int rc;
+       tid_t tid;
 
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
@@ -190,22 +163,18 @@ int jfs_acl_chmod(struct inode *inode)
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
 
-       clone = posix_acl_clone(acl, GFP_KERNEL);
-       posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-
-       rc = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!rc) {
-               tid_t tid = txBegin(inode->i_sb, 0);
-               mutex_lock(&JFS_IP(inode)->commit_mutex);
-               rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
-               if (!rc)
-                       rc = txCommit(tid, 1, &inode, 0);
-               txEnd(tid);
-               mutex_unlock(&JFS_IP(inode)->commit_mutex);
-       }
+       rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (rc)
+               return rc;
 
-       posix_acl_release(clone);
+       tid = txBegin(inode->i_sb, 0);
+       mutex_lock(&JFS_IP(inode)->commit_mutex);
+       rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, acl);
+       if (!rc)
+               rc = txCommit(tid, 1, &inode, 0);
+       txEnd(tid);
+       mutex_unlock(&JFS_IP(inode)->commit_mutex);
+
+       posix_acl_release(acl);
        return rc;
 }
index 7527855b5cc6fc71ec5b613fbf022bd725843f20..844f9460cb11344dc65253c79ef5ec0baf6fe576 100644 (file)
@@ -140,7 +140,7 @@ const struct inode_operations jfs_file_inode_operations = {
        .removexattr    = jfs_removexattr,
        .setattr        = jfs_setattr,
 #ifdef CONFIG_JFS_POSIX_ACL
-       .check_acl      = jfs_check_acl,
+       .get_acl        = jfs_get_acl,
 #endif
 };
 
index 54e07559878d12e2fe77c7b39e4f2114c7a3abdb..ad84fe50ca9e897362caa12101d63a590b56073f 100644 (file)
@@ -20,7 +20,7 @@
 
 #ifdef CONFIG_JFS_POSIX_ACL
 
-int jfs_check_acl(struct inode *, int);
+struct posix_acl *jfs_get_acl(struct inode *inode, int type);
 int jfs_init_acl(tid_t, struct inode *, struct inode *);
 int jfs_acl_chmod(struct inode *inode);
 
index 03787ef6a11826523abaa38fcfce77f57c8c199d..29b1f1a21142d773d9fe0ec783745cc82cd2a21b 100644 (file)
@@ -1537,7 +1537,7 @@ const struct inode_operations jfs_dir_inode_operations = {
        .removexattr    = jfs_removexattr,
        .setattr        = jfs_setattr,
 #ifdef CONFIG_JFS_POSIX_ACL
-       .check_acl      = jfs_check_acl,
+       .get_acl        = jfs_get_acl,
 #endif
 };
 
index b7fad009bbf69884ab938ed26d4fd6ab0a257d9c..ec2e5656b444038e57e37e44ad491b8511c7df19 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/fcntl.h>
 #include <linux/device_cgroup.h>
 #include <linux/fs_struct.h>
+#include <linux/posix_acl.h>
 #include <asm/uaccess.h>
 
 #include "internal.h"
@@ -173,12 +174,60 @@ void putname(const char *name)
 EXPORT_SYMBOL(putname);
 #endif
 
+static int check_acl(struct inode *inode, int mask)
+{
+       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))
+                       return -EAGAIN;
+               return -ECHILD;
+       }
+
+       acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
+
+       /*
+        * A filesystem can force a ACL callback by just never filling the
+        * ACL cache. But normally you'd fill the cache either at inode
+        * instantiation time, or on the first ->get_acl call.
+        *
+        * If the filesystem doesn't have a get_acl() function at all, we'll
+        * just create the negative cache entry.
+        */
+       if (acl == ACL_NOT_CACHED) {
+               if (inode->i_op->get_acl) {
+                       acl = inode->i_op->get_acl(inode, ACL_TYPE_ACCESS);
+                       if (IS_ERR(acl))
+                               return PTR_ERR(acl);
+               } else {
+                       set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
+                       return -EAGAIN;
+               }
+       }
+
+       if (acl) {
+               int error = posix_acl_permission(inode, acl, mask);
+               posix_acl_release(acl);
+               return error;
+       }
+
+       return -EAGAIN;
+}
+
 /*
  * This does basic POSIX ACL permission checking
  */
 static int acl_permission_check(struct inode *inode, int mask)
 {
-       int (*check_acl)(struct inode *inode, int mask);
        unsigned int mode = inode->i_mode;
 
        mask &= MAY_READ | MAY_WRITE | MAY_EXEC | MAY_NOT_BLOCK;
@@ -189,8 +238,7 @@ static int acl_permission_check(struct inode *inode, int mask)
        if (current_fsuid() == inode->i_uid)
                mode >>= 6;
        else {
-               check_acl = inode->i_op->check_acl;
-               if (IS_POSIXACL(inode) && (mode & S_IRWXG) && check_acl) {
+               if (IS_POSIXACL(inode) && (mode & S_IRWXG)) {
                        int error = check_acl(inode, mask);
                        if (error != -EAGAIN)
                                return error;
index cda50fe9250ac3e7eb52d6a56143731505ef732f..22bfe8273c680b441f43a0191c7bd0e805a51ec2 100644 (file)
@@ -2721,6 +2721,25 @@ EXPORT_SYMBOL(put_mnt_ns);
 
 struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
 {
-       return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
+       struct vfsmount *mnt;
+       mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
+       if (!IS_ERR(mnt)) {
+               /*
+                * it is a longterm mount, don't release mnt until
+                * we unmount before file sys is unregistered
+               */
+               mnt_make_longterm(mnt);
+       }
+       return mnt;
 }
 EXPORT_SYMBOL_GPL(kern_mount_data);
+
+void kern_unmount(struct vfsmount *mnt)
+{
+       /* release long term mount so mount point can be released */
+       if (!IS_ERR_OR_NULL(mnt)) {
+               mnt_make_shortterm(mnt);
+               mntput(mnt);
+       }
+}
+EXPORT_SYMBOL(kern_unmount);
index 27434277165570b4f1f00c06f42dc2ca6818804f..e49e73107e6290dda0f9bfa5d625edf5fc54ec2b 100644 (file)
@@ -427,16 +427,12 @@ int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode,
        }
        if (!dfacl)
                return 0;
-       acl = posix_acl_clone(dfacl, GFP_KERNEL);
-       error = -ENOMEM;
-       if (!acl)
-               goto out_release_dfacl;
-       error = posix_acl_create_masq(acl, &mode);
+       acl = posix_acl_dup(dfacl);
+       error = posix_acl_create(&acl, GFP_KERNEL, &mode);
        if (error < 0)
-               goto out_release_acl;
+               goto out_release_dfacl;
        error = nfs3_proc_setacls(inode, acl, S_ISDIR(inode->i_mode) ?
                                                      dfacl : NULL);
-out_release_acl:
        posix_acl_release(acl);
 out_release_dfacl:
        posix_acl_release(dfacl);
index 1cee970eb55a520e258434125c21466cc6160acb..783c58d9daf11b92898676b2af2f55765cdd3caf 100644 (file)
@@ -290,47 +290,32 @@ static int ocfs2_set_acl(handle_t *handle,
        return ret;
 }
 
-int ocfs2_check_acl(struct inode *inode, int mask)
+struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
 {
        struct ocfs2_super *osb;
        struct buffer_head *di_bh = NULL;
        struct posix_acl *acl;
        int ret = -EAGAIN;
 
-       if (mask & MAY_NOT_BLOCK)
-               return -ECHILD;
-
        osb = OCFS2_SB(inode->i_sb);
        if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
-               return ret;
+               return NULL;
 
        ret = ocfs2_read_inode_block(inode, &di_bh);
-       if (ret < 0) {
-               mlog_errno(ret);
-               return ret;
-       }
+       if (ret < 0)
+               return ERR_PTR(ret);
 
-       acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, di_bh);
+       acl = ocfs2_get_acl_nolock(inode, type, di_bh);
 
        brelse(di_bh);
 
-       if (IS_ERR(acl)) {
-               mlog_errno(PTR_ERR(acl));
-               return PTR_ERR(acl);
-       }
-       if (acl) {
-               ret = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return ret;
-       }
-
-       return -EAGAIN;
+       return acl;
 }
 
 int ocfs2_acl_chmod(struct inode *inode)
 {
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int ret;
 
        if (S_ISLNK(inode->i_mode))
@@ -342,15 +327,12 @@ int ocfs2_acl_chmod(struct inode *inode)
        acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
+       ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (ret)
+               return ret;
+       ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
+                           acl, NULL, NULL);
        posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       ret = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!ret)
-               ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
-                                   clone, NULL, NULL);
-       posix_acl_release(clone);
        return ret;
 }
 
@@ -388,8 +370,6 @@ int ocfs2_init_acl(handle_t *handle,
                }
        }
        if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) {
-               struct posix_acl *clone;
-
                if (S_ISDIR(inode->i_mode)) {
                        ret = ocfs2_set_acl(handle, inode, di_bh,
                                            ACL_TYPE_DEFAULT, acl,
@@ -397,27 +377,22 @@ int ocfs2_init_acl(handle_t *handle,
                        if (ret)
                                goto cleanup;
                }
-               clone = posix_acl_clone(acl, GFP_NOFS);
-               ret = -ENOMEM;
-               if (!clone)
-                       goto cleanup;
-
                mode = inode->i_mode;
-               ret = posix_acl_create_masq(clone, &mode);
-               if (ret >= 0) {
-                       ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
-                       if (ret2) {
-                               mlog_errno(ret2);
-                               ret = ret2;
-                               goto cleanup;
-                       }
-                       if (ret > 0) {
-                               ret = ocfs2_set_acl(handle, inode,
-                                                   di_bh, ACL_TYPE_ACCESS,
-                                                   clone, meta_ac, data_ac);
-                       }
+               ret = posix_acl_create(&acl, GFP_NOFS, &mode);
+               if (ret < 0)
+                       return ret;
+
+               ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
+               if (ret2) {
+                       mlog_errno(ret2);
+                       ret = ret2;
+                       goto cleanup;
+               }
+               if (ret > 0) {
+                       ret = ocfs2_set_acl(handle, inode,
+                                           di_bh, ACL_TYPE_ACCESS,
+                                           acl, meta_ac, data_ac);
                }
-               posix_acl_release(clone);
        }
 cleanup:
        posix_acl_release(acl);
index 5c5d31f05853175476cc0c9ed4c2460c67f40da9..071fbd380f2f52889fe4ddc459df3bf603d7629e 100644 (file)
@@ -26,7 +26,7 @@ struct ocfs2_acl_entry {
        __le32 e_id;
 };
 
-extern int ocfs2_check_acl(struct inode *, int);
+struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type);
 extern int ocfs2_acl_chmod(struct inode *);
 extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
                          struct buffer_head *, struct buffer_head *,
index 0fc2bd34039dafd8d05e4bbe89885afbe11167af..de4ea1af041b654f8f1b4f1a000f6492226f701f 100644 (file)
@@ -2600,14 +2600,14 @@ const struct inode_operations ocfs2_file_iops = {
        .listxattr      = ocfs2_listxattr,
        .removexattr    = generic_removexattr,
        .fiemap         = ocfs2_fiemap,
-       .check_acl      = ocfs2_check_acl,
+       .get_acl        = ocfs2_iop_get_acl,
 };
 
 const struct inode_operations ocfs2_special_file_iops = {
        .setattr        = ocfs2_setattr,
        .getattr        = ocfs2_getattr,
        .permission     = ocfs2_permission,
-       .check_acl      = ocfs2_check_acl,
+       .get_acl        = ocfs2_iop_get_acl,
 };
 
 /*
index 33889dc52dd7ee4d856ab482b6ca13cf1b47bb46..53aa41ed7bf39d34d2ad9064813b3e6feeb57971 100644 (file)
@@ -2498,5 +2498,5 @@ const struct inode_operations ocfs2_dir_iops = {
        .listxattr      = ocfs2_listxattr,
        .removexattr    = generic_removexattr,
        .fiemap         = ocfs2_fiemap,
-       .check_acl      = ocfs2_check_acl,
+       .get_acl        = ocfs2_iop_get_acl,
 };
index da42f7db50de42640a7fa56df21e21bbb48cf588..1b7f9af67ccfff8ca6aaacb9ecdd8ddc87fa99a0 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1291,8 +1291,8 @@ static int __init init_pipe_fs(void)
 
 static void __exit exit_pipe_fs(void)
 {
+       kern_unmount(pipe_mnt);
        unregister_filesystem(&pipe_fs_type);
-       mntput(pipe_mnt);
 }
 
 fs_initcall(init_pipe_fs);
index b1cf6bf4b41dea46feb35d8d6d02f4d5c88153f8..a6227d219e93028f1bb0adc19002b3e12a89c8ef 100644 (file)
 
 EXPORT_SYMBOL(posix_acl_init);
 EXPORT_SYMBOL(posix_acl_alloc);
-EXPORT_SYMBOL(posix_acl_clone);
 EXPORT_SYMBOL(posix_acl_valid);
 EXPORT_SYMBOL(posix_acl_equiv_mode);
 EXPORT_SYMBOL(posix_acl_from_mode);
-EXPORT_SYMBOL(posix_acl_create_masq);
-EXPORT_SYMBOL(posix_acl_chmod_masq);
-EXPORT_SYMBOL(posix_acl_permission);
 
 /*
  * Init a fresh posix_acl
@@ -59,7 +55,7 @@ posix_acl_alloc(int count, gfp_t flags)
 /*
  * Clone an ACL.
  */
-struct posix_acl *
+static struct posix_acl *
 posix_acl_clone(const struct posix_acl *acl, gfp_t flags)
 {
        struct posix_acl *clone = NULL;
@@ -283,8 +279,7 @@ check_perm:
  * system calls. All permissions that are not granted by the acl are removed.
  * The permissions in the acl are changed to reflect the mode_p parameter.
  */
-int
-posix_acl_create_masq(struct posix_acl *acl, mode_t *mode_p)
+static int posix_acl_create_masq(struct posix_acl *acl, mode_t *mode_p)
 {
        struct posix_acl_entry *pa, *pe;
        struct posix_acl_entry *group_obj = NULL, *mask_obj = NULL;
@@ -341,8 +336,7 @@ posix_acl_create_masq(struct posix_acl *acl, mode_t *mode_p)
 /*
  * Modify the ACL for the chmod syscall.
  */
-int
-posix_acl_chmod_masq(struct posix_acl *acl, mode_t mode)
+static int posix_acl_chmod_masq(struct posix_acl *acl, mode_t mode)
 {
        struct posix_acl_entry *group_obj = NULL, *mask_obj = NULL;
        struct posix_acl_entry *pa, *pe;
@@ -386,3 +380,39 @@ posix_acl_chmod_masq(struct posix_acl *acl, mode_t mode)
 
        return 0;
 }
+
+int
+posix_acl_create(struct posix_acl **acl, gfp_t gfp, mode_t *mode_p)
+{
+       struct posix_acl *clone = posix_acl_clone(*acl, gfp);
+       int err = -ENOMEM;
+       if (clone) {
+               err = posix_acl_create_masq(clone, mode_p);
+               if (err < 0) {
+                       posix_acl_release(clone);
+                       clone = NULL;
+               }
+       }
+       posix_acl_release(*acl);
+       *acl = clone;
+       return err;
+}
+EXPORT_SYMBOL(posix_acl_create);
+
+int
+posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, mode_t mode)
+{
+       struct posix_acl *clone = posix_acl_clone(*acl, gfp);
+       int err = -ENOMEM;
+       if (clone) {
+               err = posix_acl_chmod_masq(clone, mode);
+               if (err) {
+                       posix_acl_release(clone);
+                       clone = NULL;
+               }
+       }
+       posix_acl_release(*acl);
+       *acl = clone;
+       return err;
+}
+EXPORT_SYMBOL(posix_acl_chmod);
index c7156dc39ce7946b806e210dd0c4382cb1313185..ace635053a3677fa40080fee79897fa8281c7889 100644 (file)
@@ -319,5 +319,5 @@ const struct inode_operations reiserfs_file_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 };
index 2922b90ceac1a799daa881dfbc3ed991ed2664c2..9b0d4b78b4fbf83f8591b8910b794e4219466cda 100644 (file)
@@ -1475,6 +1475,11 @@ void reiserfs_read_locked_inode(struct inode *inode,
 
        reiserfs_check_path(&path_to_sd);       /* init inode should be relsing */
 
+       /*
+        * Stat data v1 doesn't support ACLs.
+        */
+       if (get_inode_sd_version(inode) == STAT_DATA_V1)
+               cache_no_acl(inode);
 }
 
 /**
index 551f1b79dbc479a810a849df2f9ce1a118ead575..ef392324bbf14f7b06de26ef30cc75461f7a1f84 100644 (file)
@@ -1529,7 +1529,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 };
 
 /*
@@ -1546,7 +1546,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 
 };
 
@@ -1560,5 +1560,5 @@ const struct inode_operations reiserfs_special_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 };
index 6938d8c68d6e5114d427cb350ae7e8765da928dd..6bc346c160e71489ead30d54f41afc3e07ed23bd 100644 (file)
@@ -867,33 +867,6 @@ out:
        return err;
 }
 
-int reiserfs_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-       int error = -EAGAIN; /* do regular unix permission checks by default */
-
-       /*
-        * Stat data v1 doesn't support ACLs.
-        */
-       if (get_inode_sd_version(inode) == STAT_DATA_V1)
-               return -EAGAIN;
-
-       if (mask & MAY_NOT_BLOCK)
-               return -ECHILD;
-
-       acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
-
-       if (acl) {
-               if (!IS_ERR(acl)) {
-                       error = posix_acl_permission(inode, acl, mask);
-                       posix_acl_release(acl);
-               } else if (PTR_ERR(acl) != -ENODATA)
-                       error = PTR_ERR(acl);
-       }
-
-       return error;
-}
-
 static int create_privroot(struct dentry *dentry)
 {
        int err;
index 3dc38f1206fc06a6757521a399263edca7d1f844..7362cf4c946a0f46b94172d7b30bac31e8602c21 100644 (file)
@@ -354,9 +354,7 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
                return PTR_ERR(acl);
 
        if (acl) {
-               struct posix_acl *acl_copy;
                mode_t mode = inode->i_mode;
-               int need_acl;
 
                /* Copy the default ACL to the default ACL of a new directory */
                if (S_ISDIR(inode->i_mode)) {
@@ -368,29 +366,15 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
 
                /* Now we reconcile the new ACL and the mode,
                   potentially modifying both */
-               acl_copy = posix_acl_clone(acl, GFP_NOFS);
-               if (!acl_copy) {
-                       err = -ENOMEM;
-                       goto cleanup;
-               }
+               err = posix_acl_create(&acl, GFP_NOFS, &mode);
+               if (err < 0)
+                       return err;
 
-               need_acl = posix_acl_create_masq(acl_copy, &mode);
-               if (need_acl >= 0) {
-                       if (mode != inode->i_mode) {
-                               inode->i_mode = mode;
-                       }
+               inode->i_mode = mode;
 
-                       /* If we need an ACL.. */
-                       if (need_acl > 0) {
-                               err = reiserfs_set_acl(th, inode,
-                                                      ACL_TYPE_ACCESS,
-                                                      acl_copy);
-                               if (err)
-                                       goto cleanup_copy;
-                       }
-               }
-             cleanup_copy:
-               posix_acl_release(acl_copy);
+               /* If we need an ACL.. */
+               if (err > 0)
+                       err = reiserfs_set_acl(th, inode, ACL_TYPE_ACCESS, acl);
              cleanup:
                posix_acl_release(acl);
        } else {
@@ -445,7 +429,10 @@ int reiserfs_cache_default_acl(struct inode *inode)
 
 int reiserfs_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct reiserfs_transaction_handle th;
+       struct posix_acl *acl;
+       size_t size;
+       int depth;
        int error;
 
        if (S_ISLNK(inode->i_mode))
@@ -463,30 +450,22 @@ int reiserfs_acl_chmod(struct inode *inode)
                return 0;
        if (IS_ERR(acl))
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_NOFS);
-       posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       error = posix_acl_chmod_masq(clone, inode->i_mode);
+       error = posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode);
+       if (error)
+               return error;
+
+       size = reiserfs_xattr_nblocks(inode, reiserfs_acl_size(acl->a_count));
+       depth = reiserfs_write_lock_once(inode->i_sb);
+       error = journal_begin(&th, inode->i_sb, size * 2);
        if (!error) {
-               struct reiserfs_transaction_handle th;
-               size_t size = reiserfs_xattr_nblocks(inode,
-                                            reiserfs_acl_size(clone->a_count));
-               int depth;
-
-               depth = reiserfs_write_lock_once(inode->i_sb);
-               error = journal_begin(&th, inode->i_sb, size * 2);
-               if (!error) {
-                       int error2;
-                       error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS,
-                                                clone);
-                       error2 = journal_end(&th, inode->i_sb, size * 2);
-                       if (error2)
-                               error = error2;
-               }
-               reiserfs_write_unlock_once(inode->i_sb, depth);
+               int error2;
+               error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS, acl);
+               error2 = journal_end(&th, inode->i_sb, size * 2);
+               if (error2)
+                       error = error2;
        }
-       posix_acl_release(clone);
+       reiserfs_write_unlock_once(inode->i_sb, depth);
+       posix_acl_release(acl);
        return error;
 }
 
index cac48fe22ad513ae3a85dd47beed88ce5011886f..44ce516568045386e282eb03456835f87417a45a 100644 (file)
@@ -114,6 +114,8 @@ xfs_get_acl(struct inode *inode, int type)
        if (acl != ACL_NOT_CACHED)
                return acl;
 
+       trace_xfs_get_acl(ip);
+
        switch (type) {
        case ACL_TYPE_ACCESS:
                ea_name = SGI_ACL_FILE;
@@ -218,40 +220,6 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return error;
 }
 
-int
-xfs_check_acl(struct inode *inode, int mask)
-{
-       struct xfs_inode *ip;
-       struct posix_acl *acl;
-       int error = -EAGAIN;
-
-       ip = XFS_I(inode);
-       trace_xfs_check_acl(ip);
-
-       /*
-        * If there is no attribute fork no ACL exists on this inode and
-        * we can skip the whole exercise.
-        */
-       if (!XFS_IFORK_Q(ip))
-               return -EAGAIN;
-
-       if (mask & MAY_NOT_BLOCK) {
-               if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
-                       return -ECHILD;
-               return -EAGAIN;
-       }
-
-       acl = xfs_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-       }
-
-       return error;
-}
-
 static int
 xfs_set_mode(struct inode *inode, mode_t mode)
 {
@@ -297,29 +265,23 @@ posix_acl_default_exists(struct inode *inode)
  * No need for i_mutex because the inode is not yet exposed to the VFS.
  */
 int
-xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl)
+xfs_inherit_acl(struct inode *inode, struct posix_acl *acl)
 {
-       struct posix_acl *clone;
-       mode_t mode;
+       mode_t mode = inode->i_mode;
        int error = 0, inherit = 0;
 
        if (S_ISDIR(inode->i_mode)) {
-               error = xfs_set_acl(inode, ACL_TYPE_DEFAULT, default_acl);
+               error = xfs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
                if (error)
-                       return error;
+                       goto out;
        }
 
-       clone = posix_acl_clone(default_acl, GFP_KERNEL);
-       if (!clone)
-               return -ENOMEM;
-
-       mode = inode->i_mode;
-       error = posix_acl_create_masq(clone, &mode);
+       error = posix_acl_create(&acl, GFP_KERNEL, &mode);
        if (error < 0)
-               goto out_release_clone;
+               return error;
 
        /*
-        * If posix_acl_create_masq returns a positive value we need to
+        * If posix_acl_create returns a positive value we need to
         * inherit a permission that can't be represented using the Unix
         * mode bits and we actually need to set an ACL.
         */
@@ -328,20 +290,20 @@ xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl)
 
        error = xfs_set_mode(inode, mode);
        if (error)
-               goto out_release_clone;
+               goto out;
 
        if (inherit)
-               error = xfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
+               error = xfs_set_acl(inode, ACL_TYPE_ACCESS, acl);
 
- out_release_clone:
-       posix_acl_release(clone);
+out:
+       posix_acl_release(acl);
        return error;
 }
 
 int
 xfs_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int error;
 
        if (S_ISLNK(inode->i_mode))
@@ -351,16 +313,12 @@ xfs_acl_chmod(struct inode *inode)
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
 
-       clone = posix_acl_clone(acl, GFP_KERNEL);
-       posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-
-       error = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!error)
-               error = xfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
+       error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (error)
+               return error;
 
-       posix_acl_release(clone);
+       error = xfs_set_acl(inode, ACL_TYPE_ACCESS, acl);
+       posix_acl_release(acl);
        return error;
 }
 
index cca00f49e092a75f2726a79f4c1076469f0b2f36..825390e1c13850985c634fcbaec19c88ce2d6e46 100644 (file)
@@ -881,11 +881,14 @@ xfs_file_aio_write(
        /* Handle various SYNC-type writes */
        if ((file->f_flags & O_DSYNC) || IS_SYNC(inode)) {
                loff_t end = pos + ret - 1;
+               int error;
 
                xfs_rw_iunlock(ip, iolock);
-               ret = -xfs_file_fsync(file, pos, end,
+               error = xfs_file_fsync(file, pos, end,
                                      (file->f_flags & __O_SYNC) ? 0 : 1);
                xfs_rw_ilock(ip, iolock);
+               if (error)
+                       ret = error;
        }
 
 out_unlock:
index 501e4f630548ad7a4ffd50f78fbc91faf55d0241..6544c3236bc8dd51bff1c8d9935d1f979830553c 100644 (file)
@@ -202,9 +202,9 @@ xfs_vn_mknod(
 
        if (default_acl) {
                error = -xfs_inherit_acl(inode, default_acl);
+               default_acl = NULL;
                if (unlikely(error))
                        goto out_cleanup_inode;
-               posix_acl_release(default_acl);
        }
 
 
@@ -1022,7 +1022,7 @@ xfs_vn_fiemap(
 }
 
 static const struct inode_operations xfs_inode_operations = {
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1048,7 +1048,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
        .rmdir                  = xfs_vn_unlink,
        .mknod                  = xfs_vn_mknod,
        .rename                 = xfs_vn_rename,
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1073,7 +1073,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
        .rmdir                  = xfs_vn_unlink,
        .mknod                  = xfs_vn_mknod,
        .rename                 = xfs_vn_rename,
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1086,7 +1086,7 @@ static const struct inode_operations xfs_symlink_inode_operations = {
        .readlink               = generic_readlink,
        .follow_link            = xfs_vn_follow_link,
        .put_link               = xfs_vn_put_link,
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1194,6 +1194,10 @@ xfs_setup_inode(
                break;
        }
 
+       /* if there is no attribute fork no ACL can exist on this inode */
+       if (!XFS_IFORK_Q(ip))
+               cache_no_acl(inode);
+
        xfs_iflags_clear(ip, XFS_INEW);
        barrier();
 
index fda0708ef2ea82f455bb87dcc0aee00cdbc85632..690fc7a7bd7283f78f24a35dc4e4d7ad10d0a65f 100644 (file)
@@ -571,7 +571,7 @@ DEFINE_INODE_EVENT(xfs_alloc_file_space);
 DEFINE_INODE_EVENT(xfs_free_file_space);
 DEFINE_INODE_EVENT(xfs_readdir);
 #ifdef CONFIG_XFS_POSIX_ACL
-DEFINE_INODE_EVENT(xfs_check_acl);
+DEFINE_INODE_EVENT(xfs_get_acl);
 #endif
 DEFINE_INODE_EVENT(xfs_vm_bmap);
 DEFINE_INODE_EVENT(xfs_file_ioctl);
index 0135e2a669d78924c2e4261450ad5d17676371b8..2c656ef49473b0f429d15861dfde1e1c6eb0b292 100644 (file)
@@ -42,7 +42,6 @@ struct xfs_acl {
 #define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
 
 #ifdef CONFIG_XFS_POSIX_ACL
-extern int xfs_check_acl(struct inode *inode, int mask);
 extern struct posix_acl *xfs_get_acl(struct inode *inode, int type);
 extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl);
 extern int xfs_acl_chmod(struct inode *inode);
@@ -52,7 +51,6 @@ extern int posix_acl_default_exists(struct inode *inode);
 extern const struct xattr_handler xfs_xattr_acl_access_handler;
 extern const struct xattr_handler xfs_xattr_acl_default_handler;
 #else
-# define xfs_check_acl                                 NULL
 # define xfs_get_acl(inode, type)                      NULL
 # define xfs_inherit_acl(inode, default_acl)           0
 # define xfs_acl_chmod(inode)                          0
index 0c35d6e767d900610aa30b6f4e8bc6dc749e70e7..292f8a7d4089f2ed8c69160bca62c13a903a7e18 100644 (file)
@@ -1582,7 +1582,7 @@ struct inode_operations {
        struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
        void * (*follow_link) (struct dentry *, struct nameidata *);
        int (*permission) (struct inode *, int);
-       int (*check_acl)(struct inode *, int);
+       struct posix_acl * (*get_acl)(struct inode *, int);
 
        int (*readlink) (struct dentry *, char __user *,int);
        void (*put_link) (struct dentry *, struct nameidata *, void *);
@@ -1881,6 +1881,7 @@ extern int register_filesystem(struct file_system_type *);
 extern int unregister_filesystem(struct file_system_type *);
 extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
 #define kern_mount(type) kern_mount_data(type, NULL)
+extern void kern_unmount(struct vfsmount *mnt);
 extern int may_umount_tree(struct vfsmount *);
 extern int may_umount(struct vfsmount *);
 extern long do_mount(char *, char *, char *, unsigned long, void *);
index 574bea4013b618d0816d2280ced3670fa4e75bd4..b6d657544ef1afdbcfe2b867bbdaf0d91cfe749c 100644 (file)
@@ -10,6 +10,5 @@ extern const struct xattr_handler generic_acl_default_handler;
 
 int generic_acl_init(struct inode *, struct inode *);
 int generic_acl_chmod(struct inode *);
-int generic_check_acl(struct inode *inode, int mask);
 
 #endif /* LINUX_GENERIC_ACL_H */
index 54211c1cd92634fb4f15bbcf5607948e499e3e52..9a53b99818e28d2302cd004eaf7ef0f05005d1af 100644 (file)
@@ -73,13 +73,12 @@ posix_acl_release(struct posix_acl *acl)
 
 extern void posix_acl_init(struct posix_acl *, int);
 extern struct posix_acl *posix_acl_alloc(int, gfp_t);
-extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t);
 extern int posix_acl_valid(const struct posix_acl *);
 extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
 extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t);
 extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *);
-extern int posix_acl_create_masq(struct posix_acl *, mode_t *);
-extern int posix_acl_chmod_masq(struct posix_acl *, mode_t);
+extern int posix_acl_create(struct posix_acl **, gfp_t, mode_t *);
+extern int posix_acl_chmod(struct posix_acl **, gfp_t, mode_t);
 
 extern struct posix_acl *get_posix_acl(struct inode *, int);
 extern int set_posix_acl(struct inode *, int, struct posix_acl *);
index 3fd8c4506bbb32ef4347784e7a4c529883348bcb..f096b80e73d8145dc35bcdb36f008d29a61f07d9 100644 (file)
@@ -59,11 +59,7 @@ extern const struct xattr_handler reiserfs_posix_acl_access_handler;
 #else
 
 #define reiserfs_cache_default_acl(inode) 0
-
-static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
-{
-       return NULL;
-}
+#define reiserfs_get_acl NULL
 
 static inline int reiserfs_acl_chmod(struct inode *inode)
 {
index 57958c0e1d38319fff4a2f83a3e58250e64cc794..c2b71473266efea1a172055d360c969b74f22680 100644 (file)
@@ -45,7 +45,6 @@ int reiserfs_permission(struct inode *inode, int mask);
 
 #ifdef CONFIG_REISERFS_FS_XATTR
 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
-int reiserfs_check_acl(struct inode *inode, int mask);
 ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
                          void *buffer, size_t size);
 int reiserfs_setxattr(struct dentry *dentry, const char *name,
@@ -123,7 +122,6 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 #define reiserfs_setxattr NULL
 #define reiserfs_listxattr NULL
 #define reiserfs_removexattr NULL
-#define reiserfs_check_acl NULL
 
 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 {
index fcedf5464eb79dba02ad485681fcc67530bdb720..3e519798b522366b0d003501d67388261ee101e2 100644 (file)
@@ -2715,10 +2715,6 @@ static const struct inode_operations shmem_inode_operations = {
        .listxattr      = shmem_listxattr,
        .removexattr    = shmem_removexattr,
 #endif
-#ifdef CONFIG_TMPFS_POSIX_ACL
-       .check_acl      = generic_check_acl,
-#endif
-
 };
 
 static const struct inode_operations shmem_dir_inode_operations = {
@@ -2741,7 +2737,6 @@ static const struct inode_operations shmem_dir_inode_operations = {
 #endif
 #ifdef CONFIG_TMPFS_POSIX_ACL
        .setattr        = shmem_setattr,
-       .check_acl      = generic_check_acl,
 #endif
 };
 
@@ -2754,7 +2749,6 @@ static const struct inode_operations shmem_special_inode_operations = {
 #endif
 #ifdef CONFIG_TMPFS_POSIX_ACL
        .setattr        = shmem_setattr,
-       .check_acl      = generic_check_acl,
 #endif
 };
 
index 35459340019e44399775c2f96aa9b5871f8d566c..de7900ef53da6257ab610629fd8ef65368526d62 100644 (file)
@@ -1984,6 +1984,7 @@ __initcall(init_sel_fs);
 void exit_sel_fs(void)
 {
        kobject_put(selinuxfs_kobj);
+       kern_unmount(selinuxfs_mount);
        unregister_filesystem(&sel_fs_type);
 }
 #endif
index 7077f601da5a66a279bed9be77159f2ec80dfc78..601f0ebb677ba7348abb41130a1fbd28952c919d 100644 (file)
@@ -531,7 +531,7 @@ int __init snd_info_init(void)
 {
        struct proc_dir_entry *p;
 
-       p = create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
+       p = proc_mkdir("asound", NULL);
        if (p == NULL)
                return -ENOMEM;
        snd_proc_root = p;