Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-08 Thread Linus Torvalds
On Sun, Jun 7, 2020 at 7:05 PM Al Viro wrote: > > return mask & deny ? -EACCES : 0; I agree that 'deny' would be simpler to read here, but in other places it would look odd. ie the IS_POSIXACL() thing that checks for "are group bits set" still wants the mode. And I'd hate to have us use

Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-08 Thread Rasmus Villemoes
On 07/06/2020 21.48, Linus Torvalds wrote: > On Sun, Jun 7, 2020 at 9:37 AM Linus Torvalds > wrote: >> >>> That will kinda work, except you do that mask &= MAY_RWX before >>> check_acl(), which cares about MAY_NOT_BLOCK and who knows what other bits. >> >> Good catch. > > With the change to not c

Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-07 Thread Al Viro
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 ^ (mo

Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-07 Thread Linus Torvalds
On Sun, Jun 7, 2020 at 9:37 AM Linus Torvalds wrote: > > > That will kinda work, except you do that mask &= MAY_RWX before > > check_acl(), which cares about MAY_NOT_BLOCK and who knows what other bits. > > Good catch. With the change to not clear the non-rwx bits in general, the owner case now w

Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-07 Thread Linus Torvalds
On Sun, Jun 7, 2020 at 6:22 AM Rasmus Villemoes wrote: > > Yes, I did think about that, but I thought this was the more obviously > correct approach, and that in practice one only sees the 0X44 and 0X55 > cases. I'm not sure about that - it probably depends on your umask. Because I see a lot of

Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-07 Thread Rasmus Villemoes
On 05/06/2020 22.18, Linus Torvalds wrote: > On Fri, Jun 5, 2020 at 7:23 AM Rasmus Villemoes > wrote: >> >> + /* >> +* If the "group" and "other" permissions are the same, >> +* there's no point calling in_group_p() to decide which >> +

Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-05 Thread Linus Torvalds
On Fri, Jun 5, 2020 at 7:23 AM Rasmus Villemoes wrote: > > + /* > +* If the "group" and "other" permissions are the same, > +* there's no point calling in_group_p() to decide which > +* set to use. > +*/ > +

[PATCH resend] fs/namei.c: micro-optimize acl_permission_check

2020-06-05 Thread Rasmus Villemoes
Just something like open(/usr/include/sys/stat.h) causes five calls of generic_permission -> acl_permission_check -> in_group_p; if the compiler first tried /usr/local/include/..., that would be a few more. Altogether, on a bog-standard Ubuntu 20.04 install, a workload consisting of compiling lots