Skip to contentSkip to conversation

SUNRPC: Check a return result

PATCH In review Chuck Lever 4 participants 6 messages Oct 26, 2007 – Oct 30, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/27 SUNRPC: Check a return result

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

---

 net/sunrpc/xprtrdma/verbs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/xprtrdma/verbs.c +5 -3
index 44b0fb9..ffbf22a 100644
@@ -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

#1 lore raw
Quoted 25 lines · Chuck Lever

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

---

 net/sunrpc/xprtrdma/verbs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/xprtrdma/verbs.c +1 -1
index 44b0fb9..ffbf22a 100644
@@ -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;
 

net/sunrpc/xprtrdma/verbs.c rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, · line 657

Quoted 10 lines
net/sunrpc/xprtrdma/verbs.c +4 -2
 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.

 verbs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/verbs.c +4 -2
@@ -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

#2 lore raw
Quoted 27 lines · James Lentini
Quoted 25 lines · Chuck Lever

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

---

 net/sunrpc/xprtrdma/verbs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/xprtrdma/verbs.c +1 -1
index 44b0fb9..ffbf22a 100644
@@ -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;
 
Quoted 12 lines

net/sunrpc/xprtrdma/verbs.c rpcrdma_ep_create(struct rpcrdma_ep *ep, · line 657

Quoted 10 lines
net/sunrpc/xprtrdma/verbs.c +4 -2
 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.

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.

Quoted 10 lines
 verbs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/verbs.c +0 -0
@@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
 	return 0;
 

net/sunrpc/xprtrdma/verbs.c rpcrdma_ep_create(struct rpcrdma_ep *ep, · line 657

Quoted 10 lines
net/sunrpc/xprtrdma/verbs.c +4 -2
 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;
 }

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard

-------------------------------------------------------------------------
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

#3 lore raw
Quoted 4 lines · Chuck Lever

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.

Quoted 23 lines
Quoted 11 lines
 verbs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/verbs.c +0 -0
@@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
 	return 0;
 

net/sunrpc/xprtrdma/verbs.c rpcrdma_ep_create(struct rpcrdma_ep *ep, · line 657

Quoted 10 lines
net/sunrpc/xprtrdma/verbs.c +4 -2
 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;
 }
Quoted 8 lines

-------------------------------------------------------------------------
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

#4 lore raw
Quoted 10 lines · Thomas
Quoted 4 lines · Chuck Lever

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.

Quoted 22 lines
Quoted 22 lines
Quoted 20 lines
 verbs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/verbs.c +4 -2
@@ -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;
 }
Quoted 10 lines
Quoted 8 lines

-------------------------------------------------------------------------
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

#5 lore raw
In reply to James Lentini
Quoted 51 lines · James Lentini
Quoted 25 lines · Chuck Lever

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

---

 net/sunrpc/xprtrdma/verbs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/xprtrdma/verbs.c +1 -1
index 44b0fb9..ffbf22a 100644
@@ -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;
 

net/sunrpc/xprtrdma/verbs.c rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, · line 657

Quoted 10 lines
net/sunrpc/xprtrdma/verbs.c +4 -2
 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.

 verbs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/verbs.c +0 -0
@@ -648,8 +648,10 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
 	return 0;
 

net/sunrpc/xprtrdma/verbs.c rpcrdma_ep_create(struct rpcrdma_ep *ep, · line 657

Quoted 10 lines
net/sunrpc/xprtrdma/verbs.c +4 -2
 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