@@ -1864,10 +1864,12 @@ func (parent *Inode) insertSubTree(path string, obj *BlobItemOutput, dirs map[*I
18641864 inode .SetFromBlobItem (obj )
18651865 sealPastDirs (dirs , inode )
18661866 } else {
1867+ inode .mu .Lock ()
18671868 now := time .Now ()
18681869 if inode .AttrTime .Before (now ) {
18691870 inode .SetAttrTime (now )
18701871 }
1872+ inode .mu .Unlock ()
18711873 }
18721874
18731875 // mark this dir but don't seal anything else
@@ -1905,9 +1907,29 @@ func (parent *Inode) LookUpCached(name string) (inode *Inode, err error) {
19051907 parent .mu .Lock ()
19061908 ok := false
19071909 inode = parent .findChildUnlocked (name )
1910+ if inode == nil {
1911+ ok = false
1912+ if parent .dir .DeletedChildren != nil {
1913+ if _ , ok := parent .dir .DeletedChildren [name ]; ok {
1914+ // File is deleted locally
1915+ parent .mu .Unlock ()
1916+ return nil , syscall .ENOENT
1917+ }
1918+ }
1919+ if ! expired (parent .dir .DirTime , parent .fs .flags .StatCacheTTL ) {
1920+ // Don't recheck from the server if directory cache is actual
1921+ parent .mu .Unlock ()
1922+ return nil , syscall .ENOENT
1923+ }
1924+ }
1925+
1926+ ttl := parent .fs .flags .StatCacheTTL
1927+ parent .mu .Unlock ()
1928+
19081929 if inode != nil {
1930+ inode .mu .Lock ()
19091931 ok = true
1910- if expired (inode .AttrTime , parent . fs . flags . StatCacheTTL ) {
1932+ if expired (inode .AttrTime , ttl ) {
19111933 ok = false
19121934 if atomic .LoadInt32 (& inode .CacheState ) != ST_CACHED ||
19131935 inode .isDir () && atomic .LoadInt64 (& inode .dir .ModifiedChildren ) > 0 {
@@ -1921,22 +1943,9 @@ func (parent *Inode) LookUpCached(name string) (inode *Inode, err error) {
19211943 inode .logFuse ("lookup expired" )
19221944 }
19231945 }
1924- } else {
1925- ok = false
1926- if parent .dir .DeletedChildren != nil {
1927- if _ , ok := parent .dir .DeletedChildren [name ]; ok {
1928- // File is deleted locally
1929- parent .mu .Unlock ()
1930- return nil , syscall .ENOENT
1931- }
1932- }
1933- if ! expired (parent .dir .DirTime , parent .fs .flags .StatCacheTTL ) {
1934- // Don't recheck from the server if directory cache is actual
1935- parent .mu .Unlock ()
1936- return nil , syscall .ENOENT
1937- }
1946+ inode .mu .Unlock ()
19381947 }
1939- parent . mu . Unlock ()
1948+
19401949 if ! ok {
19411950 inode , err = parent .recheckInode (inode , name )
19421951 err = mapAwsError (err )
@@ -1947,6 +1956,7 @@ func (parent *Inode) LookUpCached(name string) (inode *Inode, err error) {
19471956 return nil , syscall .ENOENT
19481957 }
19491958 }
1959+
19501960 return inode , nil
19511961}
19521962
0 commit comments