diff options
Diffstat (limited to 'fs/ocfs2/cluster/heartbeat.c')
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index a4e855e3690e..f7c648d7d6bf 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -1746,8 +1746,8 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1746 | long fd; | 1746 | long fd; |
1747 | int sectsize; | 1747 | int sectsize; |
1748 | char *p = (char *)page; | 1748 | char *p = (char *)page; |
1749 | struct file *filp = NULL; | 1749 | struct fd f; |
1750 | struct inode *inode = NULL; | 1750 | struct inode *inode; |
1751 | ssize_t ret = -EINVAL; | 1751 | ssize_t ret = -EINVAL; |
1752 | int live_threshold; | 1752 | int live_threshold; |
1753 | 1753 | ||
@@ -1766,26 +1766,26 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1766 | if (fd < 0 || fd >= INT_MAX) | 1766 | if (fd < 0 || fd >= INT_MAX) |
1767 | goto out; | 1767 | goto out; |
1768 | 1768 | ||
1769 | filp = fget(fd); | 1769 | f = fdget(fd); |
1770 | if (filp == NULL) | 1770 | if (f.file == NULL) |
1771 | goto out; | 1771 | goto out; |
1772 | 1772 | ||
1773 | if (reg->hr_blocks == 0 || reg->hr_start_block == 0 || | 1773 | if (reg->hr_blocks == 0 || reg->hr_start_block == 0 || |
1774 | reg->hr_block_bytes == 0) | 1774 | reg->hr_block_bytes == 0) |
1775 | goto out; | 1775 | goto out2; |
1776 | 1776 | ||
1777 | inode = igrab(filp->f_mapping->host); | 1777 | inode = igrab(f.file->f_mapping->host); |
1778 | if (inode == NULL) | 1778 | if (inode == NULL) |
1779 | goto out; | 1779 | goto out2; |
1780 | 1780 | ||
1781 | if (!S_ISBLK(inode->i_mode)) | 1781 | if (!S_ISBLK(inode->i_mode)) |
1782 | goto out; | 1782 | goto out3; |
1783 | 1783 | ||
1784 | reg->hr_bdev = I_BDEV(filp->f_mapping->host); | 1784 | reg->hr_bdev = I_BDEV(f.file->f_mapping->host); |
1785 | ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ, NULL); | 1785 | ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ, NULL); |
1786 | if (ret) { | 1786 | if (ret) { |
1787 | reg->hr_bdev = NULL; | 1787 | reg->hr_bdev = NULL; |
1788 | goto out; | 1788 | goto out3; |
1789 | } | 1789 | } |
1790 | inode = NULL; | 1790 | inode = NULL; |
1791 | 1791 | ||
@@ -1797,7 +1797,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1797 | "blocksize %u incorrect for device, expected %d", | 1797 | "blocksize %u incorrect for device, expected %d", |
1798 | reg->hr_block_bytes, sectsize); | 1798 | reg->hr_block_bytes, sectsize); |
1799 | ret = -EINVAL; | 1799 | ret = -EINVAL; |
1800 | goto out; | 1800 | goto out3; |
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | o2hb_init_region_params(reg); | 1803 | o2hb_init_region_params(reg); |
@@ -1811,13 +1811,13 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1811 | ret = o2hb_map_slot_data(reg); | 1811 | ret = o2hb_map_slot_data(reg); |
1812 | if (ret) { | 1812 | if (ret) { |
1813 | mlog_errno(ret); | 1813 | mlog_errno(ret); |
1814 | goto out; | 1814 | goto out3; |
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | ret = o2hb_populate_slot_data(reg); | 1817 | ret = o2hb_populate_slot_data(reg); |
1818 | if (ret) { | 1818 | if (ret) { |
1819 | mlog_errno(ret); | 1819 | mlog_errno(ret); |
1820 | goto out; | 1820 | goto out3; |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | INIT_DELAYED_WORK(®->hr_write_timeout_work, o2hb_write_timeout); | 1823 | INIT_DELAYED_WORK(®->hr_write_timeout_work, o2hb_write_timeout); |
@@ -1847,7 +1847,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1847 | if (IS_ERR(hb_task)) { | 1847 | if (IS_ERR(hb_task)) { |
1848 | ret = PTR_ERR(hb_task); | 1848 | ret = PTR_ERR(hb_task); |
1849 | mlog_errno(ret); | 1849 | mlog_errno(ret); |
1850 | goto out; | 1850 | goto out3; |
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | spin_lock(&o2hb_live_lock); | 1853 | spin_lock(&o2hb_live_lock); |
@@ -1863,7 +1863,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1863 | 1863 | ||
1864 | if (reg->hr_aborted_start) { | 1864 | if (reg->hr_aborted_start) { |
1865 | ret = -EIO; | 1865 | ret = -EIO; |
1866 | goto out; | 1866 | goto out3; |
1867 | } | 1867 | } |
1868 | 1868 | ||
1869 | /* Ok, we were woken. Make sure it wasn't by drop_item() */ | 1869 | /* Ok, we were woken. Make sure it wasn't by drop_item() */ |
@@ -1882,11 +1882,11 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
1882 | printk(KERN_NOTICE "o2hb: Heartbeat started on region %s (%s)\n", | 1882 | printk(KERN_NOTICE "o2hb: Heartbeat started on region %s (%s)\n", |
1883 | config_item_name(®->hr_item), reg->hr_dev_name); | 1883 | config_item_name(®->hr_item), reg->hr_dev_name); |
1884 | 1884 | ||
1885 | out3: | ||
1886 | iput(inode); | ||
1887 | out2: | ||
1888 | fdput(f); | ||
1885 | out: | 1889 | out: |
1886 | if (filp) | ||
1887 | fput(filp); | ||
1888 | if (inode) | ||
1889 | iput(inode); | ||
1890 | if (ret < 0) { | 1890 | if (ret < 0) { |
1891 | if (reg->hr_bdev) { | 1891 | if (reg->hr_bdev) { |
1892 | blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); | 1892 | blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); |