Commit bee2d97b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client

Pull two ceph fixes from Sage Weil:
 "The first fixes a leak in the rbd setup error path, and the second
  fixes a more serious problem with mismatched kmap/kunmap that surfaced
  after the recent refactoring work."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  libceph: only kunmap kmapped pages
  rbd: drop dev reference on error in rbd_open()
parents 979570e0 5ce765a5
...@@ -246,13 +246,12 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) ...@@ -246,13 +246,12 @@ static int rbd_open(struct block_device *bdev, fmode_t mode)
{ {
struct rbd_device *rbd_dev = bdev->bd_disk->private_data; struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
rbd_get_dev(rbd_dev);
set_device_ro(bdev, rbd_dev->read_only);
if ((mode & FMODE_WRITE) && rbd_dev->read_only) if ((mode & FMODE_WRITE) && rbd_dev->read_only)
return -EROFS; return -EROFS;
rbd_get_dev(rbd_dev);
set_device_ro(bdev, rbd_dev->read_only);
return 0; return 0;
} }
......
...@@ -1073,16 +1073,13 @@ static int write_partial_msg_pages(struct ceph_connection *con) ...@@ -1073,16 +1073,13 @@ static int write_partial_msg_pages(struct ceph_connection *con)
BUG_ON(kaddr == NULL); BUG_ON(kaddr == NULL);
base = kaddr + con->out_msg_pos.page_pos + bio_offset; base = kaddr + con->out_msg_pos.page_pos + bio_offset;
crc = crc32c(crc, base, len); crc = crc32c(crc, base, len);
kunmap(page);
msg->footer.data_crc = cpu_to_le32(crc); msg->footer.data_crc = cpu_to_le32(crc);
con->out_msg_pos.did_page_crc = true; con->out_msg_pos.did_page_crc = true;
} }
ret = ceph_tcp_sendpage(con->sock, page, ret = ceph_tcp_sendpage(con->sock, page,
con->out_msg_pos.page_pos + bio_offset, con->out_msg_pos.page_pos + bio_offset,
len, 1); len, 1);
if (do_datacrc)
kunmap(page);
if (ret <= 0) if (ret <= 0)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment