]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
libceph: make calc_target() set t->paused, not just clear it
authorIlya Dryomov <idryomov@gmail.com>
Mon, 5 Jan 2026 18:23:19 +0000 (19:23 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 5 Jan 2026 23:39:43 +0000 (00:39 +0100)
commitc0fe2994f9a9d0a2ec9e42441ea5ba74b6a16176
tree0b9e6a43fa7552c7336e1f98fa78cae65a22d54b
parent11194b416ef95012c2cfe5f546d71af07b639e93
libceph: make calc_target() set t->paused, not just clear it

Currently calc_target() clears t->paused if the request shouldn't be
paused anymore, but doesn't ever set t->paused even though it's able to
determine when the request should be paused.  Setting t->paused is left
to __submit_request() which is fine for regular requests but doesn't
work for linger requests -- since __submit_request() doesn't operate
on linger requests, there is nowhere for lreq->t.paused to be set.
One consequence of this is that watches don't get reestablished on
paused -> unpaused transitions in cases where requests have been paused
long enough for the (paused) unwatch request to time out and for the
subsequent (re)watch request to enter the paused state.  On top of the
watch not getting reestablished, rbd_reregister_watch() gets stuck with
rbd_dev->watch_mutex held:

  rbd_register_watch
    __rbd_register_watch
      ceph_osdc_watch
        linger_reg_commit_wait

It's waiting for lreq->reg_commit_wait to be completed, but for that to
happen the respective request needs to end up on need_resend_linger list
and be kicked when requests are unpaused.  There is no chance for that
if the request in question is never marked paused in the first place.

The fact that rbd_dev->watch_mutex remains taken out forever then
prevents the image from getting unmapped -- "rbd unmap" would inevitably
hang in D state on an attempt to grab the mutex.

Cc: stable@vger.kernel.org
Reported-by: Raphael Zimmer <raphael.zimmer@tu-ilmenau.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
net/ceph/osd_client.c