Skip to contentSkip to conversation

ocfs2: return -EAGAIN instead of EAGAIN in dlm

PATCH New Tiger Yang 3 participants 5 messages Nov 18, 2009 – Dec 3, 2009 OCFS2

lore
Share & tools
lore

Tiger Yang

author
#0 lore raw

PATCH 1/1 ocfs2: return -EAGAIN instead of EAGAIN in dlm

We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we use negative -EAGAIN to erase the confusion caused by this error code.

---
 fs/ocfs2/dlm/dlmrecovery.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +10 -9
index d9fa3d2..8818c8c 100644
@@ -2589,6 +2589,15 @@ retry:
 			     "begin reco msg (%d)\n", dlm->name, nodenum, ret);
 			ret = 0;
 		}
+		if (ret == -EAGAIN) {
+			mlog(0, "%s: trying to start recovery of node "
+			     "%u, but node %u is waiting for last recovery "
+			     "to complete, backoff for a bit\n", dlm->name,
+			     dead_node, nodenum);
+			/*TODO Look into replacing msleep with cond_resched()*/
+			msleep(100);
+			goto retry;
+		}
 		if (ret < 0) {
 			struct dlm_lock_resource *res;
 			/* this is now a serious problem, possibly ENOMEM 
@@ -2608,14 +2617,6 @@ retry:
 			 * another ENOMEM */
 			msleep(100);
 			goto retry;
-		} else if (ret == EAGAIN) {
-			mlog(0, "%s: trying to start recovery of node "
-			     "%u, but node %u is waiting for last recovery "
-			     "to complete, backoff for a bit\n", dlm->name,
-			     dead_node, nodenum);
-			/* TODO Look into replacing msleep with cond_resched() */
-			msleep(100);
-			goto retry;
 		}
 	}
 
@@ -2639,7 +2640,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data,
 		     dlm->name, br->node_idx, br->dead_node,
 		     dlm->reco.dead_node, dlm->reco.new_master);
 		spin_unlock(&dlm->spinlock);
-		return EAGAIN;
+		return -EAGAIN;
 	}
 	spin_unlock(&dlm->spinlock);
 
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 ocfs2: return -EAGAIN instead of EAGAIN in dlm

comments inlined

Quoted 14 lines · Tiger Yang

We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we use negative -EAGAIN to erase the confusion caused by this error code.

---
 fs/ocfs2/dlm/dlmrecovery.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +0 -0
index d9fa3d2..8818c8c 100644

fs/ocfs2/dlm/dlmrecovery.c retry: · line 2597

Quoted 9 lines
fs/ocfs2/dlm/dlmrecovery.c +6 -0
@@ -2589,6 +2589,15 @@ retry:
 			     "begin reco msg (%d)\n", dlm->name, nodenum, ret);
 			ret = 0;
 		}
+		if (ret == -EAGAIN) {
+			mlog(0, "%s: trying to start recovery of node "
+			     "%u, but node %u is waiting for last recovery "
+			     "to complete, backoff for a bit\n", dlm->name,
+			     dead_node, nodenum);
+			/*TODO Look into replacing msleep with cond_resched()*/

This comment can be removed. We cannot replace the msleep with cond_resched().
If anything we may want to increase the msleep to 1 sec. But leave that as is for now.

Quoted 22 lines
fs/ocfs2/dlm/dlmrecovery.c +3 -8
+			msleep(100);
+			goto retry;
+		}
 		if (ret < 0) {
 			struct dlm_lock_resource *res;
 			/* this is now a serious problem, possibly ENOMEM 
@@ -2608,14 +2617,6 @@ retry:
 			 * another ENOMEM */
 			msleep(100);
 			goto retry;
-		} else if (ret == EAGAIN) {
-			mlog(0, "%s: trying to start recovery of node "
-			     "%u, but node %u is waiting for last recovery "
-			     "to complete, backoff for a bit\n", dlm->name,
-			     dead_node, nodenum);
-			/* TODO Look into replacing msleep with cond_resched() */
-			msleep(100);
-			goto retry;
 		}
 	}
 

fs/ocfs2/dlm/dlmrecovery.c int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, · line 2646

Quoted 8 lines
fs/ocfs2/dlm/dlmrecovery.c +1 -1
@@ -2639,7 +2640,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data,
 		     dlm->name, br->node_idx, br->dead_node,
 		     dlm->reco.dead_node, dlm->reco.new_master);
 		spin_unlock(&dlm->spinlock);
-		return EAGAIN;
+		return -EAGAIN;
 	}
 	spin_unlock(&dlm->spinlock);
 

This looks sane. Though I would like someone else to review it too as we have no real way of testing this.

author
#2 lore raw

PATCH 1/1 ocfs2: return -EAGAIN instead of EAGAIN in dlm

We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we return negative -EAGAIN to erase the confusion caused by this error code.

---
 fs/ocfs2/dlm/dlmrecovery.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +9 -9
index d9fa3d2..2f9e4e1 100644
@@ -2589,6 +2589,14 @@ retry:
 			     "begin reco msg (%d)\n", dlm->name, nodenum, ret);
 			ret = 0;
 		}
+		if (ret == -EAGAIN) {
+			mlog(0, "%s: trying to start recovery of node "
+			     "%u, but node %u is waiting for last recovery "
+			     "to complete, backoff for a bit\n", dlm->name,
+			     dead_node, nodenum);
+			msleep(100);
+			goto retry;
+		}
 		if (ret < 0) {
 			struct dlm_lock_resource *res;
 			/* this is now a serious problem, possibly ENOMEM 
@@ -2608,14 +2616,6 @@ retry:
 			 * another ENOMEM */
 			msleep(100);
 			goto retry;
-		} else if (ret == EAGAIN) {
-			mlog(0, "%s: trying to start recovery of node "
-			     "%u, but node %u is waiting for last recovery "
-			     "to complete, backoff for a bit\n", dlm->name,
-			     dead_node, nodenum);
-			/* TODO Look into replacing msleep with cond_resched() */
-			msleep(100);
-			goto retry;
 		}
 	}
 
@@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data,
 		     dlm->name, br->node_idx, br->dead_node,
 		     dlm->reco.dead_node, dlm->reco.new_master);
 		spin_unlock(&dlm->spinlock);
-		return EAGAIN;
+		return -EAGAIN;
 	}
 	spin_unlock(&dlm->spinlock);
 
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 1/1 ocfs2: return -EAGAIN instead of EAGAIN in dlm

ack

Quoted 53 lines · Tiger Yang

We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we return negative -EAGAIN to erase the confusion caused by this error code.

---
 fs/ocfs2/dlm/dlmrecovery.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +9 -9
index d9fa3d2..2f9e4e1 100644
@@ -2589,6 +2589,14 @@ retry:
 			     "begin reco msg (%d)\n", dlm->name, nodenum, ret);
 			ret = 0;
 		}
+		if (ret == -EAGAIN) {
+			mlog(0, "%s: trying to start recovery of node "
+			     "%u, but node %u is waiting for last recovery "
+			     "to complete, backoff for a bit\n", dlm->name,
+			     dead_node, nodenum);
+			msleep(100);
+			goto retry;
+		}
 		if (ret < 0) {
 			struct dlm_lock_resource *res;
 			/* this is now a serious problem, possibly ENOMEM 
@@ -2608,14 +2616,6 @@ retry:
 			 * another ENOMEM */
 			msleep(100);
 			goto retry;
-		} else if (ret == EAGAIN) {
-			mlog(0, "%s: trying to start recovery of node "
-			     "%u, but node %u is waiting for last recovery "
-			     "to complete, backoff for a bit\n", dlm->name,
-			     dead_node, nodenum);
-			/* TODO Look into replacing msleep with cond_resched() */
-			msleep(100);
-			goto retry;
 		}
 	}
 
@@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data,
 		     dlm->name, br->node_idx, br->dead_node,
 		     dlm->reco.dead_node, dlm->reco.new_master);
 		spin_unlock(&dlm->spinlock);
-		return EAGAIN;
+		return -EAGAIN;
 	}
 	spin_unlock(&dlm->spinlock);
 
#4 lore raw

PATCH 1/1 ocfs2: return -EAGAIN instead of EAGAIN in dlm

In reply to Tiger Yang
Quoted 5 lines · Tiger Yang

We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we return negative -EAGAIN to erase the confusion caused by this error code.

This is now in the 'merge-window' branch of ocfs2.git.

Joel

Signature · 9 lines
"I always thought the hardest questions were those I could not answer.
 Now I know they are the ones I can never ask."
			- Charlie Watkins

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127