Whamcloud - gitweb
LU-8165 target: detect race by checking last_rcvd slot index 28/20328/2
authorBruno Faccini <bruno.faccini@intel.com>
Thu, 19 May 2016 15:04:39 +0000 (17:04 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 10 Sep 2016 03:23:45 +0000 (03:23 +0000)
A race can occur on Server during Client connection and
concurent eviction, when Client's last_rcvd slot index has still
not been assigned (-1).
This patch adds a check to address such condition.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: Ifead82719a0dc9411f1b79d6c8c59eb9ef339fa5
Reviewed-on: http://review.whamcloud.com/20328
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Grégoire Pichon <gregoire.pichon@bull.net>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/target/tgt_lastrcvd.c

index bb3c07d..8b98d61 100644 (file)
@@ -1049,6 +1049,14 @@ int tgt_client_del(const struct lu_env *env, struct obd_export *exp)
            exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT)
                RETURN(0);
 
            exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT)
                RETURN(0);
 
+       /* Slot may be not yet assigned, use case is race between Client
+        * reconnect and forced eviction */
+       if (ted->ted_lr_idx < 0) {
+               CWARN("%s: client with UUID '%s' not in bitmap\n",
+                     tgt->lut_obd->obd_name, ted->ted_lcd->lcd_uuid);
+               RETURN(0);
+       }
+
        CDEBUG(D_INFO, "%s: del client at idx %u, off %lld, UUID '%s'\n",
               tgt->lut_obd->obd_name, ted->ted_lr_idx, ted->ted_lr_off,
               ted->ted_lcd->lcd_uuid);
        CDEBUG(D_INFO, "%s: del client at idx %u, off %lld, UUID '%s'\n",
               tgt->lut_obd->obd_name, ted->ted_lr_idx, ted->ted_lr_off,
               ted->ted_lcd->lcd_uuid);