libceph: make ceph_osdc_put_request() accept NULL
authorIlya Dryomov <idryomov@gmail.com>
Tue, 26 Apr 2016 13:05:29 +0000 (15:05 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 25 May 2016 22:36:20 +0000 (00:36 +0200)
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/addr.c
net/ceph/osd_client.c

index 4801571f51cb4e7461d8d1f9f8f3136fb6713fbc..3e61fc8bb371029d2feede9f9599f195fd618142 100644 (file)
@@ -1099,8 +1099,7 @@ release_pvec_pages:
                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;
@@ -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;
index 40a53a70efdffe89085f4cfce89f8d59c5420521..cacce9e35f08fa18e74fc76bbcc38ecab5bb0181 100644 (file)
@@ -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);