mount: file handle locks entry better
related to https://github.com/chrislusf/seaweedfs/issues/2952
This commit is contained in:
@@ -94,10 +94,15 @@ func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr st
|
||||
}
|
||||
}
|
||||
|
||||
path, _, entry, status := wfs.maybeReadEntry(input.NodeId)
|
||||
path, fh, entry, status := wfs.maybeReadEntry(input.NodeId)
|
||||
if status != fuse.OK {
|
||||
return status
|
||||
}
|
||||
if fh != nil {
|
||||
fh.entryLock.Lock()
|
||||
defer fh.entryLock.Unlock()
|
||||
}
|
||||
|
||||
if entry.Extended == nil {
|
||||
entry.Extended = make(map[string][]byte)
|
||||
}
|
||||
@@ -154,10 +159,15 @@ func (wfs *WFS) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr
|
||||
if len(attr) == 0 {
|
||||
return fuse.EINVAL
|
||||
}
|
||||
path, _, entry, status := wfs.maybeReadEntry(header.NodeId)
|
||||
path, fh, entry, status := wfs.maybeReadEntry(header.NodeId)
|
||||
if status != fuse.OK {
|
||||
return status
|
||||
}
|
||||
if fh != nil {
|
||||
fh.entryLock.Lock()
|
||||
defer fh.entryLock.Unlock()
|
||||
}
|
||||
|
||||
if entry.Extended == nil {
|
||||
return fuse.ENOATTR
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user