From 50806efdbaad4b59a2d8a9596514f9dd9fd60ec1 Mon Sep 17 00:00:00 2001 From: MORITA Kazutaka Date: Mon, 18 Jun 2012 18:15:24 +0900 Subject: [PATCH] check disk failure before syncing for each partition If disk failure happens while object replication is ongoing, object-replicator could replicate objects from other nodes to the root file system. It is because object-replicator does no mount check (error check) at all after collect_jobs() is called, and it executes rsync based on the old partition information in update(). This change prevents many objects from being written to the root file system wrongly and fixes bug 1014545. Change-Id: Icf740a2683e360df89eccb71b269977f294340b9 --- swift/obj/replicator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index 116cf4f67f..46cf37a020 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -572,6 +572,10 @@ class ObjectReplicator(Daemon): self.run_pool = GreenPool(size=self.concurrency) jobs = self.collect_jobs() for job in jobs: + dev_path = join(self.devices_dir, job['device']) + if self.mount_check and not os.path.ismount(dev_path): + self.logger.warn(_('%s is not mounted'), job['device']) + continue if not self.check_ring(): self.logger.info(_("Ring change detected. Aborting " "current replication pass."))