* [chunkd patch 2/6] Protect the invariants
@ 2010-05-21 4:54 Pete Zaitcev
0 siblings, 0 replies; only message in thread
From: Pete Zaitcev @ 2010-05-21 4:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
I am unable to ensure that the invariants such as having something in
write_q upon restart are not violated, ever. So, let's rearrange the
code a little bit to make sure.
[Before sending I noticed that this patch included a piece of other,
unrelated patch. However, this passed tests on its own (because
cli_wr_set_poll never returns an error). So in the interests of
not screwing up further, sending as-is.]
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
---
server/object.c | 6 ++++++
server/server.c | 9 ++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
commit 75d01d61e9ca55d244120cbbd7f338f07f03e9b6
Author: Master <zaitcev@lembas.zaitcev.lan>
Date: Thu May 20 21:26:55 2010 -0600
Protect the invariants.
diff --git a/server/object.c b/server/object.c
index 40ef4c4..7f6341a 100644
--- a/server/object.c
+++ b/server/object.c
@@ -342,6 +342,12 @@ bool object_get(struct client *cli, bool want_body)
goto start_write;
}
+ if (!cli->in_len) {
+ applog(LOG_INFO, "zero-sized object");
+ cli_in_end(cli);
+ goto start_write;
+ }
+
if (!object_read_bytes(cli)) {
cli_in_end(cli);
return cli_err(cli, err, false);
diff --git a/server/server.c b/server/server.c
index 07d0375..de9e6a8 100644
--- a/server/server.c
+++ b/server/server.c
@@ -529,14 +529,13 @@ do_write:
cli_wr_completed(cli, rc, &more_work);
- if (more_work)
- goto restart;
-
/* if we emptied the queue, clear write notification */
if (list_empty(&cli->write_q)) {
cli->writing = false;
- if (!cli_wr_set_poll(cli, false))
- goto err_out;
+ cli_wr_set_poll(cli, false);
+ } else {
+ if (more_work)
+ goto restart;
}
return;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-21 4:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 4:54 [chunkd patch 2/6] Protect the invariants Pete Zaitcev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.