Add node recovery callbacks
PATCH 8/24 Add node recovery callbacks
DLM offers callbacks when a node fails and the lock remastery is performed:
1. recover_prep: called when DLM discovers a node is down
2. recover_slot: called when DLM identifies the node and recovery can start
3. recover_done: called when all nodes have completed recover_slot
recover_slot() and recover_done() are also called when the node joins initially in order to inform the node with its slot number. These slot numbers start from one, so we deduct one to make it start with zero which the cluster-md code uses.
Signed-off-by Goldwyn Rodrigues <[email protected]>
--- drivers/md/bitmap.c | 1 + drivers/md/bitmap.h | 4 ++-- drivers/md/md-cluster.c | 60 ++++++++++++++++++++++++++++++++++++++++++++----- drivers/md/md-cluster.h | 4 +++- drivers/md/md.c | 2 +- drivers/md/md.h | 3 ++- 6 files changed, 64 insertions(+), 10 deletions(-)
drivers/md/bitmap.c +1 -0
@@ -624,6 +624,7 @@ static int bitmap_read_sb(struct bitmap *bitmap)if (le32_to_cpu (sb->version) ==BITMAP_MAJOR_HOSTENDIAN )set_bit (BITMAP_HOSTENDIAN , &bitmap->flags); bitmap->events_cleared =le64_to_cpu (sb->events_cleared); +strlcpy (bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name,64 ); err =0 ; out:kunmap_atomic (sb);
drivers/md/bitmap.h +2 -2
@@ -131,8 +131,8 @@ typedef struct bitmap_super_s {__le32 nodes;/* 64 the maximum number of nodes in cluster. */ __le32 sectors_reserved;/* 68 number of 512-byte sectors that are * reserved for the bitmap. */ - -__u8 pad[256 -72 ];/* set to zero */ +__u8 cluster_name[64 ];/* 72 cluster name to which this md belongs */ +__u8 pad[256 -136 ];/* set to zero */ } bitmap_super_t;/* notes:
drivers/md/md-cluster.c +55 -5
104 lines not on this page · raw message
drivers/md/md-cluster.h +3 -1
@@ -8,8 +8,10 @@struct mddev ;struct md_cluster_operations { -int (*join)(struct mddev *mddev); +int (*join)(struct mddev *mddev,int nodes);int (*leave)(struct mddev *mddev); +int (*slot_number)(struct mddev *mddev); + };#endif /* _MD_CLUSTER_H */
drivers/md/md.c +1 -1
@@ -7273,7 +7273,7 @@ int md_setup_cluster(struct mddev *mddev, int nodes) }spin_unlock (&pers_lock); -return md_cluster_ops->join (mddev); +return md_cluster_ops->join (mddev, nodes); }void md_cluster_stop (struct mddev *mddev)
drivers/md/md.h +2 -1
@@ -422,7 +422,8 @@ struct mddev {unsigned long daemon_sleep;/* how many jiffies between updates? */ unsigned long max_write_behind;/* write-behind mode */ int external; -int nodes; +int nodes;/* Maximum unmber of nodes in the cluster */ +char cluster_name[64 ];/* Name of the cluster */ } bitmap_info;atomic_t max_corr_read_errors;/* max read retries */
Signature · 1 line
2.1.2