Skip to content

Commit

Permalink
ceph: Fix infinite loop in __wake_requests
Browse files Browse the repository at this point in the history
__wake_requests() will enter infinite loop if we use it to wake
requests in the session->s_waiting list. __wake_requests() deletes
requests from the list and __do_request() adds requests back to
the list.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Yan, Zheng authored and Alex Elder committed Dec 13, 2012
1 parent 5e62ad3 commit ed75ec2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,9 +1876,14 @@ static int __do_request(struct ceph_mds_client *mdsc,
static void __wake_requests(struct ceph_mds_client *mdsc,
struct list_head *head)
{
struct ceph_mds_request *req, *nreq;
struct ceph_mds_request *req;
LIST_HEAD(tmp_list);

list_splice_init(head, &tmp_list);

list_for_each_entry_safe(req, nreq, head, r_wait) {
while (!list_empty(&tmp_list)) {
req = list_entry(tmp_list.next,
struct ceph_mds_request, r_wait);
list_del_init(&req->r_wait);
__do_request(mdsc, req);
}
Expand Down

0 comments on commit ed75ec2

Please sign in to comment.