Whamcloud - gitweb
LU-10040 nodemap: add nodemap idmap correctly
There are 3 situations when adding an idmap {id_client:id_fs} to
a nodemap tree:
- both id_client and id_fs are matched, that means this idmap
already exists, so return -EEXIT;
- neither id_client nor id_fs is matched, that means this is a
new idmap, so insert it;
- only "id_client" or "id_fs" is matched, since idmap uses
"id_client" as index key, we need to delete that old idmap and
its index by its id_client, and then insert it again. In the
original implementation, idmap_insert() calls rb_replace_node()
to replace the old idmap without re-sorting its both id_client
and id_fs, so that this new added idmap can't be found by
idmap_search() due to its wrong left and right nodes, and can't
be deleted either.
Also, this patch improves the following code:
- nm_idmap_lock: use type rw_semaphore instead of rwlock, because
nodemap_idx_idmap_del() may sleep on FS operations while this
lock is being held.
- Add "update_idmaps" to sanity-sec.sh test_15 to verify this fix,
and improve other part of this test case as well to make it run
correctly.
Test-Parameters: testlist=sanity-sec
Signed-off-by: Stephan Thiell <sthiell@stanford.edu>
Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Change-Id: Icf777f14c2e1dd56fa5cd0eb56666240e206d199
Reviewed-on: https://review.whamcloud.com/29364
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>