Commit 24904e82 authored by Levin Zimmermann's avatar Levin Zimmermann

wcfs: Add caller to WatchLink

A watch link is a link between WCFS and a specific client. Before this
patch, watch links didn't memorize basic information of the client (pid
and owner), now this information is added. This can be practical in case
the server needs to send signals to the client process. It's needed in
order to implement protection against faulty clients [1].

[1] https://lab.nexedi.com/nexedi/wendelin.core/blob/38dde766/wcfs/wcfs.go#L186-208
parent 885b3556
...@@ -674,6 +674,8 @@ type WatchLink struct { ...@@ -674,6 +674,8 @@ type WatchLink struct {
txMu sync.Mutex txMu sync.Mutex
rxMu sync.Mutex rxMu sync.Mutex
rxTab map[/*stream*/uint64]chan string // client replies go via here rxTab map[/*stream*/uint64]chan string // client replies go via here
caller fuse.Caller // client that opened the WatchLink
} }
// Watch represents watching for changes to 1 BigFile over particular watch link. // Watch represents watching for changes to 1 BigFile over particular watch link.
...@@ -1814,6 +1816,7 @@ func (wnode *WatchNode) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fus ...@@ -1814,6 +1816,7 @@ func (wnode *WatchNode) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fus
head: head, head: head,
byfile: make(map[zodb.Oid]*Watch), byfile: make(map[zodb.Oid]*Watch),
rxTab: make(map[uint64]chan string), rxTab: make(map[uint64]chan string),
caller: fctx.Caller,
} }
head.wlinkMu.Lock() head.wlinkMu.Lock()
......
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