From patchwork Thu May 19 14:06:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9127687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D188D60221 for ; Thu, 19 May 2016 14:07:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54362808F for ; Thu, 19 May 2016 14:07:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA4E3281C6; Thu, 19 May 2016 14:07:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 724902808F for ; Thu, 19 May 2016 14:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754996AbcESOHK (ORCPT ); Thu, 19 May 2016 10:07:10 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35839 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754776AbcESOHI (ORCPT ); Thu, 19 May 2016 10:07:08 -0400 Received: by mail-wm0-f66.google.com with SMTP id s63so6789865wme.2 for ; Thu, 19 May 2016 07:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=g7SsQqsCcwegYDBoZ3eyy23z9ZynMmwRSsIO1KyEnUs=; b=QaRADRfUUDxwrNW5yeA2St6YTYl5VPEUxtFUTVcV9cv4sLQInkRS+rsemdAGSg3sW0 7AL5BMK6HGKSNGbivU59xM4kZIYAjaHyBSOde5sbo5PwhP94CYRZVvRNu4G5ndatUvVn cbYsDNjrhLO/UXEWowI1J5MZD0jgK/zpxNP9sVIk50SycvjPfzkC6EuWNkmPHow76eMz gjuoeSgLLoY/Ujqokh8pOqnNAOW7S+jFk//g6VqDlYcxDTz0tadrQGX4oyFsF1PnIgzn 61rLZun7CfenQNYnOqQFMz0DcqMo6lVqeCJLUp33V3gfRpbFWrgJxRyAdLk5yes1dcMA MMtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=g7SsQqsCcwegYDBoZ3eyy23z9ZynMmwRSsIO1KyEnUs=; b=e455IVA6uW8QrlYgs+FtXOqc4ku+JSAw2oek6OjvqJhz6ECsNBnyy+f8EWH3MHz+7y 7Ix/RPjfQIL0oFb+nVd6RSQLDPwMA6zkf5/B/D6XUtpwk7QnTXHZM7eef7S5BDJkCtTd 5ihDIKbVUZHK9V5En9+VFCKvue1P0aEM56pcmiFmvsEN/Th7vhFT8r6kMgWTZ51FLCh3 WpvIRXQsj946und03UgIUhNWlfabNm3i1G0XNlVnqgficW8VZWlQOphVM6EO1ZCAoXpB 0oP3bsr4diY01iJROkIqksGwOWPURlj+oOq3IpSMJ/WI8AVD64tJTVfsb9q5R9MOHu+z 7/Yg== X-Gm-Message-State: AOPr4FVEOpQ3C772NrdzsBxl/uzepvoOTx025A38g+RNjHGuu2XGlYr92hErdSpkV99cvQ== X-Received: by 10.194.228.102 with SMTP id sh6mr14850961wjc.173.1463666827097; Thu, 19 May 2016 07:07:07 -0700 (PDT) Received: from localhost.localdomain (ip-94-112-165-81.net.upcbroadband.cz. [94.112.165.81]) by smtp.gmail.com with ESMTPSA id b124sm3586833wmb.1.2016.05.19.07.07.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 07:07:06 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 1/6] libceph: make ceph_osdc_put_request() accept NULL Date: Thu, 19 May 2016 16:06:37 +0200 Message-Id: <1463666802-25140-2-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1463666802-25140-1-git-send-email-idryomov@gmail.com> References: <1463666802-25140-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ilya Dryomov --- fs/ceph/addr.c | 9 +++------ net/ceph/osd_client.c | 8 +++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 4801571f51cb..3e61fc8bb371 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1099,8 +1099,7 @@ release_pvec_pages: mapping->writeback_index = index; out: - if (req) - ceph_osdc_put_request(req); + ceph_osdc_put_request(req); ceph_put_snap_context(snapc); dout("writepages done, rc = %d\n", rc); return rc; @@ -1824,10 +1823,8 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, u32 pool) out_unlock: up_write(&mdsc->pool_perm_rwsem); - if (rd_req) - ceph_osdc_put_request(rd_req); - if (wr_req) - ceph_osdc_put_request(wr_req); + ceph_osdc_put_request(rd_req); + ceph_osdc_put_request(wr_req); out: if (!err) err = have; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 40a53a70efdf..cacce9e35f08 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -354,9 +354,11 @@ EXPORT_SYMBOL(ceph_osdc_get_request); void ceph_osdc_put_request(struct ceph_osd_request *req) { - dout("%s %p (was %d)\n", __func__, req, - atomic_read(&req->r_kref.refcount)); - kref_put(&req->r_kref, ceph_osdc_release_request); + if (req) { + dout("%s %p (was %d)\n", __func__, req, + atomic_read(&req->r_kref.refcount)); + kref_put(&req->r_kref, ceph_osdc_release_request); + } } EXPORT_SYMBOL(ceph_osdc_put_request);