Return more useful error number when acls are too large
Subsystems (2)
PATCH 1/1 Return more useful error number when acls are too large
Hello,
could you please add this to mainline? Getting EINVAL when an acl becomes too large is quite confusing.
fs/ext2/acl.c +1 -1
@@ -256,7 +256,7 @@ }if (acl) {if (acl->a_count >EXT2_ACL_MAX_ENTRIES ) -return -EINVAL ; +return -ENOSPC ; value =ext2_acl_to_disk (acl, &size);if (IS_ERR (value))return (int )PTR_ERR (value);
fs/ext3/acl.c +1 -1
@@ -260,7 +260,7 @@ }if (acl) {if (acl->a_count >EXT3_ACL_MAX_ENTRIES ) -return -EINVAL ; +return -ENOSPC ; value =ext3_acl_to_disk (acl, &size);if (IS_ERR (value))return (int )PTR_ERR (value);
Thanks,
Signature · 2 lines
Andreas Gruenbacher <[email protected]> SUSE Labs, SUSE LINUX AG
hi Andreas,
fs/ext2/acl.c line 259
Quoted 9 lines · Andreas Gruenbacher
Hello,
could you please add this to mainline? Getting EINVAL when an acl becomes too large is quite confusing.
if (acl) {fs/ext2/acl.c +1
-1if (acl->a_count >EXT2_ACL_MAX_ENTRIES ) -return -EINVAL ; +return -ENOSPC ;
That seems an odd error code to change it to, since its not related to the device running out of free space right? Maybe use -E2BIG instead?
XFS has a similar check (different limit as you know), so is also affected by this; could you update XFS at the same time with whatever value gets chosen, if its not EINVAL? Or just let me know what gets chosen & I'll fix it up later.
thanks.
Signature · 1 line
Nathan
Quoted 8 lines · Nathan Scott
hi Andreas,
Quoted 5 lines · Andreas Gruenbacher
Hello,
could you please add this to mainline? Getting EINVAL when an acl becomes too large is quite confusing.
Quoted 8 lines
Review
Quoted 4 lines
if (acl) {(quoted diff) +1
-1if (acl->a_count > EXT2_ACL_MAX_ENTRIES) - return -EINVAL; + return -ENOSPC;That seems an odd error code to change it to, since its not related to the device running out of free space right? Maybe use
-E2BIGinstead?
I don't see a problem with giving ENOSPC this particular meaning here. The error number used must be among those defined for NFSv3, so E2BIG won't do.
Quoted 4 lines
XFS has a similar check (different limit as you know), so is also affected by this; could you update XFS at the same time with whatever value gets chosen, if its not EINVAL? Or just let me know what gets chosen & I'll fix it up later.
I think this patch is correct for xfs. Nathan, would you mind to double-check? Thanks.
fs/xfs/xfs_acl.c +4 -8
@@ -148,10 +148,7 @@ posix_acl_xattr_to_xfs(return EINVAL ; } } -if (xfs_acl_invalid (dest)) -return EINVAL ; - -return 0 ; +return xfs_acl_invalid (dest); }/*
@@ -249,10 +246,9 @@ xfs_acl_vget(if (!size) { error = -posix_acl_xattr_size (XFS_ACL_MAX_ENTRIES ); }else { -if (xfs_acl_invalid (xfs_acl)) { - error =EINVAL ; + error =xfs_acl_invalid (xfs_acl); +if (error) goto out; - }if (kind == _ACL_TYPE_ACCESS) {vattr_t va;
@@ -590,7 +586,7 @@ xfs_acl_invalid( goto acl_invalid;if (aclp->acl_cnt >XFS_ACL_MAX_ENTRIES ) - goto acl_invalid; +return ENOSPC ;for (i =0 ; i < aclp->acl_cnt; i++) { entry = &aclp->acl_entry[i];
Thanks,
Signature · 2 lines
Andreas Gruenbacher <[email protected]> SUSE Labs, SUSE LINUX AG
fs/xfs/xfs_acl.c +4 -8
@@ -148,10 +148,7 @@ posix_acl_xattr_to_xfs(return EINVAL ; } } -if (xfs_acl_invalid (dest)) -return EINVAL ; - -return 0 ; +return xfs_acl_invalid (dest); }/*
@@ -249,10 +246,9 @@ xfs_acl_vget(if (!size) { error = -posix_acl_xattr_size (XFS_ACL_MAX_ENTRIES ); }else { -if (xfs_acl_invalid (xfs_acl)) { - error =EINVAL ; + error =xfs_acl_invalid (xfs_acl); +if (error) goto out; - }if (kind == _ACL_TYPE_ACCESS) {vattr_t va;
@@ -590,7 +586,7 @@ xfs_acl_invalid( goto acl_invalid;if (aclp->acl_cnt >XFS_ACL_MAX_ENTRIES ) - goto acl_invalid; +return ENOSPC ;for (i =0 ; i < aclp->acl_cnt; i++) { entry = &aclp->acl_entry[i];
Quoted 2 lines · Andreas Gruenbacher
could you please add this to mainline? Getting EINVAL when an acl becomes too large is quite confusing.
On my system, at least, "man acl_set_file" does explicitly say that EINVAL is returned in this case. Whether that should be considered a bug in the documentation or the code I don't know....
--Bruce Fields
Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Andreas Gruenbacher
could you please add this to mainline? Getting EINVAL when an acl becomes too large is quite confusing.
On my system, at least, "man
acl_set_file" does explicitly say that EINVAL is returned in this case. Whether that should be considered a bug in the documentation or the code I don't know....
Indeed ... looking at POSIX 1003.1e draft 17 I now see that this function is indeed supposed to return EINVAL in this case. I was assuming that this case was undefined, but that was wrong. So let's leave the code as is -- sorry.
Cheers,
Signature · 2 lines
Andreas Gruenbacher <[email protected]> SUSE Labs, SUSE LINUX AG