All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: Nathan Scott <nathans@sgi.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Return more useful error number when acls are too large
Date: Tue, 27 Apr 2004 20:07:36 +0200	[thread overview]
Message-ID: <1083089256.19655.284.camel@winden.suse.de> (raw)
In-Reply-To: <20040427112440.B604510@wobbly.melbourne.sgi.com>

[-- Attachment #1: Type: text/plain, Size: 1970 bytes --]

On Tue, 2004-04-27 at 03:24, Nathan Scott wrote:
> hi Andreas,
> 
> On Mon, Apr 26, 2004 at 12:27:58PM +0200, Andreas Gruenbacher wrote:
> > Hello,
> > 
> > could you please add this to mainline? Getting EINVAL when an acl
> > becomes too large is quite confusing.
> > 
> >   	if (acl) {
> >  		if (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?

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.

> 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.


Index: linux-2.6.6-rc2/fs/xfs/xfs_acl.c
===================================================================
--- linux-2.6.6-rc2.orig/fs/xfs/xfs_acl.c
+++ linux-2.6.6-rc2/fs/xfs/xfs_acl.c
@@ -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,
-- 
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX AG

[-- Attachment #2: acl-too-large-2 --]
[-- Type: text/x-patch, Size: 872 bytes --]

Index: linux-2.6.6-rc2/fs/xfs/xfs_acl.c
===================================================================
--- linux-2.6.6-rc2.orig/fs/xfs/xfs_acl.c
+++ linux-2.6.6-rc2/fs/xfs/xfs_acl.c
@@ -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];

  reply	other threads:[~2004-04-27 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-26 10:27 [PATCH] Return more useful error number when acls are too large Andreas Gruenbacher
2004-04-27  1:24 ` Nathan Scott
2004-04-27 18:07   ` Andreas Gruenbacher [this message]
2004-04-27 18:32 ` J. Bruce Fields
2004-04-27 19:10   ` Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1083089256.19655.284.camel@winden.suse.de \
    --to=agruen@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathans@sgi.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.