From patchwork Tue May 3 16:08:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 750522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p43G7kS9015678 for ; Tue, 3 May 2011 16:07:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753364Ab1ECQHo (ORCPT ); Tue, 3 May 2011 12:07:44 -0400 Received: from cobra.newdream.net ([66.33.216.30]:35181 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753296Ab1ECQHn (ORCPT ); Tue, 3 May 2011 12:07:43 -0400 Received: from cobra.newdream.net (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id 7678BBC69F; Tue, 3 May 2011 09:08:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=newdream.net; h=date:from:to:cc :subject:in-reply-to:message-id:references:mime-version: content-type; q=dns; s=newdream.net; b=iCu+cfsBMMBZWvokw/0dyBbCv mFJ5l53S4jqS3hAPQfqFBORXXHAPQITAFQRTTL1Tp1pui7UBP+REYRjhxSNUTQmL Z8gkGsezZF4la/Sjl18vEqX/vqk4nBcd9z2cLB7T+h7vfqRimNx13yQAs5ioDrzd jYsykNB+Oal9/SrX0o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=newdream.net; h=date:from :to:cc:subject:in-reply-to:message-id:references:mime-version: content-type; s=newdream.net; bh=ZqG71FembqT+3Gga/MjKT55KjwU=; b=xExMPORrLdVxvJlsDUOvFdg4Cmz8jSEs1/Z48ohqgLhnXCDr6a+GXPlBfs7WE jx3umWoBNzCeV4SDbTUJGrZkoAe0oa7zRNZ1Ohu43l7VVMVsjHCgRSGn59nCCUYF pftmd90H+gd9lugtc8hBrFpECX+xITW8CqwWyVuN1i/y3Y= Received: by cobra.newdream.net (Postfix, from userid 1031) id 6174EBC7C5; Tue, 3 May 2011 09:08:13 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id 4706BBC72C; Tue, 3 May 2011 09:08:13 -0700 (PDT) Date: Tue, 3 May 2011 09:08:13 -0700 (PDT) From: Sage Weil To: Henry C Chang cc: ceph-devel@vger.kernel.org, Henry C Chang Subject: Re: [PATCH] ceph: handle ceph_osdc_new_request failure in ceph_writepages_start In-Reply-To: <1304415916-1894-1-git-send-email-henry_c_chang@tcloudcomputing.com> Message-ID: References: <1304415916-1894-1-git-send-email-henry_c_chang@tcloudcomputing.com> MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 03 May 2011 16:07:46 +0000 (UTC) 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 > --- > 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 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 --- 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);