dombizita opened a new pull request #2815: URL: https://github.com/apache/ozone/pull/2815
## What changes were proposed in this pull request? We discovered this problem during the implementation of HttpFS Gateway. With OFS mkdir -p if we wanted to create a bucket in an already existing volume with ACLs enabled and a non-admin user as the owner of the volume, we got a permission denied exception. This could happened, because when we wanted to create a bucket and it didn't exist before we tried to create the volume first. In this case we got the permission denied, because the not admin user couldn't create a volume. But as the volume existed and and the not admin user was the owner of it, this shouldn't happen, the user could have created the bucket. In this change I modified the getBucket() method in the BasicRootedOzoneClientAdapterImpl class, so it first tries to get the VolumeInfo and the BucketInfo; if it was successful, it returns the BucketInfo. If it wasn't and the createIfNotExist is true it checks if the volume is null. If the volume in null it tries to get the volume again, to figure out if we have permission or not. If the getVolume threw VOLUME_NOT_FOUND we try to create the volume (we ignore if we got VOLUME_ALREADY_EXISTS exception). If the volume creation was successful we get the VolumeInfo. Else we throw the appropriate exceptions. If the volume wasn't null in the beginning, it tries to create the bucket (we ignore if we got BUCKET_ALREADY_EXISTS exception) and we return the BucketInfo in the end, else we throw the appropriate exception. I also removed the proxy variable of the class, as it was only used in the getBucket() method and we can get the bucketDetails via the volume.getBucket(). ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-5891 ## How was this patch tested? Built the project successfully. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
