Whamcloud - gitweb
LU-8319 fid: fix race in fid allocation
There is race condition when allocating fid/seq in parallel
as following:
The thread1 will release the lcs_mutex via seq_fid_alloc_prep(),
then another fid allocation thread2 can obtain the lcs_mutex and
allocate FID in the new sequence that has just been allocated by
the thread1 via seq_client_alloc_seq(); and then after thread2
released the lcs_mutex, the thread1 will re-allocate the current
FID in the new sequence without checking whether some others have
already taken such FID in the new sequence during it re-obtaining
the lcs_mutex.
Such race will cause two objects to use the same FID, and trigger
OI conflict and LMA verification failures.
This patch makes the fid allocation and lu_client_seq modification
to be protected by the lcs_mutex.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I79c250f57b73d0abd7d039eea02424ae438f1b56
Reviewed-on: http://review.whamcloud.com/20939
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>