From: huanghua Date: Thu, 3 Aug 2006 15:01:13 +0000 (+0000) Subject: fix: X-Git-Tag: v1_8_0_110~486^2~1288 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=fb5aa09a216bf45b00c937ccb19174ed5315e962;p=fs%2Flustre-release.git fix: (1) open smylink file; (2) mdt_recovery() should return error on un-connected export; (3) mdd_unlink permission check. --- diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index a7046f2..3430821 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -680,16 +680,22 @@ static int mdd_unlink(const struct lu_context *ctxt, struct md_object *pobj, struct mdd_object *mdd_pobj = md2mdd_obj(pobj); struct mdd_object *mdd_cobj = md2mdd_obj(cobj); struct dt_object *dt_cobj = mdd_object_child(mdd_cobj); - struct thandle *handle; + struct thandle *handle; + __u32 mode_copy = ma->ma_attr.la_mode; int rc; ENTRY; /* sanity checks */ - if (dt_try_as_dir(ctxt, dt_cobj)) { - if (!S_ISDIR(ma->ma_attr.la_mode)) - RETURN(rc = -EISDIR); - } else if (S_ISDIR(ma->ma_attr.la_mode)) - RETURN(rc = -ENOTDIR); + rc = mdd_attr_get(ctxt, cobj, ma); + if (rc == 0) { + if (S_ISDIR(ma->ma_attr.la_mode)) { + if (!S_ISDIR(mode_copy)) + rc = -EISDIR; + } else if (S_ISDIR(mode_copy)) + rc = -ENOTDIR; + } + if (rc != 0) + RETURN(rc); mdd_txn_param_build(ctxt, &MDD_TXN_UNLINK); handle = mdd_trans_start(ctxt, mdd); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index a4bf12c..f2dfabf 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1242,7 +1242,7 @@ static int mdt_recovery(struct ptlrpc_request *req) req->rq_reqmsg->opc, libcfs_id2str(req->rq_peer)); req->rq_status = -ENOTCONN; - RETURN(0); + RETURN(-ENOTCONN); } /* sanity check: if the xid matches, the request must be marked as a diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index fb75935..5ac05d8 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -103,21 +103,22 @@ static int mdt_mfd_open(struct mdt_thread_info *info, rc = mo_attr_get(info->mti_ctxt, mdt_object_child(o), ma); } if (rc == 0){ + if (ma->ma_valid & MA_INODE) + mdt_pack_attr2body(repbody, la, mdt_object_fid(o)); + if (!S_ISREG(la->la_mode) && !S_ISDIR(la->la_mode) && - (req->rq_export->exp_connect_flags & OBD_CONNECT_NODEVOH || - S_ISLNK(la->la_mode))) + (req->rq_export->exp_connect_flags & OBD_CONNECT_NODEVOH)) /* If client supports this, do not return open handle * for special nodes */ RETURN(0); + if ((S_ISREG(la->la_mode) || S_ISDIR(la->la_mode)) && !created && !(ma->ma_valid & MA_LOV)) { /*No EA, check whether it is will set regEA and dirEA *since in above attr get, these size might be zero, *so reset it, to retrieve the MD after create obj*/ - ma->ma_lmm_size = req_capsule_get_size(&info->mti_pill, - &RMF_MDT_MD, - RCL_SERVER); + LASSERT(p != NULL); rc = mdt_create_data_obj(info, p, o); if (rc) @@ -141,8 +142,6 @@ static int mdt_mfd_open(struct mdt_thread_info *info, repbody->eadatasize = 0; repbody->aclsize = 0; - if (ma->ma_valid & MA_INODE) - mdt_pack_attr2body(repbody, la, mdt_object_fid(o)); if (ma->ma_lmm_size && ma->ma_valid & MA_LOV) { repbody->eadatasize = ma->ma_lmm_size; if (S_ISDIR(la->la_mode))