Release 4.18 fs/gfs2/acl.c
/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License version 2.
*/
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/xattr.h>
#include <linux/posix_acl.h>
#include <linux/posix_acl_xattr.h>
#include <linux/gfs2_ondisk.h>
#include "gfs2.h"
#include "incore.h"
#include "acl.h"
#include "xattr.h"
#include "glock.h"
#include "inode.h"
#include "meta_io.h"
#include "rgrp.h"
#include "trans.h"
#include "util.h"
static const char *gfs2_acl_name(int type)
{
switch (type) {
case ACL_TYPE_ACCESS:
return XATTR_POSIX_ACL_ACCESS;
case ACL_TYPE_DEFAULT:
return XATTR_POSIX_ACL_DEFAULT;
}
return NULL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven Whitehouse | 28 | 87.50% | 1 | 33.33% |
David Teigland | 2 | 6.25% | 1 | 33.33% |
Andreas Gruenbacher | 2 | 6.25% | 1 | 33.33% |
Total | 32 | 100.00% | 3 | 100.00% |
static struct posix_acl *__gfs2_get_acl(struct inode *inode, int type)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct posix_acl *acl;
const char *name;
char *data;
int len;
if (!ip->i_eattr)
return NULL;
name = gfs2_acl_name(type);
len = gfs2_xattr_acl_get(ip, name, &data);
if (len <= 0)
return ERR_PTR(len);
acl = posix_acl_from_xattr(&init_user_ns, data, len);
kfree(data);
return acl;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven Whitehouse | 50 | 48.08% | 4 | 57.14% |
David Teigland | 48 | 46.15% | 1 | 14.29% |
Al Viro | 3 | 2.88% | 1 | 14.29% |
Eric W. Biedermann | 3 | 2.88% | 1 | 14.29% |
Total | 104 | 100.00% | 7 | 100.00% |
struct posix_acl *gfs2_get_acl(struct inode *inode, int type)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder gh;
bool need_unlock = false;
struct posix_acl *acl;
if (!gfs2_glock_is_locked_by_me(ip->i_gl)) {
int ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
LM_FLAG_ANY, &gh);
if (ret)
return ERR_PTR(ret);
need_unlock = true;
}
acl = __gfs2_get_acl(inode, type);
if (need_unlock)
gfs2_glock_dq_uninit(&gh);
return acl;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 103 | 99.04% | 1 | 50.00% |
Steven Whitehouse | 1 | 0.96% | 1 | 50.00% |
Total | 104 | 100.00% | 2 | 100.00% |
int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int error;
int len;
char *data;
const char *name = gfs2_acl_name(type);
if (acl) {
len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0);
if (len == 0)
return 0;
data = kmalloc(len, GFP_NOFS);
if (data == NULL)
return -ENOMEM;
error = posix_acl_to_xattr(&init_user_ns, acl, data, len);
if (error < 0)
goto out;
} else {
data = NULL;
len = 0;
}
error = __gfs2_xattr_set(inode, name, data, len, 0, GFS2_EATYPE_SYS);
if (error)
goto out;
set_cached_acl(inode, type, acl);
out:
kfree(data);
return error;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven Whitehouse | 126 | 77.30% | 3 | 37.50% |
Christoph Hellwig | 26 | 15.95% | 2 | 25.00% |
Eric W. Biedermann | 6 | 3.68% | 1 | 12.50% |
David Teigland | 3 | 1.84% | 1 | 12.50% |
Al Viro | 2 | 1.23% | 1 | 12.50% |
Total | 163 | 100.00% | 8 | 100.00% |
int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder gh;
bool need_unlock = false;
int ret;
umode_t mode;
if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode)))
return -E2BIG;
ret = gfs2_rsqa_alloc(ip);
if (ret)
return ret;
if (!gfs2_glock_is_locked_by_me(ip->i_gl)) {
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
if (ret)
return ret;
need_unlock = true;
}
mode = inode->i_mode;
if (type == ACL_TYPE_ACCESS && acl) {
ret = posix_acl_update_mode(inode, &mode, &acl);
if (ret)
goto unlock;
}
ret = __gfs2_set_acl(inode, acl, type);
if (!ret && mode != inode->i_mode) {
inode->i_ctime = current_time(inode);
inode->i_mode = mode;
mark_inode_dirty(inode);
}
unlock:
if (need_unlock)
gfs2_glock_dq_uninit(&gh);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 111 | 52.61% | 1 | 25.00% |
Jan Kara | 59 | 27.96% | 1 | 25.00% |
Ernesto A. Fernández | 32 | 15.17% | 1 | 25.00% |
Andreas Gruenbacher | 9 | 4.27% | 1 | 25.00% |
Total | 211 | 100.00% | 4 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 222 | 33.04% | 1 | 5.00% |
Steven Whitehouse | 221 | 32.89% | 10 | 50.00% |
David Teigland | 91 | 13.54% | 1 | 5.00% |
Jan Kara | 59 | 8.78% | 1 | 5.00% |
Ernesto A. Fernández | 32 | 4.76% | 1 | 5.00% |
Christoph Hellwig | 26 | 3.87% | 2 | 10.00% |
Andreas Gruenbacher | 11 | 1.64% | 2 | 10.00% |
Eric W. Biedermann | 9 | 1.34% | 1 | 5.00% |
Fabio Massimo Di Nitto | 1 | 0.15% | 1 | 5.00% |
Total | 672 | 100.00% | 20 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.