-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handled chown Scenario #1655
base: main
Are you sure you want to change the base?
Handled chown Scenario #1655
Conversation
@@ -666,6 +666,8 @@ func (bb *BlockBlob) getBlobAttr(blobInfo *container.BlobItem) (*internal.ObjAtt | |||
Flags: internal.NewFileBitMap(), | |||
MD5: blobInfo.Properties.ContentMD5, | |||
ETag: sanitizeEtag(blobInfo.Properties.ETag), | |||
GID: blobInfo.Metadata["gid"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shall not use random names, check what azcopy uses and we shall be using the same key name in metadata to cross tool compatibility.
@@ -81,6 +81,9 @@ type ObjAttr struct { | |||
MD5 []byte // MD5 of the blob as per last GetAttr | |||
ETag string // ETag of the blob as per last GetAttr | |||
Metadata map[string]*string // extra information to preserve | |||
// Even though GID and UID are part of Metadata Map, I am defining new attributes to solve case sensitivity issue. | |||
GID *string // Group ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for linux we can keep these values in integers so that we do not have to translate them later while giving it back to kernel
@@ -346,8 +346,17 @@ func libfuse_destroy(data unsafe.Pointer) { | |||
} | |||
|
|||
func (lf *Libfuse) fillStat(attr *internal.ObjAttr, stbuf *C.stat_t) { | |||
(*stbuf).st_uid = C.uint(lf.ownerUID) | |||
(*stbuf).st_gid = C.uint(lf.ownerGID) | |||
if attr.UID != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for this kind of check may be either *string or *int is better but we might be reading from storage less often and returning it back to kernel more often so storing as *int will be a better choice.
} | ||
|
||
update := false | ||
for key, value := range metadata { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are doing so much of processing. We can get the metadata and set uid/gid related keys irrespective of whether they are there or not and send the metadata back.
@@ -1629,3 +1631,67 @@ func (bb *BlockBlob) SetFilter(filter string) error { | |||
bb.Config.filter = &blobfilter.BlobFilter{} | |||
return bb.Config.filter.Configure(filter) | |||
} | |||
|
|||
func (bb *BlockBlob) updateMetadata(name string, metadata map[string]*string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changeowner method anyways gets the uid and gid so there is no need to implement another method as this could have been done in that method itself,
// for operations like git clone where transaction fails if chown is not successful | ||
// return success instead of ENOSYS | ||
return nil | ||
metadata := make(map[string]*string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just pass the uid/gid as is to blockblob changeOwner method and it can take care of the rest. There is no need to implement this here.
Type of Change
Description
This pull request introduces changes to add chown handling handling for adls account, and includes corresponding tests.
How Has This Been Tested?
Tested locally and with unit testing.
Still have to cover file_cache handling
Checklist