/* * 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; } 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; } 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; } 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 && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode))) return -E2BIG; if (type == ACL_TYPE_ACCESS) { umode_t mode = inode->i_mode; error = posix_acl_update_mode(inode, &inode->i_mode, &acl); if (error) return error; if (mode != inode->i_mode) mark_inode_dirty(inode); } 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; } 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; 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; } ret = __gfs2_set_acl(inode, acl, type); if (need_unlock) gfs2_glock_dq_uninit(&gh); return ret; } 0d285904de9be7ab654a4b94fc'>sock.h</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='9208b75e048dda0d285904de9be7ab654a4b94fc'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'> <tr><th>author</th><td>James Bottomley <James.Bottomley@HansenPartnership.com></td><td class='right'>2017-01-17 17:32:54 -0500</td></tr> <tr><th>committer</th><td>James Bottomley <James.Bottomley@HansenPartnership.com></td><td class='right'>2017-01-17 17:32:54 -0500</td></tr> <tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/trace/events/sock.h?id=9208b75e048dda0d285904de9be7ab654a4b94fc'>9208b75e048dda0d285904de9be7ab654a4b94fc</a> (<a href='/cgit.cgi/linux/net-next.git/patch/include/trace/events/sock.h?id=9208b75e048dda0d285904de9be7ab654a4b94fc'>patch</a>)</td></tr> <tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=9208b75e048dda0d285904de9be7ab654a4b94fc'>b3af58ccd11b9ea186d1388be263b8ae0cb829b3</a> /<a href='/cgit.cgi/linux/net-next.git/tree/include/trace/events/sock.h?id=9208b75e048dda0d285904de9be7ab654a4b94fc'>include/trace/events/sock.h</a></td></tr> <tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/trace/events/sock.h?id=2f5a31456ee80b37ef1170319fa134af0a1dfcc4'>2f5a31456ee80b37ef1170319fa134af0a1dfcc4</a> (<a href='/cgit.cgi/linux/net-next.git/diff/include/trace/events/sock.h?id=9208b75e048dda0d285904de9be7ab654a4b94fc&id2=2f5a31456ee80b37ef1170319fa134af0a1dfcc4'>diff</a>)</td></tr><tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/trace/events/sock.h?id=ffb58456589443ca572221fabbdef3db8483a779'>ffb58456589443ca572221fabbdef3db8483a779</a> (<a href='/cgit.cgi/linux/net-next.git/diff/include/trace/events/sock.h?id=9208b75e048dda0d285904de9be7ab654a4b94fc&id2=ffb58456589443ca572221fabbdef3db8483a779'>diff</a>)</td></tr></table> <div class='commit-subject'>Merge remote-tracking branch 'mkp-scsi/fixes' into fixes</div><div class='commit-msg'></div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?id=9208b75e048dda0d285904de9be7ab654a4b94fc'>Diffstat</a> (limited to 'include/trace/events/sock.h')</div><table summary='diffstat' class='diffstat'>