mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 17:51:20 +08:00
reload entry only when it is a hard link
fix https://github.com/chrislusf/seaweedfs/issues/1581
This commit is contained in:
@@ -253,9 +253,15 @@ func (file *File) Forget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (file *File) maybeLoadEntry(ctx context.Context) error {
|
func (file *File) maybeLoadEntry(ctx context.Context) error {
|
||||||
if (file.entry != nil && len(file.entry.HardLinkId) != 0) || file.isOpen > 0 {
|
if file.isOpen > 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if file.entry != nil {
|
||||||
|
if len(file.entry.HardLinkId) == 0 {
|
||||||
|
// only always reload hard link
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name)
|
entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)
|
glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)
|
||||||
@@ -263,6 +269,8 @@ func (file *File) maybeLoadEntry(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
if entry != nil {
|
if entry != nil {
|
||||||
file.setEntry(entry)
|
file.setEntry(entry)
|
||||||
|
} else {
|
||||||
|
glog.Warningf("maybeLoadEntry not found entry %s/%s: %v", file.dir.FullPath(), file.Name, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user