aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-24 01:59:37 -0800
committerchrislu <chris.lu@gmail.com>2022-02-24 01:59:37 -0800
commite31ec04f4f12ae5ce5b7d728343550adb191c56a (patch)
tree1643b39ccbcec94633294c6448ca9ed75aad71c6
parent419e355e9e7a242c4442676e47594fd2c41d14f2 (diff)
downloadseaweedfs-e31ec04f4f12ae5ce5b7d728343550adb191c56a.tar.xz
seaweedfs-e31ec04f4f12ae5ce5b7d728343550adb191c56a.zip
mount2: POSIX deleted opened file nlink should be 0
-rw-r--r--weed/mount/weedfs_attr.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/weed/mount/weedfs_attr.go b/weed/mount/weedfs_attr.go
index 531c722d0..dec586317 100644
--- a/weed/mount/weedfs_attr.go
+++ b/weed/mount/weedfs_attr.go
@@ -17,13 +17,20 @@ func (wfs *WFS) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *fuse
}
_, _, entry, status := wfs.maybeReadEntry(input.NodeId)
- if status != fuse.OK {
+ if status == fuse.OK {
+ out.AttrValid = 1
+ wfs.setAttrByPbEntry(&out.Attr, input.NodeId, entry)
return status
+ } else {
+ if fh, found := wfs.fhmap.FindFileHandle(input.NodeId); found {
+ out.AttrValid = 1
+ wfs.setAttrByPbEntry(&out.Attr, input.NodeId, fh.entry)
+ out.Nlink = 0
+ return fuse.OK
+ }
}
- out.AttrValid = 1
- wfs.setAttrByPbEntry(&out.Attr, input.NodeId, entry)
- return fuse.OK
+ return status
}
func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
@@ -66,7 +73,7 @@ func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse
}
if mode, ok := input.GetMode(); ok {
- glog.V(4).Infof("setAttr mode %o", mode)
+ // glog.V(4).Infof("setAttr mode %o", mode)
entry.Attributes.FileMode = chmod(entry.Attributes.FileMode, mode)
}