From: Filippos Giannakos Date: Tue, 10 Sep 2013 13:19:12 +0000 (+0300) Subject: vlmc: Honor flush req by stall until all reqs done X-Git-Url: https://code.grnet.gr/git/archipelago/commitdiff_plain/ae8c75f437ee2ee1764d66422d2406fd5ec0a77d?hp=addcb81e90629e4ad9cfcfe2d5a87fbcd6631c55 vlmc: Honor flush req by stall until all reqs done --- diff --git a/xseg/peers/user/mt-vlmcd.c b/xseg/peers/user/mt-vlmcd.c index 03ed5db..7e99eb6 100644 --- a/xseg/peers/user/mt-vlmcd.c +++ b/xseg/peers/user/mt-vlmcd.c @@ -255,6 +255,14 @@ static int conclude_pr(struct peerd *peer, struct peer_req *pr) return 0; } +static int should_freeze_volume(struct xseg_request *req) +{ + if (req->op == X_CLOSE || req->op == X_SNAPSHOT || + (req->op == X_WRITE && !req->size && (req->flags & XF_FLUSH))) + return 1; + return 0; +} + static int do_accepted_pr(struct peerd *peer, struct peer_req *pr) { struct vlmcd *vlmc = __get_vlmcd(peer); @@ -283,7 +291,7 @@ static int do_accepted_pr(struct peerd *peer, struct peer_req *pr) return -1; } - if (pr->req->op == X_CLOSE || pr->req->op == X_SNAPSHOT){ + if (should_freeze_volume(pr->req)){ XSEGLOG2(&lc, I, "Freezing volume %s", vi->name); vi->flags |= VF_VOLUME_FREEZED; if (vi->active_reqs){ @@ -299,6 +307,7 @@ static int do_accepted_pr(struct peerd *peer, struct peer_req *pr) //assert vi->pending_pr == pr vi->pending_pr = NULL; } + } vi->active_reqs++; @@ -309,6 +318,7 @@ static int do_accepted_pr(struct peerd *peer, struct peer_req *pr) (pr->req->flags & (XF_FLUSH|XF_FUA))){ //hanlde flush requests here, so we don't mess with mapper //because of the -1 offset + vi->flags &= ~VF_VOLUME_FREEZED; XSEGLOG2(&lc, I, "Completing flush request"); pr->req->serviced = pr->req->size; conclude_pr(peer, pr);