hail-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [Patch 02/12] CLD: fix hang in ncld_sess_close
Date: Sat, 17 Apr 2010 22:38:08 -0600	[thread overview]
Message-ID: <20100417223808.33c4992e@redhat.com> (raw)

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;

                 reply	other threads:[~2010-04-18  4:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100417223808.33c4992e@redhat.com \
    --to=zaitcev@redhat.com \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).