From 585e779324a8ca2acb89c083aee639fb315c3a47 Mon Sep 17 00:00:00 2001 From: shadow Date: Wed, 15 Jul 2009 18:47:01 +0000 Subject: [PATCH] correctly shrink reply for avoid send too big message to client. Branch b_release_1_8_1 b=20020 i=adilger i=tappro --- lustre/ChangeLog | 7 +++++++ lustre/mds/handler.c | 13 ++++++++++--- lustre/mds/mds_open.c | 8 +++++++- lustre/mds/mds_reint.c | 22 ++++++++++++++-------- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 740bf27..3c39964 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -14,6 +14,13 @@ more information, please refer to bugzilla 17630. Severity : normal +Frequency : with 1.8 server and 1.6 clients +Bugzilla : 20020 +Descriptoin: correctly shrink reply for avoid send too big message to client. +Details : 1.8 mds is allocate to big buffer to LOV EA data and this produce + some problems with sending this reply to 1.6 client. + +Severity : normal Bugzilla : 19917 Description: Repeated atomic allocation failures. Details : Use GFP_HIGHUSER | __GFP_NOMEMALLOC flags for memory allocations diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 94662267..92f1432 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1084,6 +1084,10 @@ static int mds_getattr_lock(struct ptlrpc_request *req, int offset, req->rq_status = rc; } } + + if (rc) + lustre_shrink_reply(req, offset + 1, 0 , 1); + return rc; } @@ -1119,13 +1123,12 @@ static int mds_getattr(struct ptlrpc_request *req, int offset) rc = mds_getattr_pack_msg(req, de->d_inode, offset); if (rc != 0) { CERROR("mds_getattr_pack_msg: %d\n", rc); - GOTO(out_pop, rc); + GOTO(out_dput, rc); } req->rq_status = mds_getattr_internal(obd, de, req, body,REPLY_REC_OFF); - +out_dput: l_dput(de); - GOTO(out_pop, rc); out_pop: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc); out_ucred: @@ -1136,6 +1139,10 @@ out_ucred: req->rq_status = rc; } mds_exit_ucred(&uc, mds); + + if (rc) + lustre_shrink_reply(req, REPLY_REC_OFF + 1, 0, 1); + return rc; } diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 0c5a565..41480df 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -822,6 +822,8 @@ static int mds_finish_open(struct ptlrpc_request *req, struct dentry *dchild, if (rc) { CERROR("mds_create_objects: rc = %d\n", rc); UNLOCK_INODE_MUTEX(dchild->d_inode); + lustre_shrink_reply(req, DLM_REPLY_REC_OFF + 1, + 0, 1); RETURN(rc); } } @@ -1024,6 +1026,7 @@ int mds_open(struct mds_update_record *rec, int offset, int quota_pending[2] = {0, 0}; int use_parent, need_open_lock; unsigned int gid = current->fsgid; + int finish = 0; ENTRY; mds_counter_incr(req->rq_export, LPROC_MDS_OPEN); @@ -1376,7 +1379,7 @@ found_child: * special device nodes */ GOTO(cleanup_no_trans, rc = 0); } - + finish = 1; /* Step 5: mds_open it */ rc = mds_finish_open(req, dchild, body, rec->ur_flags, &handle, rec, rep, &parent_lockh); @@ -1428,6 +1431,9 @@ found_child: else ptlrpc_save_lock(req, &parent_lockh, parent_mode); } + if (!finish) + mds_shrink_reply(obd, req, body, DLM_REPLY_REC_OFF + 1); + /* trigger dqacq on the owner of child and parent */ lquota_adjust(mds_quota_interface_ref, obd, qcids, qpids, rc, FSFILT_OP_CREATE); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index c6b019e..fbc77c0 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -1793,15 +1793,21 @@ void mds_shrink_reply(struct obd_device *obd, struct ptlrpc_request *req, { int cookie_size = 0, md_size = 0; - if (body && body->valid & OBD_MD_FLEASIZE) { - md_size = body->eadatasize; - } - if (body && body->valid & OBD_MD_FLCOOKIE) { - LASSERT(body->valid & OBD_MD_FLEASIZE); - cookie_size = mds_get_cookie_size(obd, lustre_msg_buf( - req->rq_repmsg, md_off, 0)); + if (body) { + if (body->valid & (OBD_MD_FLEASIZE | OBD_MD_FLDIREA)) { + md_size = body->eadatasize; + } else if (body->valid & OBD_MD_LINKNAME) + md_size = body->eadatasize; + + if (body->valid & OBD_MD_FLCOOKIE) { + LASSERT(body->valid & OBD_MD_FLEASIZE); + cookie_size = mds_get_cookie_size(obd, lustre_msg_buf( + req->rq_repmsg, + md_off, 0)); + } else if (body->valid & OBD_MD_FLACL) { + cookie_size = body->aclsize; + } } - CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n", md_size, cookie_size); -- 1.8.3.1