All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: linux-nfs@vger.kernel.org
Cc: nfsv4@ietf.org
Subject: [nfsv4] [PATCH 2/2] layout-sim: allow non-conflicting LAYOUTGETs while in layout recall
Date: Mon, 31 Jan 2011 16:03:08 +0200	[thread overview]
Message-ID: <1296482588-4140-2-git-send-email-bhalevy@panasas.com> (raw)
In-Reply-To: <1296482588-4140-1-git-send-email-bhalevy@panasas.com>

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 server.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/server.c b/server.c
index b9c90de..7119ab2 100644
--- a/server.c
+++ b/server.c
@@ -65,6 +65,7 @@ verify_stateid(struct msg *m)
 			/* FIXME: use an actual limit on parallelism */
 			return m->status = NFS4ERR_OLD_STATEID;
 		} else if (m->stateid.type == LAYOUT_STATEID) {
+			/* FIXME: is this specified for LAYOUTRETURN. */
 			if (srv_layout.layout_recall_msg &&
 		            m->stateid.seq < srv_layout.layout_recall_msg->stateid.seq)
 				return m->status = NFS4ERR_OLD_STATEID;
@@ -78,10 +79,26 @@ verify_stateid(struct msg *m)
 	return 0;
 }
 
+static bool
+is_conflicting(struct layout_range *lr, struct layout_range *r)
+{
+	if (lr->iomode != IOMODE_ANY && lr->iomode != r->iomode)
+		return false;
+	if (r->offset >= lr->offset)
+		return (lr->length == NFS4_MAX_UINT64) ||
+		       (lr->offset + lr->length > r->offset);
+	else
+		return (r->length == NFS4_MAX_UINT64) ||
+		       (r->offset + r->length > lr->offset);
+}
+
 static void
 srv_recv_layoutget(struct msg *m)
 {
-	if (srv_layout.layout_recall_msg) {
+	struct msg *lrm = srv_layout.layout_recall_msg;
+
+	/* See section 12.5.5.2.1.3 */
+	if (lrm && is_conflicting(&lrm->range, &m->range)) {
 		m->status = NFS4ERR_RECALLCONFLICT;
 		goto out;
 	}
-- 
1.7.3.4

_______________________________________________
nfsv4 mailing list
nfsv4@ietf.org
https://www.ietf.org/mailman/listinfo/nfsv4

      reply	other threads:[~2011-01-31 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31 14:03 [PATCH 1/2] layout-sim: bump seqid on CB_LAYOUTRECALL re-issue Benny Halevy
2011-01-31 14:03 ` Benny Halevy [this message]

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=1296482588-4140-2-git-send-email-bhalevy@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=nfsv4@ietf.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 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.