[Patch] Do not crash upon remote-remote migration
Ansgar Esztermann <[email protected]>
| Newsgroups | gmane.linux.cluster.openmosix.devel |
|---|---|
| Message-ID | <[email protected]> |
When asking an already migrated process to move to another (remote)
node, bring it back home first. The current implementation leads to a
crash. A direct remote->remote migration would be better, but is not
implemented yet.
---
hpc/migctrl.c | 84 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 46 insertions(+), 38 deletions(-)
2a7d618eb6d2ae0942349f16e7a46d13351d7dc2
diff --git a/hpc/migctrl.c b/hpc/migctrl.c
index 18a798a..dee9adb 100644
--- a/hpc/migctrl.c
+++ b/hpc/migctrl.c
@@ -79,6 +79,44 @@ int task_remote_wait_expel(task_t *p)
return task_remote_expel(p);
}
+
+/**
+ * task_local_bring - Receive task back in the deputy stub
+ * @p: deputy task to receive
+ * @reason: reason to send (if any)
+ **/
+static int task_local_bring(task_t *p, int reason)
+{
+ int error;
+ om_link_t *link;
+
+ if (obtain_mm(p)) {
+ printk(KERN_ERR "unable to obtain mm\n");
+ goto failed;
+ }
+
+ /* send remote request */
+ comm_send_req(p->om.contact, DEP_COMING_HOME);
+
+ /* see if other part is with on this */
+ if (mig_recv_hshake(p->om.contact))
+ goto failed;
+
+ /* receive the process back */
+ error = mig_do_receive(p);
+ if (error)
+ goto failed;
+
+ task_clear_dflags(p, DDEPUTY);
+ link = task_set_comm(p, NULL);
+ comm_close(link);
+
+ return 0;
+failed:
+ OMBUG("failed\n");
+ return -1;
+}
+
/**
* task_local_send - Send a local task to remote
* @p: task to send
@@ -90,6 +128,14 @@ static int task_local_send(task_t *p, st
om_link_t *mlink;
int error = 0;
+ /* if this is a stub, bring it back first */
+ if (p->om.contact)
+ {
+ error = task_local_bring(p, reason);
+ if (error)
+ goto failed;
+ }
+
sockaddr_setup_port(whereto, REMOTE_DAEMON_PORT);
mlink = comm_setup_connect(whereto, 0);
if (!mlink) {
@@ -123,44 +169,6 @@ failed:
}
-
-/**
- * task_local_bring - Receive task back in the deputy stub
- * @p: deputy task to receive
- * @reason: reason to send (if any)
- **/
-static int task_local_bring(task_t *p, int reason)
-{
- int error;
- om_link_t *link;
-
- if (obtain_mm(p)) {
- printk(KERN_ERR "unable to obtain mm\n");
- goto failed;
- }
-
- /* send remote request */
- comm_send_req(p->om.contact, DEP_COMING_HOME);
-
- /* see if other part is with on this */
- if (mig_recv_hshake(p->om.contact))
- goto failed;
-
- /* receive the process back */
- error = mig_do_receive(p);
- if (error)
- goto failed;
-
- task_clear_dflags(p, DDEPUTY);
- link = task_set_comm(p, NULL);
- comm_close(link);
-
- return 0;
-failed:
- OMBUG("failed\n");
- return -1;
-}
-
/**
* task_move_remote2remote - migrate a task from remote to remote
* @p: task to send
--
1.2.4
--
Ansgar Esztermann
Researcher & Sysadmin
http://www2.thphy.uni-duesseldorf.de/~ansgar
signature.asc
(application/pgp-signature, 191 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFELVWZwAkt8h1/xRgRAvN7AJ4+ZB0kE/UUXNT16JAXxVQsR3N/ewCgmgp1 +2JOPcZBTWEjO0OQh/LKxdc= =krRH -----END PGP SIGNATURE-----