lkml.org 
[lkml]   [2020]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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...

\
 
 \ /
  Last update: 2020-06-08 04:06    [W:0.769 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site