Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753365AbaCACT6 (ORCPT ); Fri, 28 Feb 2014 21:19:58 -0500 Received: from linuxhacker.ru ([217.76.32.60]:42596 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752729AbaCACRS (ORCPT ); Fri, 28 Feb 2014 21:17:18 -0500 From: Oleg Drokin To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Cc: "John L. Hammond" , Oleg Drokin Subject: [PATCH 07/17] lustre/mdc: fix bad ERR_PTR usage in mdc_locks.c Date: Fri, 28 Feb 2014 21:16:36 -0500 Message-Id: <1393640206-20286-8-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1393640206-20286-1-git-send-email-green@linuxhacker.ru> References: <1393640206-20286-1-git-send-email-green@linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "John L. Hammond" In mdc_intent_open_pack() return an ERR_PTR() rather than NULL when ldlm_prep_enqueue_req() fails. In mdc_intent_getattr_async() check the return value of mdc_intent_getattr_pack() using IS_ERR(). Clean up the includes in mdc_locks.c. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/7886 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4078 Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 6ef9e28..6110943 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -37,15 +37,15 @@ #define DEBUG_SUBSYSTEM S_MDC # include -# include -# include -#include +#include +#include #include #include -/* fid_res_name_eq() */ -#include -#include +#include /* fid_res_name_eq() */ +#include +#include +#include #include "mdc_internal.h" struct mdc_getattr_args { @@ -336,9 +336,9 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp, max(lmmsize, obddev->u.cli.cl_default_mds_easize)); rc = ldlm_prep_enqueue_req(exp, req, &cancels, count); - if (rc) { + if (rc < 0) { ptlrpc_request_free(req); - return NULL; + return ERR_PTR(rc); } spin_lock(&req->rq_lock); @@ -1281,8 +1281,8 @@ int mdc_intent_getattr_async(struct obd_export *exp, fid_build_reg_res_name(&op_data->op_fid1, &res_id); req = mdc_intent_getattr_pack(exp, it, op_data); - if (!req) - return -ENOMEM; + if (IS_ERR(req)) + return PTR_ERR(req); rc = mdc_enter_request(&obddev->u.cli); if (rc != 0) { -- 1.8.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/