Whamcloud - gitweb
LU-13935 ofd: object removal is not handled properly 65/39765/3
authorAndrew Perepechko <andrew.perepechko@hpe.com>
Mon, 31 Aug 2020 08:49:59 +0000 (11:49 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 25 Sep 2020 03:13:15 +0000 (03:13 +0000)
We should not check for object existence in
ofd_version_get_check() when we haven't got the lock yet.
ofd_attr_set() will check it later.

In ofd_destroy(), we should unlock if the object
does not exist, otherwise oti_w_locks assertion will fail.

Change-Id: I00f67d15c3268bcf55aafa88c088f2dbf55a470c
Signed-off-by: Andrew Perepechko <andrew.perepechko@hpe.com>
HPE-bug-id: LUS-9063,LUS-9282
Reviewed-on: https://review.whamcloud.com/39765
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ofd/ofd_objects.c

index 4982a49..f99d86b 100644 (file)
@@ -64,8 +64,6 @@ static int ofd_version_get_check(struct ofd_thread_info *info,
 {
        dt_obj_version_t curr_version;
 
 {
        dt_obj_version_t curr_version;
 
-       LASSERT(ofd_object_exists(fo));
-
        if (info->fti_exp == NULL)
                RETURN(0);
 
        if (info->fti_exp == NULL)
                RETURN(0);
 
@@ -1021,14 +1019,14 @@ int ofd_destroy(const struct lu_env *env, struct ofd_object *fo,
 
        ofd_write_lock(env, fo);
        if (!ofd_object_exists(fo))
 
        ofd_write_lock(env, fo);
        if (!ofd_object_exists(fo))
-               GOTO(stop, rc = -ENOENT);
+               GOTO(unlock, rc = -ENOENT);
 
        tgt_fmd_drop(ofd_info(env)->fti_exp, &fo->ofo_header.loh_fid);
 
        dt_ref_del(env, ofd_object_child(fo), th);
        dt_destroy(env, ofd_object_child(fo), th);
 
        tgt_fmd_drop(ofd_info(env)->fti_exp, &fo->ofo_header.loh_fid);
 
        dt_ref_del(env, ofd_object_child(fo), th);
        dt_destroy(env, ofd_object_child(fo), th);
+unlock:
        ofd_write_unlock(env, fo);
        ofd_write_unlock(env, fo);
-
 stop:
        rc2 = ofd_trans_stop(env, ofd, th, rc);
        if (rc2)
 stop:
        rc2 = ofd_trans_stop(env, ofd, th, rc);
        if (rc2)