]> Pileus Git - ~andy/linux/commit
libceph: add lingering request reference when registered
authorAlex Elder <elder@inktank.com>
Thu, 23 May 2013 01:54:25 +0000 (20:54 -0500)
committerSage Weil <sage@inktank.com>
Wed, 3 Jul 2013 22:32:37 +0000 (15:32 -0700)
commit96e4dac66f69d28af2b736e723364efbbdf9fdee
treecc21efe7b885bf5ac276650e4d554aa705079412
parent6af8652849a15e407b458a271ef9154e472f6dd4
libceph: add lingering request reference when registered

When an osd request is set to linger, the osd client holds onto the
request so it can be re-submitted following certain osd map changes.
The osd client holds a reference to the request until it is
unregistered.  This is used by rbd for watch requests.

Currently, the reference is taken when the request is marked with
the linger flag.  This means that if an error occurs after that
time but before the the request completes successfully, that
reference is leaked.

There's really no reason to take the reference until the request is
registered in the the osd client's list of lingering requests, and
that only happens when the lingering (watch) request completes
successfully.

So take that reference only when it gets registered following
succesful completion, and drop it (as before) when the request
gets unregistered.  This avoids the reference problem on error
in rbd.

Rearrange ceph_osdc_unregister_linger_request() to avoid using
the request pointer after it may have been freed.

And hold an extra reference in kick_requests() while handling
a linger request that has not yet been registered, to ensure
it doesn't go away.

This resolves:
    http://tracker.ceph.com/issues/3859

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
net/ceph/osd_client.c