Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs-2.6

* '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
  • Loading branch information
torvalds committed Jul 25, 2011
2 parents 4b478ce + 4e34e71 commit 0003230
Show file tree
Hide file tree
Showing 76 changed files with 477 additions and 795 deletions.
4 changes: 2 additions & 2 deletions Documentation/filesystems/Locking
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/vfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-bcmring/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion drivers/base/devtmpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
26 changes: 13 additions & 13 deletions drivers/crypto/caam/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,68 +166,68 @@ 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);

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);

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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ static int __init init_mtdchar(void)
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");
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/platform/x86/asus-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8187se/r8180_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/rtl8192e/r8192E_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/rtl8192u/r8192U_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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);
Expand Down
68 changes: 23 additions & 45 deletions fs/9p/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,22 @@ 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)) {
/*
* 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)
Expand Down Expand Up @@ -165,32 +154,32 @@ static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
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;
}

Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions fs/9p/acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

#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;
Expand All @@ -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;
}
Expand Down
Loading

0 comments on commit 0003230

Please sign in to comment.