From c6898866c8c30938cdbcc8dc07ae63057fcae78d Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 18 May 2006 22:44:21 +0000 Subject: [PATCH] b=9860 r=adilger(hld) cleaner compatibility story with common last_rcvd --- lustre/include/lustre_disk.h | 3 +-- lustre/mds/mds_fs.c | 19 +++++++------------ lustre/obdfilter/filter.c | 25 ++++++------------------- lustre/utils/mkfs_lustre.c | 8 ++------ 4 files changed, 16 insertions(+), 39 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 76ac76b..0e2323e 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -168,7 +168,6 @@ struct lustre_mount_data { /* COMPAT_146 */ #define OBD_COMPAT_OST 0x00000002 /* this is an OST (temporary) */ #define OBD_COMPAT_MDT 0x00000004 /* this is an MDT (temporary) */ -#define OBD_COMPAT_COMMON_LR 0x00000008 /* Dual last_rcvd format (temp) */ /* end COMPAT_146 */ #define OBD_ROCOMPAT_LOVOBJID 0x00000001 /* MDS handles LOV_OBJID file */ @@ -185,7 +184,7 @@ struct lustre_mount_data { struct lr_server_data { __u8 lsd_uuid[40]; /* server UUID */ __u64 lsd_last_transno; /* last completed transaction ID */ - __u64 lsd_compat146; /* reserved - compat with old last_rcvd */ + __u64 lsd_compat14; /* reserved - compat with old last_rcvd */ __u64 lsd_mount_count; /* incarnation number */ __u32 lsd_feature_compat; /* compatible feature flags */ __u32 lsd_feature_rocompat;/* read-only compatible feature flags */ diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 09ebe8c..b3215c4 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -245,10 +245,7 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) lsd->lsd_client_start = cpu_to_le32(LR_CLIENT_START); lsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE); lsd->lsd_feature_rocompat = cpu_to_le32(OBD_ROCOMPAT_LOVOBJID); - lsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_MDT | - OBD_INCOMPAT_COMMON_LR); - /* See note in filter_init_server_data */ - lsd->lsd_feature_compat = cpu_to_le32(OBD_COMPAT_COMMON_LR); + lsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_MDT); } else { rc = fsfilt_read_record(obd, file, lsd, sizeof(*lsd), &off); if (rc) { @@ -262,15 +259,13 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) obd->obd_uuid.uuid, lsd->lsd_uuid); GOTO(err_msd, rc = -EINVAL); } - mount_count = le64_to_cpu(lsd->lsd_mount_count); /* COMPAT_146 */ - if (!(lsd->lsd_feature_compat & - cpu_to_le32(OBD_COMPAT_COMMON_LR))){ - /* mount count was not stored in the correct spot */ - CDEBUG(D_WARNING, "using old last_rcvd format\n"); - mount_count = le64_to_cpu(lsd->lsd_compat146); - } + /* Assume old last_rcvd format unless I_C_LR is set */ + if (!(lsd->lsd_feature_incompat & + cpu_to_le32(OBD_INCOMPAT_COMMON_LR))) + lsd->lsd_mount_count = lsd->lsd_compat14; /* end COMPAT_146 */ + mount_count = le64_to_cpu(lsd->lsd_mount_count); } if (lsd->lsd_feature_incompat & ~cpu_to_le32(MDT_INCOMPAT_SUPP)) { @@ -402,7 +397,7 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) } mds->mds_mount_count = mount_count + 1; - lsd->lsd_mount_count = lsd->lsd_compat146 = + lsd->lsd_mount_count = lsd->lsd_compat14 = cpu_to_le64(mds->mds_mount_count); /* save it, so mount count and last_transno is current */ diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index eafa3ac..8ec0231 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -330,7 +330,7 @@ int filter_update_server_data(struct obd_device *obd, struct file *filp, CDEBUG(D_INODE, "server last_mount: "LPU64"\n", le64_to_cpu(fsd->lsd_mount_count)); - fsd->lsd_compat146 = fsd->lsd_last_transno; + fsd->lsd_compat14 = fsd->lsd_last_transno; rc = fsfilt_write_record(obd, filp, fsd, sizeof(*fsd), &off,force_sync); if (rc) CERROR("error writing lr_server_data: rc = %d\n", rc); @@ -406,18 +406,7 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) fsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE); fsd->lsd_subdir_count = cpu_to_le16(FILTER_SUBDIR_COUNT); filter->fo_subdir_count = FILTER_SUBDIR_COUNT; - fsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_OST | - OBD_INCOMPAT_COMMON_LR); - /* If we start with 1.6, downgrade to something that doesn't - understand COMPAT_COMMON_LR (< 1.4.7), and then re-upgrade, - last_transno will be out of sync. We prevent this - by setting OBD_INCOMPAT_COMMON_LR, so old versions - simply are not able to run. - Note that we don't set OBD_COMPAT_COMMON_LR for an - upgraded fs, meaning that we assume the old format, and - we always write out a old-compatible format, so upgrades - and downgrades of old fs's should always be fine. */ - fsd->lsd_feature_compat = cpu_to_le32(OBD_COMPAT_COMMON_LR); + fsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_OST); } else { rc = fsfilt_read_record(obd, filp, fsd, sizeof(*fsd), &off); if (rc) { @@ -435,12 +424,10 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) mount_count = le64_to_cpu(fsd->lsd_mount_count); filter->fo_subdir_count = le16_to_cpu(fsd->lsd_subdir_count); /* COMPAT_146 */ - if (!(fsd->lsd_feature_compat & - cpu_to_le32(OBD_COMPAT_COMMON_LR))){ - /* last_transno was not stored in the correct spot */ - CDEBUG(D_WARNING, "using old last_rcvd format\n"); - fsd->lsd_last_transno = fsd->lsd_compat146; - } + /* Assume old last_rcvd format unless I_C_LR is set */ + if (!(fsd->lsd_feature_incompat & + cpu_to_le32(OBD_INCOMPAT_COMMON_LR))) + fsd->lsd_last_transno = fsd->lsd_compat14; /* end COMPAT_146 */ } diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 5ad2713..43dec1d 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -636,11 +636,7 @@ int write_local_files(struct mkfs_opts *mop) char cmd[128]; char *term; vprint("Copying old logs\n"); -#if 0 - /* Generate new client log as servers upgrade. Starting a new - client may end up with short lov's, so will be degraded - until all servers upgrade */ -#else + /* Copy the old client log to fsname-client */ sprintf(filepnm, "%s/%s/%s-client", mntpt, MOUNT_CONFIGS_DIR, mop->mo_ldd.ldd_fsname); @@ -659,7 +655,7 @@ int write_local_files(struct mkfs_opts *mop) mop->mo_ldd.ldd_fsname); goto out_umnt; } -#endif + /* We need to use the old mdt log because otherwise mdt won't have complete lov if old clients connect before all servers upgrade. */ -- 1.8.3.1