aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/dir.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/dir.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/dir.go')
-rw-r--r--weed/filesys/dir.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index cef0d6e3b..7d93dbd9f 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -267,6 +267,9 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
resp.Attr.Mode = os.FileMode(entry.Attributes.FileMode)
resp.Attr.Gid = entry.Attributes.Gid
resp.Attr.Uid = entry.Attributes.Uid
+ if entry.HardLinkCounter > 0 {
+ resp.Attr.Nlink = uint32(entry.HardLinkCounter)
+ }
return node, nil
}
@@ -328,7 +331,8 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
// first, ensure the filer store can correctly delete
glog.V(3).Infof("remove file: %v", req)
- err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false, false, []int32{dir.wfs.signature})
+ isDeleteData := entry.HardLinkCounter <= 1
+ err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, isDeleteData, false, false, false, []int32{dir.wfs.signature})
if err != nil {
glog.V(3).Infof("not found remove file %s/%s: %v", dir.FullPath(), req.Name, err)
return fuse.ENOENT
@@ -339,7 +343,9 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
// delete the chunks last
- dir.wfs.deleteFileChunks(entry.Chunks)
+ if isDeleteData {
+ dir.wfs.deleteFileChunks(entry.Chunks)
+ }
return nil