[PATCH] vfs_gpfs: Retry getacl with DAC capability if necessary

Jeremy Allison jra at samba.org
Fri Jul 22 16:30:55 UTC 2016


On Thu, Jul 21, 2016 at 09:52:34PM -0700, Christof Schmitt wrote:
> 
> Yes. There is a retry loop for the case that the ACL does not fit into
> the allocaged buffer:
> 
>  if ((ret != 0) && (errno == ENOSPC)) {
> ...
>                 goto again;
> 
> The logic is that if capabilities are required, and the initial buffer
> was too small, then the code should only do one additional retry with
> the larger buffer and the capability.
> 
> At some point, i would like to refactor the loop for ENOSPC into a
> simple retry, but that is independent of fallback to use the capability.
> 
> > > +	} else {
> > > +		ret = gpfswrap_getacl(discard_const_p(char, fname),
> > > +				      flags, aclbuf);
> > > +		if ((ret != 0) && (errno == EACCES)) {
> > > +			DBG_DEBUG("Retry with DAC capability for %s\n", fname);
> > > +			use_capability = true;
> > > +			ret = gpfs_getacl_with_capability(fname, flags, aclbuf);
> > > +		}
> > > +	}
> > > +
> > 
> > Looks like the above block (without the else {...}) is all
> > you need for this.
> 
> The "else" case here is for the initial attempt. We do not want the
> overhead of acquiring the capability for every attempt to read the ACL,
> only when the READ_ACL is missing and the initial attempt results in
> EACCESS.

Doh - missed the "goto again" part :-).

Thanks for the explaination.

LGTM - pushed !



More information about the samba-technical mailing list