Reload superblock if METADATA_UPDATED is received
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Sat, 7 Jun 2014 06:53:00 +0000 (01:53 -0500)
committerGoldwyn Rodrigues <rgoldwyn@suse.com>
Mon, 23 Feb 2015 15:59:06 +0000 (09:59 -0600)
Re-reads the devices by invalidating the cache.
Since we don't write to faulty devices, this is detected using
events recorded in the devices. If it is old as compared to the mddev
mark it is faulty.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
drivers/md/md-cluster.c
drivers/md/md.c
drivers/md/md.h

index 5db491010835b7e3776ced0dc553940f7b205b9f..7e419f05b5688ff7b8071e0fe9341781e93c788c 100644 (file)
@@ -320,6 +320,7 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
        case METADATA_UPDATED:
                pr_info("%s: %d Received message: METADATA_UPDATE from %d\n",
                        __func__, __LINE__, msg->slot);
+               md_reload_sb(mddev);
                break;
        case RESYNCING:
                pr_info("%s: %d Received message: RESYNCING from %d\n",
index 0052e433d8a67907198602dd0292548654efb1cc..3eb45dc0537f9114d7a50d931bbcbae3a4cf034f 100644 (file)
@@ -8788,6 +8788,28 @@ err_wq:
        return ret;
 }
 
+void md_reload_sb(struct mddev *mddev)
+{
+       struct md_rdev *rdev, *tmp;
+
+       rdev_for_each_safe(rdev, tmp, mddev) {
+               rdev->sb_loaded = 0;
+               ClearPageUptodate(rdev->sb_page);
+       }
+       mddev->raid_disks = 0;
+       analyze_sbs(mddev);
+       rdev_for_each_safe(rdev, tmp, mddev) {
+               struct mdp_superblock_1 *sb = page_address(rdev->sb_page);
+               /* since we don't write to faulty devices, we figure out if the
+                *  disk is faulty by comparing events
+                */
+               if (mddev->events > sb->events)
+                       set_bit(Faulty, &rdev->flags);
+       }
+
+}
+EXPORT_SYMBOL(md_reload_sb);
+
 #ifndef MODULE
 
 /*
index 81e568090d8ff427535d411516df1b73b52cd6ae..bfebcfdf54e600cd7a703131f3e29a5df275b0e2 100644 (file)
@@ -665,6 +665,7 @@ extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
                                   struct mddev *mddev);
 
 extern void md_unplug(struct blk_plug_cb *cb, bool from_schedule);
+extern void md_reload_sb(struct mddev *mddev);
 static inline int mddev_check_plugged(struct mddev *mddev)
 {
        return !!blk_check_plugged(md_unplug, mddev,