aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/cluster/heartbeat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/cluster/heartbeat.c')
-rw-r--r--fs/ocfs2/cluster/heartbeat.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 305cba3681fe..277ca67a2ad6 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -141,7 +141,7 @@ struct o2hb_region {
141 * recognizes a node going up and down in one iteration */ 141 * recognizes a node going up and down in one iteration */
142 u64 hr_generation; 142 u64 hr_generation;
143 143
144 struct work_struct hr_write_timeout_work; 144 struct delayed_work hr_write_timeout_work;
145 unsigned long hr_last_timeout_start; 145 unsigned long hr_last_timeout_start;
146 146
147 /* Used during o2hb_check_slot to hold a copy of the block 147 /* Used during o2hb_check_slot to hold a copy of the block
@@ -156,9 +156,11 @@ struct o2hb_bio_wait_ctxt {
156 int wc_error; 156 int wc_error;
157}; 157};
158 158
159static void o2hb_write_timeout(void *arg) 159static void o2hb_write_timeout(struct work_struct *work)
160{ 160{
161 struct o2hb_region *reg = arg; 161 struct o2hb_region *reg =
162 container_of(work, struct o2hb_region,
163 hr_write_timeout_work.work);
162 164
163 mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u " 165 mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u "
164 "milliseconds\n", reg->hr_dev_name, 166 "milliseconds\n", reg->hr_dev_name,
@@ -1404,7 +1406,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1404 goto out; 1406 goto out;
1405 } 1407 }
1406 1408
1407 INIT_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout, reg); 1409 INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
1408 1410
1409 /* 1411 /*
1410 * A node is considered live after it has beat LIVE_THRESHOLD 1412 * A node is considered live after it has beat LIVE_THRESHOLD
@@ -1445,6 +1447,15 @@ out:
1445 return ret; 1447 return ret;
1446} 1448}
1447 1449
1450static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
1451 char *page)
1452{
1453 if (!reg->hr_task)
1454 return 0;
1455
1456 return sprintf(page, "%u\n", reg->hr_task->pid);
1457}
1458
1448struct o2hb_region_attribute { 1459struct o2hb_region_attribute {
1449 struct configfs_attribute attr; 1460 struct configfs_attribute attr;
1450 ssize_t (*show)(struct o2hb_region *, char *); 1461 ssize_t (*show)(struct o2hb_region *, char *);
@@ -1483,11 +1494,19 @@ static struct o2hb_region_attribute o2hb_region_attr_dev = {
1483 .store = o2hb_region_dev_write, 1494 .store = o2hb_region_dev_write,
1484}; 1495};
1485 1496
1497static struct o2hb_region_attribute o2hb_region_attr_pid = {
1498 .attr = { .ca_owner = THIS_MODULE,
1499 .ca_name = "pid",
1500 .ca_mode = S_IRUGO | S_IRUSR },
1501 .show = o2hb_region_pid_read,
1502};
1503
1486static struct configfs_attribute *o2hb_region_attrs[] = { 1504static struct configfs_attribute *o2hb_region_attrs[] = {
1487 &o2hb_region_attr_block_bytes.attr, 1505 &o2hb_region_attr_block_bytes.attr,
1488 &o2hb_region_attr_start_block.attr, 1506 &o2hb_region_attr_start_block.attr,
1489 &o2hb_region_attr_blocks.attr, 1507 &o2hb_region_attr_blocks.attr,
1490 &o2hb_region_attr_dev.attr, 1508 &o2hb_region_attr_dev.attr,
1509 &o2hb_region_attr_pid.attr,
1491 NULL, 1510 NULL,
1492}; 1511};
1493 1512
@@ -1551,7 +1570,7 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
1551 struct o2hb_region *reg = NULL; 1570 struct o2hb_region *reg = NULL;
1552 struct config_item *ret = NULL; 1571 struct config_item *ret = NULL;
1553 1572
1554 reg = kcalloc(1, sizeof(struct o2hb_region), GFP_KERNEL); 1573 reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL);
1555 if (reg == NULL) 1574 if (reg == NULL)
1556 goto out; /* ENOMEM */ 1575 goto out; /* ENOMEM */
1557 1576
@@ -1677,7 +1696,7 @@ struct config_group *o2hb_alloc_hb_set(void)
1677 struct o2hb_heartbeat_group *hs = NULL; 1696 struct o2hb_heartbeat_group *hs = NULL;
1678 struct config_group *ret = NULL; 1697 struct config_group *ret = NULL;
1679 1698
1680 hs = kcalloc(1, sizeof(struct o2hb_heartbeat_group), GFP_KERNEL); 1699 hs = kzalloc(sizeof(struct o2hb_heartbeat_group), GFP_KERNEL);
1681 if (hs == NULL) 1700 if (hs == NULL)
1682 goto out; 1701 goto out;
1683 1702