All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
Cc: NFS list <linux-nfs@vger.kernel.org>
Subject: [PATCH 1/2] pnfs-obj: Bug when we are running out of bio
Date: Wed, 3 Aug 2011 21:54:33 -0700	[thread overview]
Message-ID: <4E3A2609.9050001@panasas.com> (raw)
In-Reply-To: <2E1EB2CF9ED1CB4AA966F0EB76EAB4430A8AA600@SACMVEXC2-PRD.hq.netapp.com>


When we have a situation that the number of pages we want
to encode is bigger then the size of the bio. (Which can
currently happen only when all IO is going to a single device
.e.g group_width==1) then the IO is submitted short and we
report back only the amount of bytes we actually wrote/read
and all is fine. BUT ...

There was a bug that the current length counter was advanced
before the fail to add the extra page, and we come to a situation
that the CDB length was one-page longer then the actual bio size,
which is of course rejected by the osd-target.

While here also fix the bio size calculation, in the case
that we received more then one group of devices.

CC: Stable Tree <stable@kernel.org>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/objlayout/objio_osd.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 9383ca7..aa8663a 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -589,22 +589,19 @@ static void _calc_stripe_info(struct objio_state *ios, u64 file_offset,
 }
 
 static int _add_stripe_unit(struct objio_state *ios,  unsigned *cur_pg,
-		unsigned pgbase, struct _objio_per_comp *per_dev, int cur_len,
+		unsigned pgbase, struct _objio_per_comp *per_dev, int len,
 		gfp_t gfp_flags)
 {
 	unsigned pg = *cur_pg;
+	int cur_len = len;
 	struct request_queue *q =
 			osd_request_queue(_io_od(ios, per_dev->dev));
 
-	per_dev->length += cur_len;
-
 	if (per_dev->bio == NULL) {
-		unsigned stripes = ios->layout->num_comps /
-						     ios->layout->mirrors_p1;
-		unsigned pages_in_stripe = stripes *
+		unsigned pages_in_stripe = ios->layout->group_width *
 				      (ios->layout->stripe_unit / PAGE_SIZE);
 		unsigned bio_size = (ios->ol_state.nr_pages + pages_in_stripe) /
-				    stripes;
+				    ios->layout->group_width;
 
 		if (BIO_MAX_PAGES_KMALLOC < bio_size)
 			bio_size = BIO_MAX_PAGES_KMALLOC;
@@ -632,6 +629,7 @@ static int _add_stripe_unit(struct objio_state *ios,  unsigned *cur_pg,
 	}
 	BUG_ON(cur_len);
 
+	per_dev->length += len;
 	*cur_pg = pg;
 	return 0;
 }
-- 
1.7.6



      parent reply	other threads:[~2011-08-04  4:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-31  3:19 Please pull NFS client changes Trond Myklebust
2011-07-31 18:24 ` Christoph Hellwig
2011-07-31 18:24   ` Christoph Hellwig
2011-07-31 18:30   ` Myklebust, Trond
2011-07-31 18:30     ` Myklebust, Trond
2011-07-31 19:14   ` Jens Axboe
2011-07-31 19:14     ` Jens Axboe
2011-07-31 19:39     ` Trond Myklebust
2011-07-31 19:39       ` Trond Myklebust
2011-07-31 19:39       ` Trond Myklebust
2011-07-31 19:46       ` Jens Axboe
2011-07-31 19:46         ` Jens Axboe
2011-07-31 19:58         ` Trond Myklebust
2011-07-31 19:58           ` Trond Myklebust
2011-07-31 19:58           ` Trond Myklebust
2011-07-31 20:03           ` Jens Axboe
2011-07-31 20:03             ` Jens Axboe
2011-08-01  0:57           ` Stephen Rothwell
2011-08-01  1:01             ` Stephen Rothwell
2011-08-01  1:01               ` Stephen Rothwell
2011-08-03 23:51 ` Boaz Harrosh
2011-08-03 23:54   ` Myklebust, Trond
2011-08-04  4:52     ` [PATCH] pnfs-obj: Fix the comp_index != 0 case Boaz Harrosh
2011-08-04  4:55       ` Boaz Harrosh
2011-08-04  4:54     ` Boaz Harrosh [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=4E3A2609.9050001@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.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.