All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sage Weil <sage@newdream.net>
To: Henry C Chang <henry.cy.chang@gmail.com>
Cc: ceph-devel@vger.kernel.org,
	Henry C Chang <henry_c_chang@tcloudcomputing.com>
Subject: Re: [PATCH] ceph: handle ceph_osdc_new_request failure in ceph_writepages_start
Date: Tue, 3 May 2011 09:08:13 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.1105030907530.20944@cobra.newdream.net> (raw)
In-Reply-To: <1304415916-1894-1-git-send-email-henry_c_chang@tcloudcomputing.com>

On Tue, 3 May 2011, Henry C Chang wrote:
> We should unlock the page and return -ENOMEM if ceph_osdc_new_request
> failed.
> 
> Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com>
> ---
>  fs/ceph/addr.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 561438b..e14dd9f 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -775,6 +775,13 @@ get_more_pages:
>  					    ci->i_truncate_seq,
>  					    ci->i_truncate_size,
>  					    &inode->i_mtime, true, 1, 0);
> +
> +				if (!req) {
> +					rc = -ENOMEM;
> +					unlock_page(page);
> +					break;
> +				}
> +
>  				max_pages = req->r_num_pages;
>  
>  				alloc_page_vec(fsc, req);
> -- 
> 1.7.2.3

Applied, along with

From dbd49b7b369232fe2db568366f594689e8a57fff Mon Sep 17 00:00:00 2001
From: Sage Weil <sage@newdream.net>
Date: Tue, 3 May 2011 09:23:36 -0700
Subject: [PATCH] libceph: fix ceph_osdc_alloc_request error checks

ceph_osdc_alloc_request returns NULL on failure.

Signed-off-by: Sage Weil <sage@newdream.net>
---
 drivers/block/rbd.c   |    4 ++--
 net/ceph/osd_client.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 16dc364..3e90471 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -777,9 +777,9 @@ static int rbd_do_request(struct request *rq,
 				      ops,
 				      false,
 				      GFP_NOIO, pages, bio);
-	if (IS_ERR(req)) {
+	if (!req) {
 		up_read(&header->snap_rwsem);
-		ret = PTR_ERR(req);
+		ret = -ENOMEM;
 		goto done_pages;
 	}
 
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 9204de4..33fe81a 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -470,8 +470,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
 					 snapc, ops,
 					 use_mempool,
 					 GFP_NOFS, NULL, NULL);
-	if (IS_ERR(req))
-		return req;
+	if (!req)
+		return NULL;
 
 	/* calculate max write size */
 	calc_layout(osdc, vino, layout, off, plen, req, ops);
-- 
1.7.0


      reply	other threads:[~2011-05-03 16:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03  9:45 [PATCH] ceph: handle ceph_osdc_new_request failure in ceph_writepages_start Henry C Chang
2011-05-03 16:08 ` Sage Weil [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=Pine.LNX.4.64.1105030907530.20944@cobra.newdream.net \
    --to=sage@newdream.net \
    --cc=ceph-devel@vger.kernel.org \
    --cc=henry.cy.chang@gmail.com \
    --cc=henry_c_chang@tcloudcomputing.com \
    /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.