xref: /openbmc/linux/fs/9p/acl.c (revision 549c7297717c32ee53f156cd949e055e601f67bb)
185ff872dSAneesh Kumar K.V /*
285ff872dSAneesh Kumar K.V  * Copyright IBM Corporation, 2010
385ff872dSAneesh Kumar K.V  * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
485ff872dSAneesh Kumar K.V  *
585ff872dSAneesh Kumar K.V  * This program is free software; you can redistribute it and/or modify it
685ff872dSAneesh Kumar K.V  * under the terms of version 2.1 of the GNU Lesser General Public License
785ff872dSAneesh Kumar K.V  * as published by the Free Software Foundation.
885ff872dSAneesh Kumar K.V  *
985ff872dSAneesh Kumar K.V  * This program is distributed in the hope that it would be useful, but
1085ff872dSAneesh Kumar K.V  * WITHOUT ANY WARRANTY; without even the implied warranty of
1185ff872dSAneesh Kumar K.V  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1285ff872dSAneesh Kumar K.V  *
1385ff872dSAneesh Kumar K.V  */
1485ff872dSAneesh Kumar K.V 
1585ff872dSAneesh Kumar K.V #include <linux/module.h>
1685ff872dSAneesh Kumar K.V #include <linux/fs.h>
1785ff872dSAneesh Kumar K.V #include <net/9p/9p.h>
1885ff872dSAneesh Kumar K.V #include <net/9p/client.h>
1985ff872dSAneesh Kumar K.V #include <linux/slab.h>
2022d8dcdfSAneesh Kumar K.V #include <linux/sched.h>
2185ff872dSAneesh Kumar K.V #include <linux/posix_acl_xattr.h>
2285ff872dSAneesh Kumar K.V #include "xattr.h"
2385ff872dSAneesh Kumar K.V #include "acl.h"
2476381a42SAneesh Kumar K.V #include "v9fs.h"
255ffc0cb3SAneesh Kumar K.V #include "v9fs_vfs.h"
260f235caeSAl Viro #include "fid.h"
2785ff872dSAneesh Kumar K.V 
2885ff872dSAneesh Kumar K.V static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
2985ff872dSAneesh Kumar K.V {
3085ff872dSAneesh Kumar K.V 	ssize_t size;
3185ff872dSAneesh Kumar K.V 	void *value = NULL;
32009ca389SJoe Perches 	struct posix_acl *acl = NULL;
3385ff872dSAneesh Kumar K.V 
3485ff872dSAneesh Kumar K.V 	size = v9fs_fid_xattr_get(fid, name, NULL, 0);
3585ff872dSAneesh Kumar K.V 	if (size > 0) {
3685ff872dSAneesh Kumar K.V 		value = kzalloc(size, GFP_NOFS);
3785ff872dSAneesh Kumar K.V 		if (!value)
3885ff872dSAneesh Kumar K.V 			return ERR_PTR(-ENOMEM);
3985ff872dSAneesh Kumar K.V 		size = v9fs_fid_xattr_get(fid, name, value, size);
4085ff872dSAneesh Kumar K.V 		if (size > 0) {
415f3a4a28SEric W. Biederman 			acl = posix_acl_from_xattr(&init_user_ns, value, size);
4285ff872dSAneesh Kumar K.V 			if (IS_ERR(acl))
4385ff872dSAneesh Kumar K.V 				goto err_out;
4485ff872dSAneesh Kumar K.V 		}
4585ff872dSAneesh Kumar K.V 	} else if (size == -ENODATA || size == 0 ||
4685ff872dSAneesh Kumar K.V 		   size == -ENOSYS || size == -EOPNOTSUPP) {
4785ff872dSAneesh Kumar K.V 		acl = NULL;
4885ff872dSAneesh Kumar K.V 	} else
4985ff872dSAneesh Kumar K.V 		acl = ERR_PTR(-EIO);
5085ff872dSAneesh Kumar K.V 
5185ff872dSAneesh Kumar K.V err_out:
5285ff872dSAneesh Kumar K.V 	kfree(value);
5385ff872dSAneesh Kumar K.V 	return acl;
5485ff872dSAneesh Kumar K.V }
5585ff872dSAneesh Kumar K.V 
5685ff872dSAneesh Kumar K.V int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
5785ff872dSAneesh Kumar K.V {
5885ff872dSAneesh Kumar K.V 	int retval = 0;
5985ff872dSAneesh Kumar K.V 	struct posix_acl *pacl, *dacl;
6076381a42SAneesh Kumar K.V 	struct v9fs_session_info *v9ses;
6185ff872dSAneesh Kumar K.V 
6276381a42SAneesh Kumar K.V 	v9ses = v9fs_inode2v9ses(inode);
63e782ef71SVenkateswararao Jujjuri (JV) 	if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
64e782ef71SVenkateswararao Jujjuri (JV) 			((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {
6576381a42SAneesh Kumar K.V 		set_cached_acl(inode, ACL_TYPE_DEFAULT, NULL);
6676381a42SAneesh Kumar K.V 		set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
6776381a42SAneesh Kumar K.V 		return 0;
6876381a42SAneesh Kumar K.V 	}
6985ff872dSAneesh Kumar K.V 	/* get the default/access acl values and cache them */
7097d79299SAndreas Gruenbacher 	dacl = __v9fs_get_acl(fid, XATTR_NAME_POSIX_ACL_DEFAULT);
7197d79299SAndreas Gruenbacher 	pacl = __v9fs_get_acl(fid, XATTR_NAME_POSIX_ACL_ACCESS);
7285ff872dSAneesh Kumar K.V 
7385ff872dSAneesh Kumar K.V 	if (!IS_ERR(dacl) && !IS_ERR(pacl)) {
7485ff872dSAneesh Kumar K.V 		set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
7585ff872dSAneesh Kumar K.V 		set_cached_acl(inode, ACL_TYPE_ACCESS, pacl);
7685ff872dSAneesh Kumar K.V 	} else
7785ff872dSAneesh Kumar K.V 		retval = -EIO;
7885ff872dSAneesh Kumar K.V 
79c61fa0d6SVenkateswararao Jujjuri (JV) 	if (!IS_ERR(dacl))
80c61fa0d6SVenkateswararao Jujjuri (JV) 		posix_acl_release(dacl);
81c61fa0d6SVenkateswararao Jujjuri (JV) 
82c61fa0d6SVenkateswararao Jujjuri (JV) 	if (!IS_ERR(pacl))
83c61fa0d6SVenkateswararao Jujjuri (JV) 		posix_acl_release(pacl);
84c61fa0d6SVenkateswararao Jujjuri (JV) 
8585ff872dSAneesh Kumar K.V 	return retval;
8685ff872dSAneesh Kumar K.V }
8785ff872dSAneesh Kumar K.V 
8885ff872dSAneesh Kumar K.V static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
8985ff872dSAneesh Kumar K.V {
9085ff872dSAneesh Kumar K.V 	struct posix_acl *acl;
9185ff872dSAneesh Kumar K.V 	/*
9285ff872dSAneesh Kumar K.V 	 * 9p Always cache the acl value when
9385ff872dSAneesh Kumar K.V 	 * instantiating the inode (v9fs_inode_from_fid)
9485ff872dSAneesh Kumar K.V 	 */
9585ff872dSAneesh Kumar K.V 	acl = get_cached_acl(inode, type);
96b8a7a3a6SAndreas Gruenbacher 	BUG_ON(is_uncached_acl(acl));
9785ff872dSAneesh Kumar K.V 	return acl;
9885ff872dSAneesh Kumar K.V }
9985ff872dSAneesh Kumar K.V 
1004e34e719SChristoph Hellwig struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
10185ff872dSAneesh Kumar K.V {
10276381a42SAneesh Kumar K.V 	struct v9fs_session_info *v9ses;
10376381a42SAneesh Kumar K.V 
10476381a42SAneesh Kumar K.V 	v9ses = v9fs_inode2v9ses(inode);
105e782ef71SVenkateswararao Jujjuri (JV) 	if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
106e782ef71SVenkateswararao Jujjuri (JV) 			((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {
10776381a42SAneesh Kumar K.V 		/*
108e782ef71SVenkateswararao Jujjuri (JV) 		 * On access = client  and acl = on mode get the acl
10976381a42SAneesh Kumar K.V 		 * values from the server
11076381a42SAneesh Kumar K.V 		 */
1114e34e719SChristoph Hellwig 		return NULL;
11276381a42SAneesh Kumar K.V 	}
1134e34e719SChristoph Hellwig 	return v9fs_get_cached_acl(inode, type);
11485ff872dSAneesh Kumar K.V 
11585ff872dSAneesh Kumar K.V }
1167a4566b0SAneesh Kumar K.V 
1170f235caeSAl Viro static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
1186e8dc555SAneesh Kumar K.V {
1196e8dc555SAneesh Kumar K.V 	int retval;
1206e8dc555SAneesh Kumar K.V 	char *name;
1216e8dc555SAneesh Kumar K.V 	size_t size;
1226e8dc555SAneesh Kumar K.V 	void *buffer;
123d344b0fbSVenkateswararao Jujjuri (JV) 	if (!acl)
124d344b0fbSVenkateswararao Jujjuri (JV) 		return 0;
125d344b0fbSVenkateswararao Jujjuri (JV) 
1266e8dc555SAneesh Kumar K.V 	/* Set a setxattr request to server */
1276e8dc555SAneesh Kumar K.V 	size = posix_acl_xattr_size(acl->a_count);
1286e8dc555SAneesh Kumar K.V 	buffer = kmalloc(size, GFP_KERNEL);
1296e8dc555SAneesh Kumar K.V 	if (!buffer)
1306e8dc555SAneesh Kumar K.V 		return -ENOMEM;
1315f3a4a28SEric W. Biederman 	retval = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
1326e8dc555SAneesh Kumar K.V 	if (retval < 0)
1336e8dc555SAneesh Kumar K.V 		goto err_free_out;
1346e8dc555SAneesh Kumar K.V 	switch (type) {
1356e8dc555SAneesh Kumar K.V 	case ACL_TYPE_ACCESS:
13697d79299SAndreas Gruenbacher 		name = XATTR_NAME_POSIX_ACL_ACCESS;
1376e8dc555SAneesh Kumar K.V 		break;
1386e8dc555SAneesh Kumar K.V 	case ACL_TYPE_DEFAULT:
13997d79299SAndreas Gruenbacher 		name = XATTR_NAME_POSIX_ACL_DEFAULT;
1406e8dc555SAneesh Kumar K.V 		break;
1416e8dc555SAneesh Kumar K.V 	default:
1426e8dc555SAneesh Kumar K.V 		BUG();
1436e8dc555SAneesh Kumar K.V 	}
1440f235caeSAl Viro 	retval = v9fs_fid_xattr_set(fid, name, buffer, size, 0);
1456e8dc555SAneesh Kumar K.V err_free_out:
1466e8dc555SAneesh Kumar K.V 	kfree(buffer);
1476e8dc555SAneesh Kumar K.V 	return retval;
1486e8dc555SAneesh Kumar K.V }
1496e8dc555SAneesh Kumar K.V 
150be308f07SAl Viro int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
1516e8dc555SAneesh Kumar K.V {
1526e8dc555SAneesh Kumar K.V 	int retval = 0;
153bc26ab5fSAl Viro 	struct posix_acl *acl;
1546e8dc555SAneesh Kumar K.V 
1556e8dc555SAneesh Kumar K.V 	if (S_ISLNK(inode->i_mode))
1566e8dc555SAneesh Kumar K.V 		return -EOPNOTSUPP;
1576e8dc555SAneesh Kumar K.V 	acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
1586e8dc555SAneesh Kumar K.V 	if (acl) {
1595bf3258fSChristoph Hellwig 		retval = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
160bc26ab5fSAl Viro 		if (retval)
161bc26ab5fSAl Viro 			return retval;
1627f165aaaSAl Viro 		set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
1630f235caeSAl Viro 		retval = v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
1646e8dc555SAneesh Kumar K.V 		posix_acl_release(acl);
1656e8dc555SAneesh Kumar K.V 	}
1666e8dc555SAneesh Kumar K.V 	return retval;
1676e8dc555SAneesh Kumar K.V }
1686e8dc555SAneesh Kumar K.V 
1693592ac44SAl Viro int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
1705fa6300aSAl Viro 			struct posix_acl *dacl, struct posix_acl *acl)
171ad77dbceSAneesh Kumar K.V {
1723592ac44SAl Viro 	set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
1733592ac44SAl Viro 	set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
1745fa6300aSAl Viro 	v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
1755fa6300aSAl Viro 	v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
176ad77dbceSAneesh Kumar K.V 	return 0;
177ad77dbceSAneesh Kumar K.V }
178ad77dbceSAneesh Kumar K.V 
1795fa6300aSAl Viro void v9fs_put_acl(struct posix_acl *dacl,
1805fa6300aSAl Viro 		  struct posix_acl *acl)
1815fa6300aSAl Viro {
1825fa6300aSAl Viro 	posix_acl_release(dacl);
1835fa6300aSAl Viro 	posix_acl_release(acl);
1845fa6300aSAl Viro }
1855fa6300aSAl Viro 
186d3fb6120SAl Viro int v9fs_acl_mode(struct inode *dir, umode_t *modep,
187ad77dbceSAneesh Kumar K.V 		  struct posix_acl **dpacl, struct posix_acl **pacl)
188ad77dbceSAneesh Kumar K.V {
189ad77dbceSAneesh Kumar K.V 	int retval = 0;
190d3fb6120SAl Viro 	umode_t mode = *modep;
191ad77dbceSAneesh Kumar K.V 	struct posix_acl *acl = NULL;
192ad77dbceSAneesh Kumar K.V 
193ad77dbceSAneesh Kumar K.V 	if (!S_ISLNK(mode)) {
194ad77dbceSAneesh Kumar K.V 		acl = v9fs_get_cached_acl(dir, ACL_TYPE_DEFAULT);
195ad77dbceSAneesh Kumar K.V 		if (IS_ERR(acl))
196ad77dbceSAneesh Kumar K.V 			return PTR_ERR(acl);
197ad77dbceSAneesh Kumar K.V 		if (!acl)
198ad77dbceSAneesh Kumar K.V 			mode &= ~current_umask();
199ad77dbceSAneesh Kumar K.V 	}
200ad77dbceSAneesh Kumar K.V 	if (acl) {
201ad77dbceSAneesh Kumar K.V 		if (S_ISDIR(mode))
2021ec95bf3SAl Viro 			*dpacl = posix_acl_dup(acl);
20337bc1539SChristoph Hellwig 		retval = __posix_acl_create(&acl, GFP_NOFS, &mode);
204826cae2fSAl Viro 		if (retval < 0)
205826cae2fSAl Viro 			return retval;
206ad77dbceSAneesh Kumar K.V 		if (retval > 0)
207826cae2fSAl Viro 			*pacl = acl;
2081ec95bf3SAl Viro 		else
209826cae2fSAl Viro 			posix_acl_release(acl);
210ad77dbceSAneesh Kumar K.V 	}
211ad77dbceSAneesh Kumar K.V 	*modep  = mode;
212ad77dbceSAneesh Kumar K.V 	return 0;
213ad77dbceSAneesh Kumar K.V }
214ad77dbceSAneesh Kumar K.V 
215d9a82a04SAndreas Gruenbacher static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
216b296821aSAl Viro 			      struct dentry *dentry, struct inode *inode,
217b296821aSAl Viro 			      const char *name, void *buffer, size_t size)
2187a4566b0SAneesh Kumar K.V {
21976381a42SAneesh Kumar K.V 	struct v9fs_session_info *v9ses;
2207a4566b0SAneesh Kumar K.V 	struct posix_acl *acl;
2217a4566b0SAneesh Kumar K.V 	int error;
2227a4566b0SAneesh Kumar K.V 
22342869c8aSAneesh Kumar K.V 	v9ses = v9fs_dentry2v9ses(dentry);
22476381a42SAneesh Kumar K.V 	/*
22576381a42SAneesh Kumar K.V 	 * We allow set/get/list of acl when access=client is not specified
22676381a42SAneesh Kumar K.V 	 */
22776381a42SAneesh Kumar K.V 	if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
22898e9cb57SAndreas Gruenbacher 		return v9fs_xattr_get(dentry, handler->name, buffer, size);
22976381a42SAneesh Kumar K.V 
230b296821aSAl Viro 	acl = v9fs_get_cached_acl(inode, handler->flags);
2317a4566b0SAneesh Kumar K.V 	if (IS_ERR(acl))
2327a4566b0SAneesh Kumar K.V 		return PTR_ERR(acl);
2337a4566b0SAneesh Kumar K.V 	if (acl == NULL)
2347a4566b0SAneesh Kumar K.V 		return -ENODATA;
2355f3a4a28SEric W. Biederman 	error = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
2367a4566b0SAneesh Kumar K.V 	posix_acl_release(acl);
2377a4566b0SAneesh Kumar K.V 
2387a4566b0SAneesh Kumar K.V 	return error;
2397a4566b0SAneesh Kumar K.V }
2407a4566b0SAneesh Kumar K.V 
241d9a82a04SAndreas Gruenbacher static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
242e65ce2a5SChristian Brauner 			      struct user_namespace *mnt_userns,
24359301226SAl Viro 			      struct dentry *dentry, struct inode *inode,
24459301226SAl Viro 			      const char *name, const void *value,
24559301226SAl Viro 			      size_t size, int flags)
2467a4566b0SAneesh Kumar K.V {
24722d8dcdfSAneesh Kumar K.V 	int retval;
24822d8dcdfSAneesh Kumar K.V 	struct posix_acl *acl;
24976381a42SAneesh Kumar K.V 	struct v9fs_session_info *v9ses;
25022d8dcdfSAneesh Kumar K.V 
25142869c8aSAneesh Kumar K.V 	v9ses = v9fs_dentry2v9ses(dentry);
25276381a42SAneesh Kumar K.V 	/*
25376381a42SAneesh Kumar K.V 	 * set the attribute on the remote. Without even looking at the
25476381a42SAneesh Kumar K.V 	 * xattr value. We leave it to the server to validate
25576381a42SAneesh Kumar K.V 	 */
25676381a42SAneesh Kumar K.V 	if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
25798e9cb57SAndreas Gruenbacher 		return v9fs_xattr_set(dentry, handler->name, value, size,
258e409de99SAndreas Gruenbacher 				      flags);
25976381a42SAneesh Kumar K.V 
26022d8dcdfSAneesh Kumar K.V 	if (S_ISLNK(inode->i_mode))
26122d8dcdfSAneesh Kumar K.V 		return -EOPNOTSUPP;
26221cb47beSChristian Brauner 	if (!inode_owner_or_capable(&init_user_ns, inode))
26322d8dcdfSAneesh Kumar K.V 		return -EPERM;
26422d8dcdfSAneesh Kumar K.V 	if (value) {
26522d8dcdfSAneesh Kumar K.V 		/* update the cached acl value */
2665f3a4a28SEric W. Biederman 		acl = posix_acl_from_xattr(&init_user_ns, value, size);
26722d8dcdfSAneesh Kumar K.V 		if (IS_ERR(acl))
26822d8dcdfSAneesh Kumar K.V 			return PTR_ERR(acl);
26922d8dcdfSAneesh Kumar K.V 		else if (acl) {
2700d4d717fSEric W. Biederman 			retval = posix_acl_valid(inode->i_sb->s_user_ns, acl);
27122d8dcdfSAneesh Kumar K.V 			if (retval)
27222d8dcdfSAneesh Kumar K.V 				goto err_out;
27322d8dcdfSAneesh Kumar K.V 		}
27422d8dcdfSAneesh Kumar K.V 	} else
27522d8dcdfSAneesh Kumar K.V 		acl = NULL;
27622d8dcdfSAneesh Kumar K.V 
277d9a82a04SAndreas Gruenbacher 	switch (handler->flags) {
27822d8dcdfSAneesh Kumar K.V 	case ACL_TYPE_ACCESS:
27922d8dcdfSAneesh Kumar K.V 		if (acl) {
280e02a53d9SDominique Martinet 			struct iattr iattr = { 0 };
281b5c66babSCong Wang 			struct posix_acl *old_acl = acl;
28207393101SJan Kara 
283*549c7297SChristian Brauner 			retval = posix_acl_update_mode(&init_user_ns, inode,
284e65ce2a5SChristian Brauner 						       &iattr.ia_mode, &acl);
28507393101SJan Kara 			if (retval)
28607393101SJan Kara 				goto err_out;
28707393101SJan Kara 			if (!acl) {
28822d8dcdfSAneesh Kumar K.V 				/*
28922d8dcdfSAneesh Kumar K.V 				 * ACL can be represented
29022d8dcdfSAneesh Kumar K.V 				 * by the mode bits. So don't
29122d8dcdfSAneesh Kumar K.V 				 * update ACL.
29222d8dcdfSAneesh Kumar K.V 				 */
293b5c66babSCong Wang 				posix_acl_release(old_acl);
29422d8dcdfSAneesh Kumar K.V 				value = NULL;
29522d8dcdfSAneesh Kumar K.V 				size = 0;
29622d8dcdfSAneesh Kumar K.V 			}
29722d8dcdfSAneesh Kumar K.V 			iattr.ia_valid = ATTR_MODE;
29822d8dcdfSAneesh Kumar K.V 			/* FIXME should we update ctime ?
29922d8dcdfSAneesh Kumar K.V 			 * What is the following setxattr update the
30022d8dcdfSAneesh Kumar K.V 			 * mode ?
30122d8dcdfSAneesh Kumar K.V 			 */
302*549c7297SChristian Brauner 			v9fs_vfs_setattr_dotl(&init_user_ns, dentry, &iattr);
30322d8dcdfSAneesh Kumar K.V 		}
30422d8dcdfSAneesh Kumar K.V 		break;
30522d8dcdfSAneesh Kumar K.V 	case ACL_TYPE_DEFAULT:
30622d8dcdfSAneesh Kumar K.V 		if (!S_ISDIR(inode->i_mode)) {
3076f81c115SAneesh Kumar K.V 			retval = acl ? -EINVAL : 0;
30822d8dcdfSAneesh Kumar K.V 			goto err_out;
30922d8dcdfSAneesh Kumar K.V 		}
31022d8dcdfSAneesh Kumar K.V 		break;
31122d8dcdfSAneesh Kumar K.V 	default:
31222d8dcdfSAneesh Kumar K.V 		BUG();
31322d8dcdfSAneesh Kumar K.V 	}
31498e9cb57SAndreas Gruenbacher 	retval = v9fs_xattr_set(dentry, handler->name, value, size, flags);
31522d8dcdfSAneesh Kumar K.V 	if (!retval)
316d9a82a04SAndreas Gruenbacher 		set_cached_acl(inode, handler->flags, acl);
31722d8dcdfSAneesh Kumar K.V err_out:
31822d8dcdfSAneesh Kumar K.V 	posix_acl_release(acl);
31922d8dcdfSAneesh Kumar K.V 	return retval;
3207a4566b0SAneesh Kumar K.V }
3217a4566b0SAneesh Kumar K.V 
3227a4566b0SAneesh Kumar K.V const struct xattr_handler v9fs_xattr_acl_access_handler = {
32398e9cb57SAndreas Gruenbacher 	.name	= XATTR_NAME_POSIX_ACL_ACCESS,
3247a4566b0SAneesh Kumar K.V 	.flags	= ACL_TYPE_ACCESS,
3257a4566b0SAneesh Kumar K.V 	.get	= v9fs_xattr_get_acl,
3267a4566b0SAneesh Kumar K.V 	.set	= v9fs_xattr_set_acl,
3277a4566b0SAneesh Kumar K.V };
3287a4566b0SAneesh Kumar K.V 
3297a4566b0SAneesh Kumar K.V const struct xattr_handler v9fs_xattr_acl_default_handler = {
33098e9cb57SAndreas Gruenbacher 	.name	= XATTR_NAME_POSIX_ACL_DEFAULT,
3317a4566b0SAneesh Kumar K.V 	.flags	= ACL_TYPE_DEFAULT,
3327a4566b0SAneesh Kumar K.V 	.get	= v9fs_xattr_get_acl,
3337a4566b0SAneesh Kumar K.V 	.set	= v9fs_xattr_set_acl,
3347a4566b0SAneesh Kumar K.V };
335