Coda File System

Re: acl length - revisited

From: Jan Kopriva <vasquez_at_jikos.cz>
Date: Sat, 16 Apr 2005 11:15:18 +0200
>Just looked at what the server does, it returns E2BIG, I wonder where
>that is mapped to the non-descriptive EINVAL error.
>
>  
>
It is mapped in srvproc.cc. Lines bellow shows the place:

02871         if (AL_Internalize <cid:part1.07070409.04050702_at_jikos.cz>((AL_ExternalAccessList <cid:part2.04040706.08090903_at_jikos.cz>) AccessList <cid:part3.06000009.09010304_at_jikos.cz>->SeqBody, newACL) != 0) {
02872             SLog <cid:part4.05020001.09060008_at_jikos.cz>(0, "CheckSetACLSemantics: ACL internalize failed (%x.%x.%x)",
02873                     Fid <cid:part5.06030405.05030007_at_jikos.cz>.Volume <cid:part6.04050806.07050702_at_jikos.cz>, Fid <cid:part5.06030405.05030007_at_jikos.cz>.Vnode <cid:part8.02080602.01030501_at_jikos.cz>, Fid <cid:part5.06030405.05030007_at_jikos.cz>.Unique <cid:part10.05080402.08090908_at_jikos.cz>);
02874             return(EINVAL);
02875         }


In AL_Internalize, there is a following line:

if (p + m > AL_MaxExtEntries) return(-1);

That is why the execution in case of too big ACL, never gets to the code 
right
bellow the previous branch:

02876         if ((*newACL)->MySize + 4 > aCLSize) {
02877             SLog <cid:part4.05020001.09060008_at_jikos.cz>(0, "CheckSetACLSemantics: ACL too big (%x.%x.%x)",
02878                     Fid <cid:part5.06030405.05030007_at_jikos.cz>.Volume <cid:part6.04050806.07050702_at_jikos.cz>, Fid <cid:part5.06030405.05030007_at_jikos.cz>.Vnode <cid:part8.02080602.01030501_at_jikos.cz>, Fid <cid:part5.06030405.05030007_at_jikos.cz>.Unique <cid:part10.05080402.08090908_at_jikos.cz>);
02879             return(E2BIG);
02880         }
02881     }


and EINVAL is returned.

>Which is why I think it is probably better to get the correct error code
>propagated back from the server to cfs so that it can give a useful
>response without having to rely on a hardcoded value.
>
>Jan
>  
>
I agree. I actually overlooked the second check in srvproc.cc :) However 
it is executed only
in case of correct ACL length thus noone sees E2BIG error. Also, my 
intention was not let the
cfs to perform the long data path if it is able to detect incorrect ACL 
length. But cfs is
not time critical and let the server take care about the return values 
is definitely better design.

I can add a function right before  AL_Internalize 
<cid:part1.07070409.04050702_at_jikos.cz>() that just checks for the length 
and returns the
E2BIG.  The second check can be wiped out.

Later

Jan
Received on 2005-04-16 05:16:44