[sheepdog] [PATCH v2 5/5] sheep/recovery: fix a sefault when ->stop is set true

Liu Yuan namei.unix at gmail.com
Fri Feb 28 08:52:19 CET 2014


For multi-threaded recovery, if one thread set ->stop true and release rinfo,
other threads might null-deferenece rinfo and get segfault.

We should simply ignore ->stop in main thread and wait for run_next_rw() to be
called and safely run into the next recovery.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/vdi.c        |  4 ++--
 sheep/recovery.c | 11 -----------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index 8a8f089..09a87b2 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -822,7 +822,7 @@ static int vdi_object_location(int argc, char **argv)
 			   SD_INODE_SIZE);
 	if (ret != EXIT_SUCCESS) {
 		sd_err("FATAL: no inode objects");
-		return ret;
+		goto out;
 	}
 	vid = inode->vdi_id;
 
@@ -939,7 +939,7 @@ static int vdi_track(int argc, char **argv)
 			   SD_INODE_SIZE);
 	if (ret != EXIT_SUCCESS) {
 		sd_err("FATAL: no inode objects");
-		return ret;
+		goto err;
 	}
 	vid = inode->vdi_id;
 	nr_copies = inode->nr_copies;
diff --git a/sheep/recovery.c b/sheep/recovery.c
index 859375d..27eb6c8 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -873,17 +873,6 @@ static void recover_object_main(struct work *work)
 		return;
 	}
 
-	if (row->stop) {
-		/*
-		 * Stop this recovery process and wait for epoch to be
-		 * lifted and flush wait queue to requeue those
-		 * requests
-		 */
-		rinfo->notify_complete = false;
-		sd_debug("recovery is stopped");
-		goto finish_recovery;
-	}
-
 	wakeup_requests_on_oid(row->oid);
 
 	sd_info("object %"PRIx64" is recovered (%"PRIu64"/%"PRIu64")", row->oid,
-- 
1.8.1.2




More information about the sheepdog mailing list