Skip to content

Commit

Permalink
Also use inflight change tracking when doing lookups (by HEAD)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Oct 27, 2021
1 parent 8b35306 commit 117cd99
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ func (parent *Inode) listObjectsSlurp(inode *Inode, startAfter string, lock bool
}
resp, err := cloud.ListBlobs(params)
if err != nil {
parent.fs.mu.Lock()
parent.fs.completeInflightListingUnlocked(myList)
parent.fs.mu.Unlock()
s3Log.Errorf("ListObjects %v = %v", params, err)
return
}
Expand Down Expand Up @@ -486,6 +489,9 @@ func (dh *DirHandle) listObjectsFlat() (err error) {
resp, err := listBlobsSafe(cloud, params)
dh.mu.Lock()
if err != nil {
dh.inode.fs.mu.Lock()
dh.inode.fs.completeInflightListingUnlocked(myList)
dh.inode.fs.mu.Unlock()
return
}

Expand Down Expand Up @@ -1613,8 +1619,12 @@ func (parent *Inode) findChildMaxTime() time.Time {
}

func (parent *Inode) LookUp(name string) (*Inode, error) {
myList := parent.fs.addInflightListing()
blob, err := parent.LookUpInodeMaybeDir(name)
if err != nil {
parent.fs.mu.Lock()
parent.fs.completeInflightListingUnlocked(myList)
parent.fs.mu.Unlock()
return nil, err
}
dirs := make(map[*Inode]bool)
Expand All @@ -1625,7 +1635,10 @@ func (parent *Inode) LookUp(name string) (*Inode, error) {
}
parent.mu.Lock()
parent.fs.mu.Lock()
parent.insertSubTree((*blob.Key)[prefixLen : ], blob, dirs)
skipListing := parent.fs.completeInflightListingUnlocked(myList)
if skipListing == nil || !skipListing[*blob.Key] {
parent.insertSubTree((*blob.Key)[prefixLen : ], blob, dirs)
}
parent.fs.mu.Unlock()
inode := parent.findChildUnlocked(name)
parent.mu.Unlock()
Expand Down

0 comments on commit 117cd99

Please sign in to comment.