From: Mikhail Pershin Date: Thu, 22 Sep 2011 13:53:38 +0000 (+0400) Subject: LU-672 MRP-213 don't panic on geting version for non existent fid X-Git-Tag: 2.1.52~33 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c70afdcb058adebfd517540e72185403a09a126b;p=fs%2Flustre-release.git LU-672 MRP-213 don't panic on geting version for non existent fid lctl getobjversion can be called for a file which was removed from MDT, but exists in cache. That producea a assert on mdd code: LustreError: 20825:0:(mdd_object.c:2474:mdd_version_get()) ASSERTION(mdd_object_exists(mdd_obj)) failed Author: Alexey Lyashkov Signed-off-by: Mikhail Pershin Change-Id: I7442e7aee26736741482c158ee3713df9796c953 Reviewed-on: http://review.whamcloud.com/1365 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index ae21d70..4e035cd 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -832,6 +832,7 @@ int lu_object_invariant(const struct lu_object *o); /** * \retval 1 iff object \a o exists on stable storage, + * \retval 0 iff object \a o not exists on stable storage. * \retval -1 iff object \a o is on remote server. */ static inline int lu_object_exists(const struct lu_object *o) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 8a1f9d4..d911e69 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5462,6 +5462,7 @@ static int mdt_ioc_version_get(struct mdt_thread_info *mti, void *karg) struct mdt_lock_handle *lh; int rc; ENTRY; + CDEBUG(D_IOCTL, "getting version for "DFID"\n", PFID(fid)); if (!fid_is_sane(fid)) RETURN(-EINVAL); @@ -5481,6 +5482,9 @@ static int mdt_ioc_version_get(struct mdt_thread_info *mti, void *karg) * fid, this is error to find remote object here */ CERROR("nonlocal object "DFID"\n", PFID(fid)); + } else if (rc == 0) { + *(__u64 *)data->ioc_inlbuf2 = ENOENT_VERSION; + rc = -ENOENT; } else { version = mo_version_get(mti->mti_env, mdt_object_child(obj)); *(__u64 *)data->ioc_inlbuf2 = version; diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh index 1aecf89..e25ffee 100644 --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -93,6 +93,24 @@ get_version() { cos_param_file=$TMP/rvbr-cos-params save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $cos_param_file +test_0a() { + get_version $CLIENT1 $DIR/$tdir/1a || true +} +run_test 0a "getversion for non existent file shouldn't cause kernel panic" + +test_0b() { + local var=${SINGLEMDS}_svc + local fid + local file=$DIR/$tdir/f + + do_node $CLIENT1 mkdir -p $DIR/$tdir/ + do_node $CLIENT1 touch $file + fid=$(do_node $CLIENT1 $LFS path2fid $file) + do_node $CLIENT1 rm -rf $file + do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true +} +run_test 0b "getversion for non existent fid shouldn't cause kernel panic" + # test set #1: OPEN test_1a() { # former test_0a local file=$DIR/$tfile