mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Skip permission checks for extended attributes
zfs_zaccess_trivial() calls the generic_permission() to read xattr attributes. This causes deadlock if called from zpl_xattr_set_dir() context as xattr and the dent locks are already held in this scenario. This commit skips the permissions checks for extended attributes since the Linux VFS stack already checks it before passing us the control. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Youzhong Yang <yyang@mathworks.com> Signed-off-by: Ameer Hamza <ahamza@ixsystems.com> Closes #14220
This commit is contained in:
@@ -1112,10 +1112,6 @@ zfs_make_xattrdir(znode_t *zp, vattr_t *vap, znode_t **xzpp, cred_t *cr)
|
||||
|
||||
*xzpp = NULL;
|
||||
|
||||
if ((error = zfs_zaccess(zp, ACE_WRITE_NAMED_ATTRS, 0, B_FALSE, cr,
|
||||
kcred->user_ns)))
|
||||
return (error);
|
||||
|
||||
if ((error = zfs_acl_ids_create(zp, IS_XATTR, vap, cr, NULL,
|
||||
&acl_ids, kcred->user_ns)) != 0)
|
||||
return (error);
|
||||
|
||||
@@ -555,6 +555,7 @@ zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
|
||||
boolean_t fuid_dirtied;
|
||||
boolean_t have_acl = B_FALSE;
|
||||
boolean_t waited = B_FALSE;
|
||||
boolean_t skip_acl = (flag & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
|
||||
|
||||
/*
|
||||
* If we have an ephemeral id, ACL, or XVATTR then
|
||||
@@ -627,7 +628,7 @@ top:
|
||||
* Create a new file object and update the directory
|
||||
* to reference it.
|
||||
*/
|
||||
if ((error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr,
|
||||
if ((error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, skip_acl, cr,
|
||||
mnt_ns))) {
|
||||
if (have_acl)
|
||||
zfs_acl_ids_free(&acl_ids);
|
||||
|
||||
@@ -499,7 +499,7 @@ zpl_xattr_set_dir(struct inode *ip, const char *name, const void *value,
|
||||
vap->va_gid = crgetgid(cr);
|
||||
|
||||
error = -zfs_create(dxzp, (char *)name, vap, 0, 0644, &xzp,
|
||||
cr, 0, NULL, kcred->user_ns);
|
||||
cr, ATTR_NOACLCHECK, NULL, kcred->user_ns);
|
||||
if (error)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user