Whamcloud - gitweb
LU-14733 o2iblnd: Move racy NULL assignment 95/44295/4
authorOriginal Author Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Wed, 7 Jul 2021 19:16:00 +0000 (15:16 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Sun, 14 Nov 2021 03:06:47 +0000 (03:06 +0000)
commit380be07fcca1f76564d1f29e58f2d8d5f8f530c8
treeb3726e77bde6bc4f960d31f54e249e40710182d9
parent20624f3a031525bb6bd19c9b1a1288eb05235670
LU-14733 o2iblnd: Move racy NULL assignment

kiblnd_fmr_pool_unmap() can race map and subsequent processing
because of this flaw in unmap:

if (frd) {
frd->frd_valid = false;
spin_lock(&fps->fps_lock);
list_add_tail(&frd->frd_list, &fpo->fast_reg.fpo_pool_list);
spin_unlock(&fps->fps_lock);
fmr->fmr_frd = NULL;
}

The fmr can be pulled off the list in kiblnd_fmr_pool_unmap() on
another CPU an fmr_frd could be in a state of flux and
potentially be seen incorrectly later on as the kib_tx is processed.

Fix my moving the fmr_frd assignment to before the fmr is added to the
list.

Lustre-change: https://review.whamcloud.com/44189
Lustre-commit: 023113fb8946f3565529e7327fdcd90ab9db3ba3
Test-Parameters: fortestonly testgroup=review-dne-zfs-part-1

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Change-Id: Ibddf132a363ecfe9db3cc06287cec873c021d2fb
Signed-off-by: Gian-Carlo DeFazio <defazio1@llnl.gov>
Reviewed-on: https://review.whamcloud.com/44295
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lnet/klnds/o2iblnd/o2iblnd.c