Whamcloud - gitweb
LU-2258 mount: solve races between evict and umount
authorHiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Fri, 2 Nov 2012 09:11:23 +0000 (18:11 +0900)
committerOleg Drokin <green@whamcloud.com>
Mon, 3 Dec 2012 02:52:53 +0000 (21:52 -0500)
commit4bbbcfa12b82704d14c389feecdfe81a50af467d
tree175447a0b35cbc694a119cef14ab10bfdc00c610
parent682f3e19473b91f6face2567513b25a7b6d3fc24
LU-2258 mount: solve races between evict and umount

There are two race conditions between evict and umount.

1) The one is that obd_export_evict_by_xxx() can touch a lustre hash
which has already been finalized but not unregistered yet.

2) The other is that the class_decref() in lprocfs_wr_evict_client()
can call lprocfs_remove() via osc_cleanup() while having _lprocfs_lock
already. That's why this case ends up in a deadlock.

This patch solve these problems with the below solutions.
- see if obd_nid_hash and obd_uuid_hash is still available when
  evicting.
- move class_incref() to below LPROCFS_EXIT() and class_decref()
  before LPROCFS_ENTRY() in order to avoid dead-locking

Signed-off-by: Hiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Change-Id: I2cc19a88ffd6a230ab115bc1e4b9d31fbbbb4615
Reviewed-on: http://review.whamcloud.com/4444
Tested-by: Hudson
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/genops.c
lustre/ptlrpc/lproc_ptlrpc.c