From 49f641010da57717383475f2aa4b3b05b36220f5 Mon Sep 17 00:00:00 2001 From: tappro Date: Sat, 18 Jul 2009 08:10:16 +0000 Subject: [PATCH] Branch b1_8 b=19885 i=adilger i=shadow Handle downgrade case from 2.0 to 1.8 and evict all client in case of it --- lustre/include/lustre_disk.h | 2 ++ lustre/mds/mds_fs.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 1e55a80..19092ea 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -198,6 +198,8 @@ struct lustre_mount_data { #define OBD_COMPAT_OST 0x00000002 /* this is an OST (temporary) */ #define OBD_COMPAT_MDT 0x00000004 /* this is an MDT (temporary) */ /* end COMPAT_146 */ +/* interop flag to show server 20 was used */ +#define OBD_COMPAT_20 0x00000008 #define OBD_ROCOMPAT_LOVOBJID 0x00000001 /* MDS handles LOV_OBJID file */ #define OBD_ROCOMPAT_CROW 0x00000002 /* OST will CROW create objects */ diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index a48a69c..c69228e 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -497,6 +497,7 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) lsd->lsd_server_size = cpu_to_le32(LR_SERVER_SIZE); lsd->lsd_client_start = cpu_to_le32(LR_CLIENT_START); lsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE); + lsd->lsd_feature_compat = cpu_to_le32(OBD_COMPAT_MDT); lsd->lsd_feature_rocompat = cpu_to_le32(OBD_ROCOMPAT_LOVOBJID); lsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_MDT); } else { @@ -512,6 +513,7 @@ 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); } + lsd->lsd_feature_compat |= cpu_to_le32(OBD_COMPAT_MDT); /* COMPAT_146 */ /* Assume old last_rcvd format unless I_C_LR is set */ if (!(lsd->lsd_feature_incompat & @@ -534,8 +536,16 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) /* Do something like remount filesystem read-only */ GOTO(err_msd, rc = -EINVAL); } - - lsd->lsd_feature_compat = cpu_to_le32(OBD_COMPAT_MDT); + /* evict all clients as it is first boot with 2.0 last_rcvd */ + if (lsd->lsd_feature_compat & cpu_to_le32(OBD_COMPAT_20)) { + LCONSOLE_WARN("Mounting %s at first time on 2.0 FS, remove all" + " clients for interop needs\n", obd->obd_name); + simple_truncate(mds->mds_vfsmnt->mnt_sb->s_root, + mds->mds_vfsmnt, LAST_RCVD, + lsd->lsd_client_start); + last_rcvd_size = lsd->lsd_client_start; + lsd->lsd_feature_compat &= ~cpu_to_le32(OBD_COMPAT_20); + } target_trans_table_init(obd); mds->mds_last_transno = le64_to_cpu(lsd->lsd_last_transno); -- 1.8.3.1