Commit 10241e3f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7203f542
......@@ -124,7 +124,7 @@ error _Conn::close() {
wconn._pinCancel();
err = wconn._pinWG->wait();
if (err != context::canceled) // canceled - ok
reterr1(fmt::errorf("pinwg.wait: %s", v(err))); // XXX remove errctx
reterr1(err);
// close all files - both that have no mappings and that still have opened mappings.
// XXX after file is closed mappings continue to survive, but we can no
......@@ -151,8 +151,9 @@ error _Conn::close() {
}
// _pinner receives pin messages from wcfs and adjusts wconn mappings.
error _Conn::_pinner(context::Context ctx) { // XXX error -> where?
error _Conn::_pinner(context::Context ctx) {
_Conn& wconn = *this;
xerr::Contextf E("pinner"); // NOTE pinner error goes to Conn::close who has its own context
// XXX panic/exc -> log.CRITICAL
#if 0
......@@ -177,25 +178,33 @@ error _Conn::_pinner(context::Context ctx) { // XXX error -> where?
err = wconn._wlink->recvReq(ctx, &req);
if (err != nil) {
// XXX -> err, handle EOF, abort on *
return err; // XXX ok? (EOF - when wcfs closes wlink)
return E(err); // XXX ok? (EOF - when wcfs closes wlink)
}
// we received request to pin/unpin file block. handle it
wconn._pin1(&req);
err = wconn._pin1(&req);
if (err != nil) {
return E(err);
}
}
}
// pin1 handles one pin request received from wcfs.
// XXX return error?
void _Conn::_pin1(PinReq *req) {
error _Conn::_pin1(PinReq *req) {
_Conn& wconn = *this;
xerr::Contextf E("pin f<%s> #%ld @%s", v(req->foid), req->blk, v(req->at));
error err = wconn.__pin1(req);
// reply either ack or nak on error
string ack = "ack";
if (err != nil)
ack = fmt::sprintf("nak: %s", v(err));
wconn._wlink->replyReq(context::background(), req, ack); // XXX ctx ok?
error err2 = wconn._wlink->replyReq(context::background(), req, ack); // XXX ctx ok?
if (err == nil)
err = err2;
return E(err);
}
error _Conn::__pin1(PinReq *req) {
......
......@@ -125,7 +125,7 @@ public:
private:
error _pinner(context::Context ctx);
void _pin1(PinReq *req);
error _pin1(PinReq *req);
error __pin1(PinReq *req);
};
......
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