Whamcloud - gitweb
LU-14543 target: prevent overflowing of tgd->tgd_tot_granted 90/45490/2
authorVladimir Saveliev <vlaidimir.saveliev@hpe.com>
Fri, 19 Mar 2021 12:08:47 +0000 (15:08 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 17 Nov 2021 18:44:29 +0000 (18:44 +0000)
commit5cbc184fbc10fd3d6c23ec3b8b687ffb34a64138
tree93f6108a16332500cd4fa509d8713c18378a9385
parent372c77f0a11573e9f8818751c24735e151aafc74
LU-14543 target: prevent overflowing of tgd->tgd_tot_granted

If tgd->tgd_tot_granted < ted->ted_grant then there should not be:
   tgd->tgd_tot_granted -= ted->ted_grant;
which breaks tgd->tgd_tot_granted.
In case of obvious ted->ted_grant damage, recalculate
tgd->tgd_tot_granted using list of exports.

The same change is made for tgd->tgd_tot_dirty.

This patch also adds sanity check for exp->exp_target_data.ted_grant
increase in tgt_grant_alloc() to catch grant counting corruption as
soon as it happened.

Lustre-change: https://review.whamcloud.com/45474
Lustre-commit: bb5d81ea95502fb5709e176b561b70aa5280ee07

Fixes: af2d3ac30e ("LU-11939 tgt: Do not assert during grant cleanup")
Change-Id: I36ba7496f7b72b4881e98c06ec254a8eefd4c13f
Signed-off-by: Vladimir Saveliev <vlaidimir.saveliev@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45490
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/lu_target.h
lustre/target/tgt_grant.c
lustre/tests/test-framework.sh