From 69defb9176a261cf3c0d2fcf1b5188158ec7110c Mon Sep 17 00:00:00 2001 From: shaver Date: Sat, 7 Sep 2002 21:19:48 +0000 Subject: [PATCH] - Add hooks for post-replay fixup on ptlrpc_request. - Use those hooks to update fh data in client filehandles when replaying open. Recovery can now failover to a standby/rebooted MDS and complete a file write, attr-update and close successfully. HAND. --- lustre/include/linux/lustre_net.h | 3 +++ lustre/mdc/mdc_request.c | 14 ++++++++++++++ lustre/ptlrpc/client.c | 3 +++ 3 files changed, 20 insertions(+) diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 94a3136..6f24c60 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -134,6 +134,9 @@ struct ptlrpc_request { struct ptlrpc_connection *rq_connection; struct obd_import *rq_import; struct ptlrpc_service *rq_svc; + + void (*rq_replay_cb)(struct ptlrpc_request *, void *); + void *rq_replay_cb_data; }; struct ptlrpc_bulk_page { diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index c881645..2c23133 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -337,6 +337,16 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type, RETURN(0); } +static void mdc_replay_open(struct ptlrpc_request *req, void *data) +{ + __u64 *fh = data; + struct mds_body *body; + + body = lustre_msg_buf(req->rq_repmsg, 0); + mds_unpack_body(body); + *fh = body->extra; +} + int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags, struct lov_stripe_md *smd, __u64 cookie, __u64 *fh, struct ptlrpc_request **request) @@ -376,6 +386,10 @@ int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags, *fh = body->extra; } + /* If open is replayed, we need to fix up the fh. */ + req->rq_replay_cb = mdc_replay_open; + req->rq_replay_cb_data = fh; + EXIT; out: *request = req; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index c2f2c46..04143e3 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -634,6 +634,9 @@ int ptlrpc_replay_req(struct ptlrpc_request *req) LBUG(); } + if (req->rq_replay_cb) + req->rq_replay_cb(req, req->rq_replay_cb_data); + out: RETURN(rc); } -- 1.8.3.1