From 883430534fde5adb06d601e2808cff83ca499984 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 24 Apr 2002 20:16:19 +0000 Subject: [PATCH] Add client RPC xid to per-client last_rcvd data. If the MDS dies but the client lives, the on-disk xid tells the client which operations the MDS has completed, even if the client never got a reply (hence no last_rcvd #). --- lustre/include/linux/lustre_mds.h | 11 ++++++----- lustre/mds/mds_reint.c | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index 3f4b4c2..4f9e3e3b 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -65,22 +65,23 @@ struct mds_update_record { #define MDS_MOUNT_RECOV 2 -/* Data stored per server at the head of the last_rcvd file */ +/* Data stored per server at the head of the last_rcvd file. In le32 order. */ struct mds_server_data { __u8 msd_uuid[37]; /* server UUID */ - __u8 uuid_padding[3]; + __u8 uuid_padding[3]; /* unused */ __u64 msd_last_rcvd; /* last completed transaction ID */ __u64 msd_mount_count; /* MDS incarnation number */ __u8 padding[512 - 56]; }; -/* Data stored per client in the last_rcvd file */ +/* Data stored per client in the last_rcvd file. In le32 order. */ struct mds_client_data { __u8 mcd_uuid[37]; /* client UUID */ - __u8 uuid_padding[3]; /* in case we decide to store UUIDs as ASCII */ + __u8 uuid_padding[3]; /* unused */ __u64 mcd_last_rcvd; /* last completed transaction ID */ __u64 mcd_mount_count; /* MDS incarnation number */ - __u8 padding[MDS_LR_SIZE - 56]; + __u32 mcd_xid; /* client RPC xid for the last transaction */ + __u8 padding[MDS_LR_SIZE - 60]; }; /* In-memory access to client data from MDS struct */ diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index d9c0dd2..a6bf9db 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -52,6 +52,7 @@ int mds_update_last_rcvd(struct mds_obd *mds, struct ptlrpc_request *req) ++mds->mds_last_rcvd; /* lock this, or make it an LDLM function? */ mci->mci_mcd->mcd_last_rcvd = cpu_to_le64(mds->mds_last_rcvd); mci->mci_mcd->mcd_mount_count = cpu_to_le64(mds->mds_mount_count); + mci->mci_mcd->mcd_xid = cpu_to_le32(req->rq_connection->c_xid_in); rc = lustre_fwrite(mds->mds_rcvd_filp, (char *)mci->mci_mcd, sizeof(*mci->mci_mcd), &off); CDEBUG(D_INODE, "wrote trans #%Ld for client '%s' at %Ld: rc = %d\n", -- 1.8.3.1