Skip to content

Commit

Permalink
libceph: make ceph_osdc_put_request() accept NULL
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
idryomov committed May 25, 2016
1 parent 663ae2c commit 3ed97d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 3 additions & 6 deletions fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,7 @@ static int ceph_writepages_start(struct address_space *mapping,
mapping->writeback_index = index;

out:
if (req)
ceph_osdc_put_request(req);
ceph_osdc_put_request(req);
ceph_put_snap_context(snapc);
dout("writepages done, rc = %d\n", rc);
return rc;
Expand Down Expand Up @@ -1824,10 +1823,8 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, u32 pool)
out_unlock:
up_write(&mdsc->pool_perm_rwsem);

if (rd_req)
ceph_osdc_put_request(rd_req);
if (wr_req)
ceph_osdc_put_request(wr_req);
ceph_osdc_put_request(rd_req);
ceph_osdc_put_request(wr_req);
out:
if (!err)
err = have;
Expand Down
8 changes: 5 additions & 3 deletions net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ EXPORT_SYMBOL(ceph_osdc_get_request);

void ceph_osdc_put_request(struct ceph_osd_request *req)
{
dout("%s %p (was %d)\n", __func__, req,
atomic_read(&req->r_kref.refcount));
kref_put(&req->r_kref, ceph_osdc_release_request);
if (req) {
dout("%s %p (was %d)\n", __func__, req,
atomic_read(&req->r_kref.refcount));
kref_put(&req->r_kref, ceph_osdc_release_request);
}
}
EXPORT_SYMBOL(ceph_osdc_put_request);

Expand Down

0 comments on commit 3ed97d6

Please sign in to comment.