Whamcloud - gitweb
LU-13087 target: init lcd last transno from reply data 60/37060/2
authorMikhail Pershin <mpershin@whamcloud.com>
Thu, 5 Dec 2019 21:23:01 +0000 (00:23 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 10 Jan 2020 07:40:27 +0000 (07:40 +0000)
Init lcd_last_transno value from reply data to keep it
valid so tgt_release_reply_data() will keep a slot with
the highest transno and on-disk data is not lost.

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: Id31b3b250616fb6afd3d145c31b12af30ac86be8
Reviewed-on: https://review.whamcloud.com/37060
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/target/tgt_lastrcvd.c

index 398a60a..dbce02f 100644 (file)
@@ -1959,7 +1959,6 @@ int tgt_reply_data_init(const struct lu_env *env, struct lu_target *tgt)
        unsigned long            reply_data_size;
        int                      rc;
        struct lsd_reply_header *lrh = NULL;
-       struct lsd_client_data  *lcd = NULL;
        struct tg_reply_data    *trd = NULL;
        int                      idx;
        loff_t                   off;
@@ -2008,10 +2007,6 @@ int tgt_reply_data_init(const struct lu_env *env, struct lu_target *tgt)
                if (hash == NULL)
                        GOTO(out, rc = -ENODEV);
 
-               OBD_ALLOC_PTR(lcd);
-               if (lcd == NULL)
-                       GOTO(out, rc = -ENOMEM);
-
                OBD_ALLOC_PTR(trd);
                if (trd == NULL)
                        GOTO(out, rc = -ENOMEM);
@@ -2063,6 +2058,13 @@ int tgt_reply_data_init(const struct lu_env *env, struct lu_target *tgt)
                        /* update export last committed transation */
                        exp->exp_last_committed = max(exp->exp_last_committed,
                                                      lrd->lrd_transno);
+                       /* Update lcd_last_transno as well for check in
+                        * tgt_release_reply_data() or the latest client
+                        * transno can be lost.
+                        */
+                       ted->ted_lcd->lcd_last_transno =
+                               max(ted->ted_lcd->lcd_last_transno,
+                                   exp->exp_last_committed);
 
                        mutex_unlock(&ted->ted_lcd_lock);
                        class_export_put(exp);
@@ -2094,8 +2096,6 @@ int tgt_reply_data_init(const struct lu_env *env, struct lu_target *tgt)
 out:
        if (hash != NULL)
                cfs_hash_putref(hash);
-       if (lcd != NULL)
-               OBD_FREE_PTR(lcd);
        if (trd != NULL)
                OBD_FREE_PTR(trd);
        if (lrh != NULL)