Commit ba39a3ec 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 {
txMu sync.Mutex
rxMu sync.Mutex
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.
......@@ -1489,6 +1491,7 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
return err
}
if ack != "ack" {
blkpin.err = fmt.Errorf("expect %q; got %q", "ack", ack)
return blkpin.err
......@@ -1814,6 +1817,7 @@ func (wnode *WatchNode) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fus
head: head,
byfile: make(map[zodb.Oid]*Watch),
rxTab: make(map[uint64]chan string),
caller: fctx.Caller,
}
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