aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/file.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2020-09-25 09:45:56 +0800
committerGitHub <noreply@github.com>2020-09-25 09:45:56 +0800
commit76e24a5660a2192603b7d6d84aef1924ab95cb94 (patch)
tree72e1b320c3487aa5f6cb3cd5fc849bfd94108ec8 /weed/filesys/file.go
parent48c578410fea2128f81356250b2cd9d56074d878 (diff)
parent043b0631369bec00b33eb53cdf2cdef3eced006c (diff)
downloadseaweedfs-76e24a5660a2192603b7d6d84aef1924ab95cb94.tar.xz
seaweedfs-76e24a5660a2192603b7d6d84aef1924ab95cb94.zip
Merge pull request #20 from chrislusf/master
sync
Diffstat (limited to 'weed/filesys/file.go')
-rw-r--r--weed/filesys/file.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index d130d5898..98ee010d8 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -67,6 +67,9 @@ func (file *File) Attr(ctx context.Context, attr *fuse.Attr) error {
attr.Uid = file.entry.Attributes.Uid
attr.Blocks = attr.Size/blockSize + 1
attr.BlockSize = uint32(file.wfs.option.ChunkSizeLimit)
+ if file.entry.HardLinkCounter > 0 {
+ attr.Nlink = uint32(file.entry.HardLinkCounter)
+ }
return nil
@@ -250,7 +253,7 @@ func (file *File) Forget() {
}
func (file *File) maybeLoadEntry(ctx context.Context) error {
- if file.entry == nil && file.isOpen <= 0 {
+ if (file.entry == nil || len(file.entry.HardLinkId) != 0) && file.isOpen <= 0 {
entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name)
if err != nil {
glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)