summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2012-11-19 10:49:06 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 08:51:21 -0800
commit42d519d12ef2d43a83b86cd2931c539045d07059 (patch)
tree684fc58b0dfb653ed59707404d96ac476b59e877
parent7ae7b557aaaf1d50f04706b775341957f12bab10 (diff)
downloadlinux-3.10-42d519d12ef2d43a83b86cd2931c539045d07059.tar.gz
linux-3.10-42d519d12ef2d43a83b86cd2931c539045d07059.tar.bz2
linux-3.10-42d519d12ef2d43a83b86cd2931c539045d07059.zip
ceph: Fix infinite loop in __wake_requests
__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> (cherry picked from commit ed75ec2cd19b47efcd292b6e23f58e56f4c5bc34) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/ceph/mds_client.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 95708dd092f..3fd08ad5c47 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1886,9 +1886,14 @@ finish:
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);
}