Whamcloud - gitweb
- Add hooks for post-replay fixup on ptlrpc_request.
authorshaver <shaver>
Sat, 7 Sep 2002 21:19:48 +0000 (21:19 +0000)
committershaver <shaver>
Sat, 7 Sep 2002 21:19:48 +0000 (21:19 +0000)
- 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
lustre/mdc/mdc_request.c
lustre/ptlrpc/client.c

index 94a3136..6f24c60 100644 (file)
@@ -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 {
index c881645..2c23133 100644 (file)
@@ -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;
index c2f2c46..04143e3 100644 (file)
@@ -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);
 }