From a349c41cb881f07e903fb407330fa92502700588 Mon Sep 17 00:00:00 2001 From: fanyong Date: Fri, 11 Sep 2009 16:33:50 +0000 Subject: [PATCH] Branch b1_8 b=20082 i=pravin.shelar i=robert.read 1) for clear orphan case when MDS recovery, we should not care whether "precreate" succeed or not, we can just ignore such error (either ENOSPC or ETIMEDOUT), and let the succedent create operation to process the real no space case. 2) code cleanup --- lustre/llite/statahead.c | 24 ++++++++++-------------- lustre/osc/osc_create.c | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 685635f..70bb52e 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -453,9 +453,7 @@ static int do_statahead_interpret(struct ll_statahead_info *sai) spin_lock(&dcache_lock); lock_dentry(dentry); __d_drop(dentry); -#ifdef DCACHE_LUSTRE_INVALID dentry->d_flags &= ~DCACHE_LUSTRE_INVALID; -#endif unlock_dentry(dentry); d_rehash_cond(dentry, 0); spin_unlock(&dcache_lock); @@ -660,11 +658,7 @@ static int ll_statahead_one(struct dentry *parent, struct ll_dir_entry *de) int rc; ENTRY; -#ifdef DCACHE_LUSTRE_INVALID if (parent->d_flags & DCACHE_LUSTRE_INVALID) { -#else - if (d_unhashed(parent)) { -#endif CDEBUG(D_READA, "parent dentry@%p %.*s is " "invalid, skip statahead\n", parent, parent->d_name.len, parent->d_name.name); @@ -982,11 +976,14 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) continue; } - if (d_name->len == de->lde_name_len && - !strncmp(d_name->name, de->lde_name, d_name->len)) - rc = LS_FIRST_DE + dot_de; - else + if (d_name->len != de->lde_name_len || + strncmp(d_name->name, de->lde_name, d_name->len) != 0) rc = LS_NONE_FIRST_DE; + else if (!dot_de) + rc = LS_FIRST_DE; + else + rc = LS_FIRST_DOT_DE; + ll_put_page(page); RETURN(rc); } @@ -1109,12 +1106,11 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, int lookup) /* get parent reference count here, and put it in ll_statahead_thread */ parent = dget((*dentryp)->d_parent); if (unlikely(sai->sai_inode != parent->d_inode)) { - struct ll_inode_info *nlli = ll_i2info(parent->d_inode); - CWARN("Race condition, someone changed %.*s just now: " "old parent "DFID", new parent "DFID" .\n", (*dentryp)->d_name.len, (*dentryp)->d_name.name, - PFID(&lli->lli_fid), PFID(&nlli->lli_fid)); + PFID(ll_inode_lu_fid(dir)), + PFID(ll_inode_lu_fid(parent->d_inode))); dput(parent); iput(sai->sai_inode); OBD_FREE_PTR(sai); @@ -1183,7 +1179,7 @@ void ll_statahead_exit(struct inode *dir, struct dentry *dentry, int result) CDEBUG(D_READA, "Statahead for dir "DFID" hit ratio " "too low: hit/miss %u/%u, sent/replied %u/%u, " "stopping statahead thread: pid %d\n", - PFID(&lli->lli_fid), sai->sai_hit, + PFID(ll_inode_lu_fid(dir)), sai->sai_hit, sai->sai_miss, sai->sai_sent, sai->sai_replied, cfs_curproc_pid()); spin_lock(&lli->lli_lock); diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index 7cf3d8f..8f5af52 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -510,7 +510,7 @@ int osc_create(struct obd_export *exp, struct obdo *oa, { struct lov_stripe_md *lsm; struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc; - int rc = 0; + int del_orphan = 0, rc = 0; ENTRY; LASSERT(oa); @@ -525,7 +525,7 @@ int osc_create(struct obd_export *exp, struct obdo *oa, } /* this is the special case where create removes orphans */ - if ((oa->o_valid & OBD_MD_FLFLAGS) && + if (oa->o_valid & OBD_MD_FLFLAGS && oa->o_flags == OBD_FL_DELORPHAN) { spin_lock(&oscc->oscc_lock); if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS) { @@ -545,6 +545,8 @@ int osc_create(struct obd_export *exp, struct obdo *oa, CDEBUG(D_HA, "%s: oscc recovery started - delete to "LPU64"\n", oscc->oscc_obd->obd_name, oscc->oscc_next_id - 1); + del_orphan = 1; + /* delete from next_id on up */ oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP; oa->o_id = oscc->oscc_next_id - 1; @@ -640,11 +642,16 @@ int osc_create(struct obd_export *exp, struct obdo *oa, spin_unlock(&oscc->oscc_lock); } - if (rc == 0) + if (rc == 0) { CDEBUG(D_INFO, "%s: returning objid "LPU64"\n", obd2cli_tgt(oscc->oscc_obd), lsm->lsm_object_id); - else if (*ea == NULL) - obd_free_memmd(exp, &lsm); + } else { + if (*ea == NULL) + obd_free_memmd(exp, &lsm); + if (del_orphan != 0 && rc != -EIO) + /* Ignore non-IO precreate error for clear orphan */ + rc = 0; + } RETURN(rc); } -- 1.8.3.1