From 042c045e24756b074007e960a1eb2f1405eb3e6c Mon Sep 17 00:00:00 2001 From: Emoly Liu Date: Fri, 15 Mar 2013 12:40:42 +0800 Subject: [PATCH] LU-2911 llite: add obd_fid_init/fini() back to llite If without obd_fid_init() in llite, when filesystem is upgraded from branch 1.8 to 2.4, obd_fid_init() in lmv won't be triggered because of no lmv in branch 1.8 based config log. This will cause LBUG during running mkdir after upgrade, like seq_client_alloc_fid()) ASSERTION( seq != ((void *)0) ) failed. seq_client_alloc_fid()) LBUG Call Trace: [] libcfs_debug_dumpstack+0x55/0x80 [libcfs] [] lbug_with_loc+0x47/0xb0 [libcfs] [] seq_client_alloc_fid+0x379/0x440 [fid] [] ? libcfs_debug_msg+0x41/0x50 [libcfs] [] mdc_fid_alloc+0xbb/0xf0 [mdc] [] mdc_create+0xcc/0x780 [mdc] [] ll_new_node+0x19b/0x6a0 [lustre] [] ll_mkdir+0x97/0x1f0 [lustre] Signed-off-by: Liu Ying Change-Id: I0eab1298b8d02ca08ecd4ac8bb422a2de12b7f83 Reviewed-on: http://review.whamcloud.com/5733 Reviewed-by: wangdi Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Tested-by: Hudson Reviewed-by: Oleg Drokin --- lustre/llite/llite_lib.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 2c0a378..f8d5326 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -280,6 +280,14 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, sbi->ll_md_exp->exp_connect_data = *data; + err = obd_fid_init(sbi->ll_md_exp->exp_obd, sbi->ll_md_exp, + LUSTRE_SEQ_METADATA); + if (err) { + CERROR("%s: Can't init metadata layer FID infrastructure, " + "rc = %d\n", sbi->ll_md_exp->exp_obd->obd_name, err); + GOTO(out_md, err); + } + /* For mount, we only need fs info from MDT0, and also in DNE, it * can make sure the client can be mounted as long as MDT0 is * avaible */ @@ -287,7 +295,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_FOR_MDT0); if (err) - GOTO(out_md, err); + GOTO(out_md_fid, err); /* This needs to be after statfs to ensure connect has finished. * Note that "data" does NOT contain the valid connect reply. @@ -310,7 +318,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, "server or downgrade client.\n", sbi->ll_md_exp->exp_obd->obd_name, buf); OBD_FREE(buf, CFS_PAGE_SIZE); - GOTO(out_md, err = -EPROTO); + GOTO(out_md_fid, err = -EPROTO); } size = sizeof(*data); @@ -319,7 +327,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, if (err) { CERROR("%s: Get connect data failed: rc = %d\n", sbi->ll_md_exp->exp_obd->obd_name, err); - GOTO(out_md, err); + GOTO(out_md_fid, err); } LASSERT(osfs->os_bsize); @@ -389,7 +397,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, obd = class_name2obd(dt); if (!obd) { CERROR("DT %s: not setup or attached\n", dt); - GOTO(out_md, err = -ENODEV); + GOTO(out_md_fid, err = -ENODEV); } data->ocd_connect_flags = OBD_CONNECT_GRANT | OBD_CONNECT_VERSION | @@ -451,6 +459,14 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, sbi->ll_dt_exp->exp_connect_data = *data; + err = obd_fid_init(sbi->ll_dt_exp->exp_obd, sbi->ll_dt_exp, + LUSTRE_SEQ_METADATA); + if (err) { + CERROR("%s: Can't init data layer FID infrastructure, " + "rc = %d\n", sbi->ll_dt_exp->exp_obd->obd_name, err); + GOTO(out_dt, err); + } + mutex_lock(&sbi->ll_lco.lco_lock); sbi->ll_lco.lco_flags = data->ocd_connect_flags; sbi->ll_lco.lco_md_exp = sbi->ll_md_exp; @@ -461,13 +477,13 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc); if (err) { CERROR("cannot mds_connect: rc = %d\n", err); - GOTO(out_dt, err); + GOTO(out_lock_cn_cb, err); } if (!fid_is_sane(&sbi->ll_root_fid)) { CERROR("%s: Invalid root fid "DFID" during mount\n", sbi->ll_md_exp->exp_obd->obd_name, PFID(&sbi->ll_root_fid)); - GOTO(out_dt, err = -EINVAL); + GOTO(out_lock_cn_cb, err = -EINVAL); } CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid)); @@ -486,7 +502,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, OBD_ALLOC_PTR(op_data); if (op_data == NULL) - GOTO(out_dt, err = -ENOMEM); + GOTO(out_lock_cn_cb, err = -ENOMEM); op_data->op_fid1 = sbi->ll_root_fid; op_data->op_mode = 0; @@ -500,7 +516,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, if (err) { CERROR("%s: md_getattr failed for root: rc = %d\n", sbi->ll_md_exp->exp_obd->obd_name, err); - GOTO(out_dt, err); + GOTO(out_lock_cn_cb, err); } err = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp, @@ -508,7 +524,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, if (err) { CERROR("failed to understand root inode md: rc = %d\n", err); ptlrpc_req_finished(request); - GOTO(out_dt, err); + GOTO(out_lock_cn_cb, err); } LASSERT(fid_is_sane(&sbi->ll_root_fid)); @@ -589,11 +605,15 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, out_root: if (root) iput(root); +out_lock_cn_cb: + obd_fid_fini(sbi->ll_dt_exp->exp_obd); out_dt: obd_disconnect(sbi->ll_dt_exp); sbi->ll_dt_exp = NULL; /* Make sure all OScs are gone, since cl_cache is accessing sbi. */ obd_zombie_barrier(); +out_md_fid: + obd_fid_fini(sbi->ll_md_exp->exp_obd); out_md: obd_disconnect(sbi->ll_md_exp); sbi->ll_md_exp = NULL; @@ -681,6 +701,7 @@ void client_common_put_super(struct super_block *sb) cfs_list_del(&sbi->ll_conn_chain); + obd_fid_fini(sbi->ll_dt_exp->exp_obd); obd_disconnect(sbi->ll_dt_exp); sbi->ll_dt_exp = NULL; /* wait till all OSCs are gone, since cl_cache is accessing sbi. @@ -689,6 +710,7 @@ void client_common_put_super(struct super_block *sb) lprocfs_unregister_mountpoint(sbi); + obd_fid_fini(sbi->ll_md_exp->exp_obd); obd_disconnect(sbi->ll_md_exp); sbi->ll_md_exp = NULL; -- 1.8.3.1