]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/cluster/heartbeat.c
Merge remote-tracking branch 'ocfs2/linux-next'
[karo-tx-linux.git] / fs / ocfs2 / cluster / heartbeat.c
index f3f2d95a3bfe5f3e29db994b862ba45407013413..5b62c95a6f5d21449a2691cbf2ac7277f9510242 100644 (file)
@@ -177,7 +177,7 @@ static void o2hb_dead_threshold_set(unsigned int threshold)
        }
 }
 
-static int o2hb_global_hearbeat_mode_set(unsigned int hb_mode)
+static int o2hb_global_heartbeat_mode_set(unsigned int hb_mode)
 {
        int ret = -1;
 
@@ -492,7 +492,7 @@ static int o2hb_issue_node_write(struct o2hb_region *reg,
        }
 
        atomic_inc(&write_wc->wc_num_reqs);
-       submit_bio(WRITE, bio);
+       submit_bio(WRITE_SYNC, bio);
 
        status = 0;
 bail:
@@ -1449,8 +1449,7 @@ static void o2hb_region_release(struct config_item *item)
 
        mlog(ML_HEARTBEAT, "hb region release (%s)\n", reg->hr_dev_name);
 
-       if (reg->hr_tmp_block)
-               kfree(reg->hr_tmp_block);
+       kfree(reg->hr_tmp_block);
 
        if (reg->hr_slot_data) {
                for (i = 0; i < reg->hr_num_pages; i++) {
@@ -1464,8 +1463,7 @@ static void o2hb_region_release(struct config_item *item)
        if (reg->hr_bdev)
                blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
 
-       if (reg->hr_slots)
-               kfree(reg->hr_slots);
+       kfree(reg->hr_slots);
 
        kfree(reg->hr_db_regnum);
        kfree(reg->hr_db_livenodes);
@@ -1724,8 +1722,8 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
        long fd;
        int sectsize;
        char *p = (char *)page;
-       struct file *filp = NULL;
-       struct inode *inode = NULL;
+       struct fd f;
+       struct inode *inode;
        ssize_t ret = -EINVAL;
        int live_threshold;
 
@@ -1744,26 +1742,26 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
        if (fd < 0 || fd >= INT_MAX)
                goto out;
 
-       filp = fget(fd);
-       if (filp == NULL)
+       f = fdget(fd);
+       if (f.file == NULL)
                goto out;
 
        if (reg->hr_blocks == 0 || reg->hr_start_block == 0 ||
            reg->hr_block_bytes == 0)
-               goto out;
+               goto out2;
 
-       inode = igrab(filp->f_mapping->host);
+       inode = igrab(f.file->f_mapping->host);
        if (inode == NULL)
-               goto out;
+               goto out2;
 
        if (!S_ISBLK(inode->i_mode))
-               goto out;
+               goto out3;
 
-       reg->hr_bdev = I_BDEV(filp->f_mapping->host);
+       reg->hr_bdev = I_BDEV(f.file->f_mapping->host);
        ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ, NULL);
        if (ret) {
                reg->hr_bdev = NULL;
-               goto out;
+               goto out3;
        }
        inode = NULL;
 
@@ -1775,7 +1773,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
                     "blocksize %u incorrect for device, expected %d",
                     reg->hr_block_bytes, sectsize);
                ret = -EINVAL;
-               goto out;
+               goto out3;
        }
 
        o2hb_init_region_params(reg);
@@ -1789,13 +1787,13 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
        ret = o2hb_map_slot_data(reg);
        if (ret) {
                mlog_errno(ret);
-               goto out;
+               goto out3;
        }
 
        ret = o2hb_populate_slot_data(reg);
        if (ret) {
                mlog_errno(ret);
-               goto out;
+               goto out3;
        }
 
        INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
@@ -1825,7 +1823,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
        if (IS_ERR(hb_task)) {
                ret = PTR_ERR(hb_task);
                mlog_errno(ret);
-               goto out;
+               goto out3;
        }
 
        spin_lock(&o2hb_live_lock);
@@ -1841,7 +1839,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
 
        if (reg->hr_aborted_start) {
                ret = -EIO;
-               goto out;
+               goto out3;
        }
 
        /* Ok, we were woken.  Make sure it wasn't by drop_item() */
@@ -1860,11 +1858,11 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
                printk(KERN_NOTICE "o2hb: Heartbeat started on region %s (%s)\n",
                       config_item_name(&reg->hr_item), reg->hr_dev_name);
 
+out3:
+       iput(inode);
+out2:
+       fdput(f);
 out:
-       if (filp)
-               fput(filp);
-       if (inode)
-               iput(inode);
        if (ret < 0) {
                if (reg->hr_bdev) {
                        blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
@@ -2251,7 +2249,7 @@ ssize_t o2hb_heartbeat_group_mode_store(struct o2hb_heartbeat_group *group,
                if (strnicmp(page, o2hb_heartbeat_mode_desc[i], len))
                        continue;
 
-               ret = o2hb_global_hearbeat_mode_set(i);
+               ret = o2hb_global_heartbeat_mode_set(i);
                if (!ret)
                        printk(KERN_NOTICE "o2hb: Heartbeat mode set to %s\n",
                               o2hb_heartbeat_mode_desc[i]);
@@ -2284,7 +2282,7 @@ static struct configfs_attribute *o2hb_heartbeat_group_attrs[] = {
        NULL,
 };
 
-static struct configfs_item_operations o2hb_hearbeat_group_item_ops = {
+static struct configfs_item_operations o2hb_heartbeat_group_item_ops = {
        .show_attribute         = o2hb_heartbeat_group_show,
        .store_attribute        = o2hb_heartbeat_group_store,
 };
@@ -2296,7 +2294,7 @@ static struct configfs_group_operations o2hb_heartbeat_group_group_ops = {
 
 static struct config_item_type o2hb_heartbeat_group_type = {
        .ct_group_ops   = &o2hb_heartbeat_group_group_ops,
-       .ct_item_ops    = &o2hb_hearbeat_group_item_ops,
+       .ct_item_ops    = &o2hb_heartbeat_group_item_ops,
        .ct_attrs       = o2hb_heartbeat_group_attrs,
        .ct_owner       = THIS_MODULE,
 };
@@ -2369,6 +2367,9 @@ static int o2hb_region_pin(const char *region_uuid)
        assert_spin_locked(&o2hb_live_lock);
 
        list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) {
+               if (reg->hr_item_dropped)
+                       continue;
+
                uuid = config_item_name(&reg->hr_item);
 
                /* local heartbeat */
@@ -2419,6 +2420,9 @@ static void o2hb_region_unpin(const char *region_uuid)
        assert_spin_locked(&o2hb_live_lock);
 
        list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) {
+               if (reg->hr_item_dropped)
+                       continue;
+
                uuid = config_item_name(&reg->hr_item);
                if (region_uuid) {
                        if (strcmp(region_uuid, uuid))
@@ -2634,6 +2638,9 @@ int o2hb_get_all_regions(char *region_uuids, u8 max_regions)
 
        p = region_uuids;
        list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) {
+               if (reg->hr_item_dropped)
+                       continue;
+
                mlog(0, "Region: %s\n", config_item_name(&reg->hr_item));
                if (numregs < max_regions) {
                        memcpy(p, config_item_name(&reg->hr_item),