From: adilger Date: Tue, 1 Mar 2005 09:17:46 +0000 (+0000) Subject: Branch: b1_4 X-Git-Tag: v1_8_0_110~486^7~162 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b2037ee133dff12f63d7562ecc58f60ffe264b53;p=fs%2Flustre-release.git Branch: b1_4 Move the MDC EA/cookie max size initialization later in the mount process, until we have established our permanent connections. This avoids needless a bunch of client->OST connect+disconnect RPCs, and also fixes a bug where the client didn't get the reply for the first disconnect, and then hit a sanity check (target handle mismatch) on the server. This will tie in directly to the bug 5707 fix, as that will additionally store a "default" EA size to avoid allocating and sending a very large (and otherwise useless) request buffer, just to have a place to store the LOV EA for a MDS open replay. Includes regression test. b=5317 r=nathan (with minor fix to avoid the storage of lovdesc at all) --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 87e32a5..a2946fd 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -30,6 +30,7 @@ tbd Cluster File Systems, Inc. - small ext3 extents cleanups and fixes (5733) - improved mballoc code, several small races and bugs fixed (5733, 5638) - kernel version 43: fix remove_suid bugs in both 2.4 and 2.6 (5695) + - avoid needless client->OST connect, fix handle mismatch (5317) * miscellania - service request history (4965) - put {ll,lov,osc}_async_page structs in a single slab (4699) diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index 0ebde73..20843f5 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -185,10 +185,9 @@ int mdc_enqueue(struct obd_export *exp, void *cb_data); /* mdc/mdc_request.c */ -int mdc_init_ea_size(struct obd_device *obd, char *lov_name); +int mdc_init_ea_size(struct obd_export *mdc_exp, struct obd_export *lov_exp); int mdc_req2lustre_md(struct ptlrpc_request *req, int offset, - struct obd_export *exp, - struct lustre_md *md); + struct obd_export *exp, struct lustre_md *md); int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid); int mdc_getattr(struct obd_export *exp, struct ll_fid *fid, unsigned long valid, unsigned int ea_size, diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 17665b7..2fb9c66 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -156,6 +156,7 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) class_import_put(imp); cli->cl_import = imp; + /* cli->cl_max_mds_{easize,cookiesize} updated by mdc_init_ea_size() */ cli->cl_max_mds_easize = sizeof(struct lov_mds_md); cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); cli->cl_sandev = to_kdev_t(0); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index cc58ec5..1186004 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -1345,9 +1345,6 @@ llu_fsswop_mount(const char *source, GOTO(out_free, err = -EINVAL); } - if (mdc_init_ea_size(obd, osc)) - GOTO(out_free, err = -EINVAL); - /* setup mdc */ err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid); if (err) { @@ -1378,6 +1375,8 @@ llu_fsswop_mount(const char *source, } sbi->ll_osc_exp = class_conn2export(&osc_conn); + mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); + err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid); if (err) { CERROR("cannot mds_connect: rc = %d\n", err); diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index c19e289..f29f732 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -41,7 +41,7 @@ static void ll_release(struct dentry *de) ENTRY; LASSERT(de != NULL); lld = ll_d2d(de); - if (lld == NULL) { + if (lld == NULL) { /* NFS copies the de->d_op methods (bug 4655) */ EXIT; return; } diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 7c73b6b..9086073 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -121,8 +121,6 @@ int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc) CERROR("could not register mount in /proc/lustre"); } - mdc_init_ea_size(obd, osc); - err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid); if (err == -EBUSY) { CERROR("An MDS (mdc %s) is performing recovery, of which this" @@ -169,6 +167,8 @@ int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc) } sbi->ll_osc_exp = class_conn2export(&osc_conn); + mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); + if (!ll_async_page_slab) { ll_async_page_slab_size = size_round(sizeof(struct ll_async_page)) + diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 42faae7..ad0f9bd 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -648,7 +648,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, case OBD_IOC_LLOG_PRINT: { ctxt = llog_get_context(obd, LLOG_CONFIG_REPL_CTXT); rc = llog_ioctl(ctxt, cmd, data); - + GOTO(out, rc); } #endif @@ -913,39 +913,35 @@ err_rpc_lock: RETURN(rc); } -int mdc_init_ea_size(struct obd_device *obd, char *lov_name) +/* Initialize the maximum LOV EA and cookie sizes. This allows + * us to make MDS RPCs with large enough reply buffers to hold the + * maximum-sized (= maximum striped) EA and cookie without having to + * calculate this (via a call into the LOV + OSCs) each time we make an RPC. */ +int mdc_init_ea_size(struct obd_export *mdc_exp, struct obd_export *lov_exp) { + struct obd_device *obd = mdc_exp->exp_obd; struct client_obd *cli = &obd->u.cli; - struct obd_device *lov_obd; - struct obd_export *exp; - struct lustre_handle conn; + struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC }; struct lov_desc desc; - int valsize; - int rc; - - lov_obd = class_name2obd(lov_name); - if (!lov_obd) { - CERROR("MDC cannot locate LOV %s!\n", lov_name); - RETURN(-ENOTCONN); - } + __u32 valsize = sizeof(desc); + int rc, size; + ENTRY; - rc = obd_connect(&conn, lov_obd, &obd->obd_uuid); - if (rc) { - CERROR("MDC failed connect to LOV %s (%d)\n", lov_name, rc); + rc = obd_get_info(lov_exp, strlen("lovdesc") + 1, "lovdesc", + &valsize, &desc); + if (rc < 0) RETURN(rc); - } - exp = class_conn2export(&conn); - valsize = sizeof(desc); - rc = obd_get_info(exp, strlen("lovdesc") + 1, "lovdesc", - &valsize, &desc); - if (rc == 0) { - cli->cl_max_mds_easize = obd_size_diskmd(exp, NULL); - cli->cl_max_mds_cookiesize = desc.ld_tgt_count * - sizeof(struct llog_cookie); - } - obd_disconnect(exp, 0); - RETURN(rc); + lsm.lsm_stripe_count = desc.ld_tgt_count; + size = obd_size_diskmd(lov_exp, &lsm); + if (cli->cl_max_mds_easize < size) + cli->cl_max_mds_easize = size; + + size = desc.ld_tgt_count * sizeof(struct llog_cookie); + if (cli->cl_max_mds_cookiesize < size) + cli->cl_max_mds_cookiesize = size; + + RETURN(0); } static int mdc_precleanup(struct obd_device *obd, int flags) diff --git a/lustre/tests/replay-ost-single.sh b/lustre/tests/replay-ost-single.sh index 8088d1b..da1f2a9 100755 --- a/lustre/tests/replay-ost-single.sh +++ b/lustre/tests/replay-ost-single.sh @@ -56,7 +56,16 @@ setup() { start ost --reformat $OSTLCONFARGS [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE start mds --reformat $MDSLCONFARGS - grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT + + if [ -z "`grep " $MOUNT " /proc/mounts`" ]; then + # test "-1" needed during initial client->OST connection + log "== test 00: target handle mismatch (bug 5317) === `date +%H:%M:%S`" + + #define OBD_FAIL_OST_ALL_REPLY_NET 0x211 + do_facet ost "sysctl -w lustre.fail_loc=0x80000211" + + zconf_mount `hostname` $MOUNT && df $MOUNT && pass || error "mount fail" + fi } mkdir -p $DIR