Whamcloud - gitweb
LU-2911 llite: add obd_fid_init/fini() back to llite
authorEmoly Liu <emoly.liu@intel.com>
Fri, 15 Mar 2013 04:40:42 +0000 (12:40 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 21 Mar 2013 04:35:10 +0000 (00:35 -0400)
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:
[<ffffffffa0371895>] libcfs_debug_dumpstack+0x55/0x80 [libcfs]
[<ffffffffa0371e97>] lbug_with_loc+0x47/0xb0 [libcfs]
[<ffffffffa080bea9>] seq_client_alloc_fid+0x379/0x440 [fid]
[<ffffffffa03822e1>] ? libcfs_debug_msg+0x41/0x50 [libcfs]
[<ffffffffa082470b>] mdc_fid_alloc+0xbb/0xf0 [mdc]
[<ffffffffa0832b1c>] mdc_create+0xcc/0x780 [mdc]
[<ffffffffa09c487b>] ll_new_node+0x19b/0x6a0 [lustre]
[<ffffffffa09c50a7>] ll_mkdir+0x97/0x1f0 [lustre]

Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: I0eab1298b8d02ca08ecd4ac8bb422a2de12b7f83
Reviewed-on: http://review.whamcloud.com/5733
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Hudson
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/llite_lib.c

index 2c0a378..f8d5326 100644 (file)
@@ -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;
 
 
        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 */
        /* 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)
                        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.
 
        /* 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);
                                   "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);
        }
 
        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);
        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);
        }
 
        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);
        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  |
        }
 
         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;
 
 
        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;
        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);
        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));
        }
        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));
 
        }
        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)
 
        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;
 
        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);
        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,
        }
 
        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);
        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));
        }
 
         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_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_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;
 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);
 
 
         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.
         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);
 
 
         lprocfs_unregister_mountpoint(sbi);
 
+       obd_fid_fini(sbi->ll_md_exp->exp_obd);
         obd_disconnect(sbi->ll_md_exp);
         sbi->ll_md_exp = NULL;
 
         obd_disconnect(sbi->ll_md_exp);
         sbi->ll_md_exp = NULL;