diff options
author | Sage Weil <sage@newdream.net> | 2009-12-22 14:24:33 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-23 11:17:22 -0500 |
commit | 6df058c025ce343052c5516b1d8a9a7e73cddd64 (patch) | |
tree | 58230bd258f71c2c3adf56a55d11ed39f404d12a /fs/ceph/caps.c | |
parent | 0cf90ab5b075821940873e73cdbfeb8edc3dabe8 (diff) |
ceph: include transaction id in ceph_msg_header (protocol change)
Many (most?) message types include a transaction id. By including it in
the fixed size header, we always have it available even when we are unable
to allocate memory for the (larger, variable sized) message body. This
will allow us to error out the appropriate request instead of (silently)
dropping the reply.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 93c1afe3f0b3..847ae64346fe 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -922,14 +922,14 @@ static int send_cap_msg(struct ceph_mds_session *session, | |||
922 | if (IS_ERR(msg)) | 922 | if (IS_ERR(msg)) |
923 | return PTR_ERR(msg); | 923 | return PTR_ERR(msg); |
924 | 924 | ||
925 | fc = msg->front.iov_base; | 925 | msg->hdr.tid = cpu_to_le64(flush_tid); |
926 | 926 | ||
927 | fc = msg->front.iov_base; | ||
927 | memset(fc, 0, sizeof(*fc)); | 928 | memset(fc, 0, sizeof(*fc)); |
928 | 929 | ||
929 | fc->cap_id = cpu_to_le64(cid); | 930 | fc->cap_id = cpu_to_le64(cid); |
930 | fc->op = cpu_to_le32(op); | 931 | fc->op = cpu_to_le32(op); |
931 | fc->seq = cpu_to_le32(seq); | 932 | fc->seq = cpu_to_le32(seq); |
932 | fc->client_tid = cpu_to_le64(flush_tid); | ||
933 | fc->issue_seq = cpu_to_le32(issue_seq); | 933 | fc->issue_seq = cpu_to_le32(issue_seq); |
934 | fc->migrate_seq = cpu_to_le32(mseq); | 934 | fc->migrate_seq = cpu_to_le32(mseq); |
935 | fc->caps = cpu_to_le32(caps); | 935 | fc->caps = cpu_to_le32(caps); |
@@ -2329,7 +2329,7 @@ restart: | |||
2329 | * Handle FLUSH_ACK from MDS, indicating that metadata we sent to the | 2329 | * Handle FLUSH_ACK from MDS, indicating that metadata we sent to the |
2330 | * MDS has been safely committed. | 2330 | * MDS has been safely committed. |
2331 | */ | 2331 | */ |
2332 | static void handle_cap_flush_ack(struct inode *inode, | 2332 | static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, |
2333 | struct ceph_mds_caps *m, | 2333 | struct ceph_mds_caps *m, |
2334 | struct ceph_mds_session *session, | 2334 | struct ceph_mds_session *session, |
2335 | struct ceph_cap *cap) | 2335 | struct ceph_cap *cap) |
@@ -2340,7 +2340,6 @@ static void handle_cap_flush_ack(struct inode *inode, | |||
2340 | unsigned seq = le32_to_cpu(m->seq); | 2340 | unsigned seq = le32_to_cpu(m->seq); |
2341 | int dirty = le32_to_cpu(m->dirty); | 2341 | int dirty = le32_to_cpu(m->dirty); |
2342 | int cleaned = 0; | 2342 | int cleaned = 0; |
2343 | u64 flush_tid = le64_to_cpu(m->client_tid); | ||
2344 | int drop = 0; | 2343 | int drop = 0; |
2345 | int i; | 2344 | int i; |
2346 | 2345 | ||
@@ -2396,13 +2395,12 @@ out: | |||
2396 | * | 2395 | * |
2397 | * Caller hold s_mutex. | 2396 | * Caller hold s_mutex. |
2398 | */ | 2397 | */ |
2399 | static void handle_cap_flushsnap_ack(struct inode *inode, | 2398 | static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, |
2400 | struct ceph_mds_caps *m, | 2399 | struct ceph_mds_caps *m, |
2401 | struct ceph_mds_session *session) | 2400 | struct ceph_mds_session *session) |
2402 | { | 2401 | { |
2403 | struct ceph_inode_info *ci = ceph_inode(inode); | 2402 | struct ceph_inode_info *ci = ceph_inode(inode); |
2404 | u64 follows = le64_to_cpu(m->snap_follows); | 2403 | u64 follows = le64_to_cpu(m->snap_follows); |
2405 | u64 flush_tid = le64_to_cpu(m->client_tid); | ||
2406 | struct ceph_cap_snap *capsnap; | 2404 | struct ceph_cap_snap *capsnap; |
2407 | int drop = 0; | 2405 | int drop = 0; |
2408 | 2406 | ||
@@ -2587,12 +2585,14 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2587 | struct ceph_vino vino; | 2585 | struct ceph_vino vino; |
2588 | u64 cap_id; | 2586 | u64 cap_id; |
2589 | u64 size, max_size; | 2587 | u64 size, max_size; |
2588 | u64 tid; | ||
2590 | int check_caps = 0; | 2589 | int check_caps = 0; |
2591 | int r; | 2590 | int r; |
2592 | 2591 | ||
2593 | dout("handle_caps from mds%d\n", mds); | 2592 | dout("handle_caps from mds%d\n", mds); |
2594 | 2593 | ||
2595 | /* decode */ | 2594 | /* decode */ |
2595 | tid = le64_to_cpu(msg->hdr.tid); | ||
2596 | if (msg->front.iov_len < sizeof(*h)) | 2596 | if (msg->front.iov_len < sizeof(*h)) |
2597 | goto bad; | 2597 | goto bad; |
2598 | h = msg->front.iov_base; | 2598 | h = msg->front.iov_base; |
@@ -2621,7 +2621,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2621 | /* these will work even if we don't have a cap yet */ | 2621 | /* these will work even if we don't have a cap yet */ |
2622 | switch (op) { | 2622 | switch (op) { |
2623 | case CEPH_CAP_OP_FLUSHSNAP_ACK: | 2623 | case CEPH_CAP_OP_FLUSHSNAP_ACK: |
2624 | handle_cap_flushsnap_ack(inode, h, session); | 2624 | handle_cap_flushsnap_ack(inode, tid, h, session); |
2625 | goto done; | 2625 | goto done; |
2626 | 2626 | ||
2627 | case CEPH_CAP_OP_EXPORT: | 2627 | case CEPH_CAP_OP_EXPORT: |
@@ -2662,7 +2662,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2662 | break; | 2662 | break; |
2663 | 2663 | ||
2664 | case CEPH_CAP_OP_FLUSH_ACK: | 2664 | case CEPH_CAP_OP_FLUSH_ACK: |
2665 | handle_cap_flush_ack(inode, h, session, cap); | 2665 | handle_cap_flush_ack(inode, tid, h, session, cap); |
2666 | break; | 2666 | break; |
2667 | 2667 | ||
2668 | case CEPH_CAP_OP_TRUNC: | 2668 | case CEPH_CAP_OP_TRUNC: |