diff options
author | Sage Weil <sage@newdream.net> | 2011-06-03 12:37:09 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-06-08 00:34:13 -0400 |
commit | 2584547230ae49b8de91ab3bb5e0a81898905b45 (patch) | |
tree | 1f00818bc7075e0898998d4e05c0cd08dd3d85d0 /net/ceph/osd_client.c | |
parent | 70b666c3b4cb2b96098d80e6f515e4bc6d37db5a (diff) |
ceph: fix sync vs canceled write
If we cancel a write, trigger the safe completions to prevent a sync from
blocking indefinitely in ceph_osdc_sync().
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r-- | net/ceph/osd_client.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 6ea2b892f44b..9cb627a4073a 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1144,6 +1144,13 @@ static void handle_osds_timeout(struct work_struct *work) | |||
1144 | round_jiffies_relative(delay)); | 1144 | round_jiffies_relative(delay)); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | static void complete_request(struct ceph_osd_request *req) | ||
1148 | { | ||
1149 | if (req->r_safe_callback) | ||
1150 | req->r_safe_callback(req, NULL); | ||
1151 | complete_all(&req->r_safe_completion); /* fsync waiter */ | ||
1152 | } | ||
1153 | |||
1147 | /* | 1154 | /* |
1148 | * handle osd op reply. either call the callback if it is specified, | 1155 | * handle osd op reply. either call the callback if it is specified, |
1149 | * or do the completion to wake up the waiting thread. | 1156 | * or do the completion to wake up the waiting thread. |
@@ -1226,11 +1233,8 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, | |||
1226 | else | 1233 | else |
1227 | complete_all(&req->r_completion); | 1234 | complete_all(&req->r_completion); |
1228 | 1235 | ||
1229 | if (flags & CEPH_OSD_FLAG_ONDISK) { | 1236 | if (flags & CEPH_OSD_FLAG_ONDISK) |
1230 | if (req->r_safe_callback) | 1237 | complete_request(req); |
1231 | req->r_safe_callback(req, msg); | ||
1232 | complete_all(&req->r_safe_completion); /* fsync waiter */ | ||
1233 | } | ||
1234 | 1238 | ||
1235 | done: | 1239 | done: |
1236 | dout("req=%p req->r_linger=%d\n", req, req->r_linger); | 1240 | dout("req=%p req->r_linger=%d\n", req, req->r_linger); |
@@ -1732,6 +1736,7 @@ int ceph_osdc_wait_request(struct ceph_osd_client *osdc, | |||
1732 | __cancel_request(req); | 1736 | __cancel_request(req); |
1733 | __unregister_request(osdc, req); | 1737 | __unregister_request(osdc, req); |
1734 | mutex_unlock(&osdc->request_mutex); | 1738 | mutex_unlock(&osdc->request_mutex); |
1739 | complete_request(req); | ||
1735 | dout("wait_request tid %llu canceled/timed out\n", req->r_tid); | 1740 | dout("wait_request tid %llu canceled/timed out\n", req->r_tid); |
1736 | return rc; | 1741 | return rc; |
1737 | } | 1742 | } |