Commit f9e18c2b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: only set default timeout if Entry/Attr does not specify a timeout

parent 39ac4936
...@@ -137,16 +137,16 @@ func (b *rawBridge) addNewChild(parent *Inode, name string, child *Inode, file F ...@@ -137,16 +137,16 @@ func (b *rawBridge) addNewChild(parent *Inode, name string, child *Inode, file F
} }
func (b *rawBridge) setEntryOutTimeout(out *fuse.EntryOut) { func (b *rawBridge) setEntryOutTimeout(out *fuse.EntryOut) {
if b.options.AttrTimeout != nil { if b.options.AttrTimeout != nil && out.AttrTimeout() == 0 {
out.SetAttrTimeout(*b.options.AttrTimeout) out.SetAttrTimeout(*b.options.AttrTimeout)
} }
if b.options.EntryTimeout != nil { if b.options.EntryTimeout != nil && out.EntryTimeout() == 0 {
out.SetEntryTimeout(*b.options.EntryTimeout) out.SetEntryTimeout(*b.options.EntryTimeout)
} }
} }
func (b *rawBridge) setAttrTimeout(out *fuse.AttrOut) { func (b *rawBridge) setAttrTimeout(out *fuse.AttrOut) {
if b.options.AttrTimeout != nil { if b.options.AttrTimeout != nil && out.Timeout() == 0 {
out.SetTimeout(*b.options.AttrTimeout) out.SetTimeout(*b.options.AttrTimeout)
} }
} }
...@@ -216,7 +216,7 @@ func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name s ...@@ -216,7 +216,7 @@ func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name s
child, errno := parent.dirOps().Lookup(&fuse.Context{Caller: header.Caller, Cancel: cancel}, name, out) child, errno := parent.dirOps().Lookup(&fuse.Context{Caller: header.Caller, Cancel: cancel}, name, out)
if errno != 0 { if errno != 0 {
if b.options.NegativeTimeout != nil { if b.options.NegativeTimeout != nil && out.EntryTimeout() == 0 {
out.SetEntryTimeout(*b.options.NegativeTimeout) out.SetEntryTimeout(*b.options.NegativeTimeout)
} }
return errnoToStatus(errno) return errnoToStatus(errno)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment