All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch 02/12] CLD: fix hang in ncld_sess_close
@ 2010-04-18  4:38 Pete Zaitcev
  0 siblings, 0 replies; only message in thread
From: Pete Zaitcev @ 2010-04-18  4:38 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Project Hail List

The use model of ncld made one thing obvious: the cldc_close has
two functions: it disposes of the handle in the client memory
(in theory -- in practice we do not free those until session
terminates), and also talks to the server about that. Our operations
have no own timers, so if session goes down, and someone tries to
close handles of it, the operation hangs forever. The ncld_close
could look at the status of cldc session, but it is a bit of a
layering violation. So, we make cldc_close to verify that the
session is not expired before proceeding.

It would probably be more consistent to make every cldc operation
do that, but the situation arises in practice only during closing
something without knowing if it's dead or alive.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>

---
 lib/cldc.c |    4 ++++
 1 file changed, 4 insertions(+)

commit 9ecffa84d00f13c063a48f0c8784a0995cdd8007
Author: Master <zaitcev@lembas.zaitcev.lan>
Date:   Sat Apr 17 19:10:23 2010 -0600

    Fix hang in ncld_sess_close because of cldc_close.

diff --git a/lib/cldc.c b/lib/cldc.c
index 305e05d..c1e8993 100644
--- a/lib/cldc.c
+++ b/lib/cldc.c
@@ -1046,6 +1046,10 @@ int cldc_close(struct cldc_fh *fh, const struct cldc_call_opts *copts)
 		return -EINVAL;
 
 	sess = fh->sess;
+	if (sess->expired) {
+		fh->valid = false;
+		return -EPIPE;
+	}
 
 	/* create CLOSE message */
 	close_msg.fh = fh->fh;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-18  4:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-18  4:38 [Patch 02/12] CLD: fix hang in ncld_sess_close 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.