[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200608020522.GN23230@ZenIV.linux.org.uk>
Date: Mon, 8 Jun 2020 03:05:22 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check
On Sun, Jun 07, 2020 at 12:48:53PM -0700, Linus Torvalds wrote:
> Rasmus, say the word and I'll mark you for authorship on the first one.
>
> Comments? Can you find something else wrong here, or some other fixup to do?
>
> Al, any reaction?
It's correct, but this
> + if (mask & (mode ^ (mode >> 3))) {
> + if (in_group_p(inode->i_gid))
> + mode >>= 3;
> + }
> +
> + /* Bits in 'mode' clear that we require? */
> + return (mask & ~mode) ? -EACCES : 0;
might be easier to follow if we had, from the very beginning done
unsigned int deny = ~inode->i_mode;
and turned that into
// for group the bits 3..5 apply, for others - 0..2
// we only care which to use when they do not
// agree anyway.
if (mask & (deny ^ (deny >> 3))) // mask & deny != mask & (deny >> 3)
if (in_...
deny >>= 3;
return mask & deny ? -EACCES : 0;
Hell knows...
Powered by blists - more mailing lists