From 75ad0b753f483f219234b3699567ed4cdc977f6d Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 15 Oct 2012 23:15:17 -0600 Subject: [PATCH] LU-2193 ofd: look up FID to destroy before locking If the MDS is replaying object destroys after recovery, then it may be trying to destroy non-existent objects. This can provoke spurious errors in lvbo_init() due to the inability to populate the lock LVB. Rather than quiet the useful error message from lvbo_init(), instead do the object lookup on the to-be-destroyed FID first. If lookup fails to find an object, skip the object locking entirely since it isn't needed and would just flood the console after recovery. During destroy RPCs from the MDS, the ELC buffer is always empty, so short-circuit the initial lock cancellation attempt that is useless. Signed-off-by: Andreas Dilger Change-Id: Id6197f23773ea271e0cb0912b19585b3df500c1e Reviewed-on: http://review.whamcloud.com/4276 Reviewed-by: Mike Pershin Reviewed-by: Alex Zhuravlev Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/ldlm/ldlm_lockd.c | 3 +++ lustre/ofd/ofd_obd.c | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index b38d854..8dcde3e 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1506,6 +1506,9 @@ int ldlm_request_cancel(struct ptlrpc_request *req, if (first >= count) RETURN(0); + if (count == 1 && dlm_req->lock_handle[0].cookie == 0) + RETURN(0); + /* There is no lock on the server at the replay time, * skip lock cancelling to make replay tests to pass. */ if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 80fe705..2a05f1d 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -951,6 +951,10 @@ static int ofd_destroy_by_fid(const struct lu_env *env, ENTRY; + fo = ofd_object_find(env, ofd, fid); + if (IS_ERR(fo)) + RETURN(PTR_ERR(fo)); + /* Tell the clients that the object is gone now and that they should * throw away any cached pages. */ ofd_build_resid(fid, &info->fti_resid); @@ -963,9 +967,6 @@ static int ofd_destroy_by_fid(const struct lu_env *env, if (rc == ELDLM_OK) ldlm_lock_decref(&lockh, LCK_PW); - fo = ofd_object_find(env, ofd, fid); - if (IS_ERR(fo)) - RETURN(PTR_ERR(fo)); LASSERT(fo != NULL); rc = ofd_object_destroy(env, fo, orphan); @@ -1013,14 +1014,15 @@ int ofd_destroy(const struct lu_env *env, struct obd_export *exp, lrc = ofd_destroy_by_fid(env, ofd, &info->fti_fid, 0); if (lrc == -ENOENT) { CDEBUG(D_INODE, - "destroying non-existent object "LPU64"\n", - oa->o_id); + "%s: destroying non-existent object "DFID"\n", + ofd_obd(ofd)->obd_name, PFID(&info->fti_fid)); /* rewrite rc with -ENOENT only if it is 0 */ if (rc == 0) rc = lrc; } else if (lrc != 0) { - CEMERG("error destroying object "LPU64": %d\n", - oa->o_id, rc); + CERROR("%s: error destroying object "DFID": %d\n", + ofd_obd(ofd)->obd_name, PFID(&info->fti_fid), + rc); rc = lrc; } count--; -- 1.8.3.1