2007-10-26 17:31:14

by Chuck Lever III

[permalink] [raw]
Subject: [PATCH 03/27] SUNRPC: Check a return result

Minor: Replace an empty if statement with a debugging dprintk.

Signed-off-by: Chuck Lever <[email protected]>
Cc: Thomas Talpey <[email protected]>
---

net/sunrpc/xprtrdma/verbs.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 44b0fb9..ffbf22a 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -522,7 +522,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
struct rpcrdma_create_data_internal *cdata)
{
struct ib_device_attr devattr;
- int rc;
+ int rc, err;

rc = ib_query_device(ia->ri_id->device, &devattr);
if (rc) {
@@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
return 0;

out2:
- if (ib_destroy_cq(ep->rep_cq))
- ;
+ err = ib_destroy_cq(ep->rep_cq);
+ if (err)
+ dprintk("RPC: %s: ib_destroy_cq returned %i\n",
+ __func__, err);
out1:
return rc;
}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2007-10-30 16:43:00

by James Lentini

[permalink] [raw]
Subject: Re: [PATCH 03/27] SUNRPC: Check a return result


On Fri, 26 Oct 2007, Chuck Lever wrote:

> Minor: Replace an empty if statement with a debugging dprintk.
>
> Signed-off-by: Chuck Lever <[email protected]>
> Cc: Thomas Talpey <[email protected]>
> ---
>
> net/sunrpc/xprtrdma/verbs.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> index 44b0fb9..ffbf22a 100644
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -522,7 +522,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
> struct rpcrdma_create_data_internal *cdata)
> {
> struct ib_device_attr devattr;
> - int rc;
> + int rc, err;
>
> rc = ib_query_device(ia->ri_id->device, &devattr);
> if (rc) {
> @@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
> return 0;
>
> out2:
> - if (ib_destroy_cq(ep->rep_cq))
> - ;
> + err = ib_destroy_cq(ep->rep_cq);
> + if (err)
> + dprintk("RPC: %s: ib_destroy_cq returned %i\n",
> + __func__, err);
> out1:
> return rc;
> }

Good eyes, Chuck. One minor suggestion: instead of adding "err", how
about reusing "rc"? Here's a patch against Trond's nfs-2.6 tree.

Signed-off-by: James Lentini <[email protected]>

verbs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
return 0;

out2:
- if (ib_destroy_cq(ep->rep_cq))
- ;
+ rc = ib_destroy_cq(ep->rep_cq);
+ if (rc)
+ dprintk("RPC: %s: ib_destroy_cq returned %i\n",
+ __func__, rc);
out1:
return rc;
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2007-10-30 16:56:48

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH 03/27] SUNRPC: Check a return result


On Tue, 2007-10-30 at 12:42 -0400, James Lentini wrote:
> On Fri, 26 Oct 2007, Chuck Lever wrote:
>
> > Minor: Replace an empty if statement with a debugging dprintk.
> >
> > Signed-off-by: Chuck Lever <[email protected]>
> > Cc: Thomas Talpey <[email protected]>
> > ---
> >
> > net/sunrpc/xprtrdma/verbs.c | 8 +++++---
> > 1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> > index 44b0fb9..ffbf22a 100644
> > --- a/net/sunrpc/xprtrdma/verbs.c
> > +++ b/net/sunrpc/xprtrdma/verbs.c
> > @@ -522,7 +522,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
> > struct rpcrdma_create_data_internal *cdata)
> > {
> > struct ib_device_attr devattr;
> > - int rc;
> > + int rc, err;
> >
> > rc = ib_query_device(ia->ri_id->device, &devattr);
> > if (rc) {
> > @@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
> > return 0;
> >
> > out2:
> > - if (ib_destroy_cq(ep->rep_cq))
> > - ;
> > + err = ib_destroy_cq(ep->rep_cq);
> > + if (err)
> > + dprintk("RPC: %s: ib_destroy_cq returned %i\n",
> > + __func__, err);
> > out1:
> > return rc;
> > }
>
> Good eyes, Chuck. One minor suggestion: instead of adding "err", how
> about reusing "rc"? Here's a patch against Trond's nfs-2.6 tree.
>
> Signed-off-by: James Lentini <[email protected]>
>
> verbs.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
> return 0;
>
> out2:
> - if (ib_destroy_cq(ep->rep_cq))
> - ;
> + rc = ib_destroy_cq(ep->rep_cq);
> + if (rc)
> + dprintk("RPC: %s: ib_destroy_cq returned %i\n",
> + __func__, rc);
> out1:
> return rc;
> }

NAK. That would clobber the error that you are trying to return from
ib_req_notify_cq.

Cheers
Trond


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2007-10-30 16:59:36

by Talpey, Thomas

[permalink] [raw]
Subject: Re: [PATCH 03/27] SUNRPC: Check a return result

At 12:49 PM 10/30/2007, Chuck Lever wrote:
>I added "err" because it appeared that the intention of the original
>logic was to ignore the return code from ib_destroy_cq() completely.
>Thus re-using "rc" would have made rpcrdma_ep_create() return an
>unnecessary error in cases where it hadn't before.

Which would be bad, mounts would fail for no reason. Your fix is
correct - though really all the code needs is (void). Unfortunately
when I coded that, some tool whined, I forget which. Anyway,
dprintk'ing the message is better.

Tom.

>
>> Signed-off-by: James Lentini <[email protected]>
>>
>> verbs.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> --- a/net/sunrpc/xprtrdma/verbs.c
>> +++ b/net/sunrpc/xprtrdma/verbs.c
>> @@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
>> return 0;
>>
>> out2:
>> - if (ib_destroy_cq(ep->rep_cq))
>> - ;
>> + rc = ib_destroy_cq(ep->rep_cq);
>> + if (rc)
>> + dprintk("RPC: %s: ib_destroy_cq returned %i\n",
>> + __func__, rc);
>> out1:
>> return rc;
>> }
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems? Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk now >> http://get.splunk.com/
>_______________________________________________
>NFS maillist - [email protected]
>https://lists.sourceforge.net/lists/listinfo/nfs

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2007-10-30 17:15:06

by James Lentini

[permalink] [raw]
Subject: Re: [PATCH 03/27] SUNRPC: Check a return result



On Tue, 30 Oct 2007, Talpey, Thomas wrote:

> At 12:49 PM 10/30/2007, Chuck Lever wrote:
> >I added "err" because it appeared that the intention of the original
> >logic was to ignore the return code from ib_destroy_cq() completely.
> >Thus re-using "rc" would have made rpcrdma_ep_create() return an
> >unnecessary error in cases where it hadn't before.
>
> Which would be bad, mounts would fail for no reason. Your fix is
> correct - though really all the code needs is (void). Unfortunately
> when I coded that, some tool whined, I forget which. Anyway,
> dprintk'ing the message is better.

Good point. I missed that.

> >
> >> Signed-off-by: James Lentini <[email protected]>
> >> verbs.c | 6 ++++--
> >> 1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> --- a/net/sunrpc/xprtrdma/verbs.c
> >> +++ b/net/sunrpc/xprtrdma/verbs.c
> >> @@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
> >> return 0;
> >>
> >> out2:
> >> - if (ib_destroy_cq(ep->rep_cq))
> >> - ;
> >> + rc = ib_destroy_cq(ep->rep_cq);
> >> + if (rc)
> >> + dprintk("RPC: %s: ib_destroy_cq returned %i\n",
> >> + __func__, rc);
> >> out1:
> >> return rc;
> >> }
> >
> >
> >-------------------------------------------------------------------------
> >This SF.net email is sponsored by: Splunk Inc.
> >Still grepping through log files to find problems? Stop.
> >Now Search log events and configuration files using AJAX and a browser.
> >Download your FREE copy of Splunk now >> http://get.splunk.com/
> >_______________________________________________
> >NFS maillist - [email protected]
> >https://lists.sourceforge.net/lists/listinfo/nfs
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs