Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1254328 > unrolled thread

[PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

Started byNilesh Kokane <nilesh.kokane05@gmail.com>
First post2015-10-23 06:40 +0200
Last post2015-10-23 17:20 +0200
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN) Nilesh Kokane <nilesh.kokane05@gmail.com> - 2015-10-23 06:40 +0200
    Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno  should typically be negative (ie: return -EAGAIN) Dan Carpenter <dan.carpenter@oracle.com> - 2015-10-23 07:10 +0200
      Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno  should typically be negative (ie: return -EAGAIN) Dan Carpenter <dan.carpenter@oracle.com> - 2015-10-23 08:50 +0200
    Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno  should typically be negative (ie: return -EAGAIN) "Dilger, Andreas" <andreas.dilger@intel.com> - 2015-10-23 13:50 +0200
      Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno  should typically be negative (ie: return -EAGAIN) Nilesh Kokane <nilesh.kokane05@gmail.com> - 2015-10-23 14:20 +0200
    RE: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno  should typically be negative (ie: return -EAGAIN) "Simmons, James A." <simmonsja@ornl.gov> - 2015-10-23 17:20 +0200

#1254328 — [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

FromNilesh Kokane <nilesh.kokane05@gmail.com>
Date2015-10-23 06:40 +0200
Subject[PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)
Message-ID<qmCj0-7vn-1@gated-at.bofh.it>
Fixed- Return of an errno should typically be negative (ie: return -EAGAIN)

Signed-off-by: Nilesh Kokane <Nilesh.Kokane05@gmail.com>
---
 drivers/staging/lustre/lnet/lnet/lib-move.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c
index 433faae..10f886f 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-move.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-move.c
@@ -808,7 +808,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
 			lnet_finalize(ni, msg, -EHOSTUNREACH);
 
 		lnet_net_lock(cpt);
-		return EHOSTUNREACH;
+		return -EHOSTUNREACH;
 	}
 
 	if (msg->msg_md != NULL &&
@@ -821,7 +821,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
 			lnet_finalize(ni, msg, -ECANCELED);
 
 		lnet_net_lock(cpt);
-		return ECANCELED;
+		return -ECANCELED;
 	}
 
 	if (!msg->msg_peertxcredit) {
@@ -838,7 +838,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
 		if (lp->lp_txcredits < 0) {
 			msg->msg_tx_delayed = 1;
 			list_add_tail(&msg->msg_list, &lp->lp_txq);
-			return EAGAIN;
+			return -EAGAIN;
 		}
 	}
 
@@ -855,7 +855,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
 		if (tq->tq_credits < 0) {
 			msg->msg_tx_delayed = 1;
 			list_add_tail(&msg->msg_list, &tq->tq_delayed);
-			return EAGAIN;
+			return -EAGAIN;
 		}
 	}
 
@@ -922,7 +922,7 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv)
 			LASSERT(msg->msg_rx_ready_delay);
 			msg->msg_rx_delayed = 1;
 			list_add_tail(&msg->msg_list, &lp->lp_rtrq);
-			return EAGAIN;
+			return -EAGAIN;
 		}
 	}
 
@@ -942,7 +942,7 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv)
 			LASSERT(msg->msg_rx_ready_delay);
 			msg->msg_rx_delayed = 1;
 			list_add_tail(&msg->msg_list, &rbp->rbp_msgs);
-			return EAGAIN;
+			return -EAGAIN;
 		}
 	}
 
@@ -1426,7 +1426,7 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg)
 			libcfs_id2str(info.mi_id), info.mi_portal,
 			info.mi_mbits, info.mi_roffset, info.mi_rlength, rc);
 
-		return ENOENT;	/* +ve: OK but no match */
+		return -ENOENT;	/* +ve: OK but no match */
 	}
 }
 
@@ -1457,7 +1457,7 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get)
 		CNETERR("Dropping GET from %s portal %d match %llu offset %d length %d\n",
 			libcfs_id2str(info.mi_id), info.mi_portal,
 			info.mi_mbits, info.mi_roffset, info.mi_rlength);
-		return ENOENT;	/* +ve: OK but no match */
+		return -ENOENT;	/* +ve: OK but no match */
 	}
 
 	LASSERT(rc == LNET_MATCHMD_OK);
@@ -1524,7 +1524,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
 			       md->md_me->me_portal);
 
 		lnet_res_unlock(cpt);
-		return ENOENT;		  /* +ve: OK but no match */
+		return -ENOENT;		  /* +ve: OK but no match */
 	}
 
 	LASSERT(md->md_offset == 0);
@@ -1539,7 +1539,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
 			rlength, hdr->msg.reply.dst_wmd.wh_object_cookie,
 			mlength);
 		lnet_res_unlock(cpt);
-		return ENOENT;	  /* +ve: OK but no match */
+		return -ENOENT;	  /* +ve: OK but no match */
 	}
 
 	CDEBUG(D_NET, "%s: Reply from %s of length %d/%d into md %#llx\n",
@@ -1592,7 +1592,7 @@ lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg)
 			       md->md_me->me_portal);
 
 		lnet_res_unlock(cpt);
-		return ENOENT;		  /* +ve! */
+		return -ENOENT;		  /* +ve! */
 	}
 
 	CDEBUG(D_NET, "%s: ACK from %s into md %#llx\n",
-- 
1.9.1

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

[toc] | [next] | [standalone]


#1254332 — Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-10-23 07:10 +0200
SubjectRe: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)
Message-ID<qmCM2-8iD-1@gated-at.bofh.it>
In reply to#1254328
On Fri, Oct 23, 2015 at 10:00:03AM +0530, Nilesh Kokane wrote:
> Fixed- Return of an errno should typically be negative (ie: return -EAGAIN)
> 

The changelog needs to describe the use visible effects of this change.

regards,
dan carpenter

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

[toc] | [prev] | [next] | [standalone]


#1254362 — Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-10-23 08:50 +0200
SubjectRe: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)
Message-ID<qmEkO-1Vw-7@gated-at.bofh.it>
In reply to#1254332
On Fri, Oct 23, 2015 at 08:00:09AM +0300, Dan Carpenter wrote:
> On Fri, Oct 23, 2015 at 10:00:03AM +0530, Nilesh Kokane wrote:
> > Fixed- Return of an errno should typically be negative (ie: return -EAGAIN)
> > 
> 
> The changelog needs to describe the use visible effects of this change.
> 

I was expecting you to respond to my email saying that you had seen the
mistake...  Anyway, bugs like this are why the process requires that
user visible changes need documentation.

regards,
dan carpenter

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

[toc] | [prev] | [next] | [standalone]


#1254508 — Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

From"Dilger, Andreas" <andreas.dilger@intel.com>
Date2015-10-23 13:50 +0200
SubjectRe: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)
Message-ID<qmJ18-lc-3@gated-at.bofh.it>
In reply to#1254328
On 2015/10/22, 22:30, "Nilesh Kokane" <nilesh.kokane05@gmail.com> wrote:
>Fixed- Return of an errno should typically be negative (ie: return
>-EAGAIN)

Nak. Please do not change these function return values.  They are
converted as necessary by the callers before returning to userspace, but
allow the code to distinguish between errors generated internally or from
lower networking layers.

As you will note, many of them are explicitly annotated with comments that
they are returning positive values.  The patch as it stands would totally
break the code.

Cheers, Andreas

>Signed-off-by: Nilesh Kokane <Nilesh.Kokane05@gmail.com>
>---
> drivers/staging/lustre/lnet/lnet/lib-move.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
>diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c
>b/drivers/staging/lustre/lnet/lnet/lib-move.c
>index 433faae..10f886f 100644
>--- a/drivers/staging/lustre/lnet/lnet/lib-move.c
>+++ b/drivers/staging/lustre/lnet/lnet/lib-move.c
>@@ -808,7 +808,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
> 			lnet_finalize(ni, msg, -EHOSTUNREACH);
> 
> 		lnet_net_lock(cpt);
>-		return EHOSTUNREACH;
>+		return -EHOSTUNREACH;
> 	}
> 
> 	if (msg->msg_md != NULL &&
>@@ -821,7 +821,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
> 			lnet_finalize(ni, msg, -ECANCELED);
> 
> 		lnet_net_lock(cpt);
>-		return ECANCELED;
>+		return -ECANCELED;
> 	}
> 
> 	if (!msg->msg_peertxcredit) {
>@@ -838,7 +838,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
> 		if (lp->lp_txcredits < 0) {
> 			msg->msg_tx_delayed = 1;
> 			list_add_tail(&msg->msg_list, &lp->lp_txq);
>-			return EAGAIN;
>+			return -EAGAIN;
> 		}
> 	}
> 
>@@ -855,7 +855,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
> 		if (tq->tq_credits < 0) {
> 			msg->msg_tx_delayed = 1;
> 			list_add_tail(&msg->msg_list, &tq->tq_delayed);
>-			return EAGAIN;
>+			return -EAGAIN;
> 		}
> 	}
> 
>@@ -922,7 +922,7 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int
>do_recv)
> 			LASSERT(msg->msg_rx_ready_delay);
> 			msg->msg_rx_delayed = 1;
> 			list_add_tail(&msg->msg_list, &lp->lp_rtrq);
>-			return EAGAIN;
>+			return -EAGAIN;
> 		}
> 	}
> 
>@@ -942,7 +942,7 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int
>do_recv)
> 			LASSERT(msg->msg_rx_ready_delay);
> 			msg->msg_rx_delayed = 1;
> 			list_add_tail(&msg->msg_list, &rbp->rbp_msgs);
>-			return EAGAIN;
>+			return -EAGAIN;
> 		}
> 	}
> 
>@@ -1426,7 +1426,7 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg)
> 			libcfs_id2str(info.mi_id), info.mi_portal,
> 			info.mi_mbits, info.mi_roffset, info.mi_rlength, rc);
> 
>-		return ENOENT;	/* +ve: OK but no match */
>+		return -ENOENT;	/* +ve: OK but no match */
> 	}
> }
> 
>@@ -1457,7 +1457,7 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int
>rdma_get)
> 		CNETERR("Dropping GET from %s portal %d match %llu offset %d length
>%d\n",
> 			libcfs_id2str(info.mi_id), info.mi_portal,
> 			info.mi_mbits, info.mi_roffset, info.mi_rlength);
>-		return ENOENT;	/* +ve: OK but no match */
>+		return -ENOENT;	/* +ve: OK but no match */
> 	}
> 
> 	LASSERT(rc == LNET_MATCHMD_OK);
>@@ -1524,7 +1524,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
> 			       md->md_me->me_portal);
> 
> 		lnet_res_unlock(cpt);
>-		return ENOENT;		  /* +ve: OK but no match */
>+		return -ENOENT;		  /* +ve: OK but no match */
> 	}
> 
> 	LASSERT(md->md_offset == 0);
>@@ -1539,7 +1539,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
> 			rlength, hdr->msg.reply.dst_wmd.wh_object_cookie,
> 			mlength);
> 		lnet_res_unlock(cpt);
>-		return ENOENT;	  /* +ve: OK but no match */
>+		return -ENOENT;	  /* +ve: OK but no match */
> 	}
> 
> 	CDEBUG(D_NET, "%s: Reply from %s of length %d/%d into md %#llx\n",
>@@ -1592,7 +1592,7 @@ lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg)
> 			       md->md_me->me_portal);
> 
> 		lnet_res_unlock(cpt);
>-		return ENOENT;		  /* +ve! */
>+		return -ENOENT;		  /* +ve! */
> 	}
> 
> 	CDEBUG(D_NET, "%s: ACK from %s into md %#llx\n",
>-- 
>1.9.1
>
>


Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division


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

[toc] | [prev] | [next] | [standalone]


#1254533 — Re: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

FromNilesh Kokane <nilesh.kokane05@gmail.com>
Date2015-10-23 14:20 +0200
SubjectRe: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)
Message-ID<qmJub-18q-29@gated-at.bofh.it>
In reply to#1254508
On Fri, Oct 23, 2015 at 5:10 PM, Dilger, Andreas
<andreas.dilger@intel.com> wrote:
> On 2015/10/22, 22:30, "Nilesh Kokane" <nilesh.kokane05@gmail.com> wrote:
>>Fixed- Return of an errno should typically be negative (ie: return
>>-EAGAIN)
>
> Nak. Please do not change these function return values.  They are
> converted as necessary by the callers before returning to userspace, but
> allow the code to distinguish between errors generated internally or from
> lower networking layers.
>
> As you will note, many of them are explicitly annotated with comments that
> they are returning positive values.  The patch as it stands would totally
> break the code.

Ok. I'll take care next time.

-- 
//Nilesh Kokane
--
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/

[toc] | [prev] | [next] | [standalone]


#1254661 — RE: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)

From"Simmons, James A." <simmonsja@ornl.gov>
Date2015-10-23 17:20 +0200
SubjectRE: [PATCH 2/2] Staging: lustre: lnet: lib-move return of an errno should typically be negative (ie: return -EAGAIN)
Message-ID<qmMim-5bn-11@gated-at.bofh.it>
In reply to#1254328
>Fixed- Return of an errno should typically be negative (ie: return -EAGAIN)
>
>Signed-off-by: Nilesh Kokane <Nilesh.Kokane05@gmail.com>
>---
> drivers/staging/lustre/lnet/lnet/lib-move.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)

Bad idea. I also made this mistake and it broke LNet really badly.

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web