Whamcloud - gitweb
LU-10769 osd-zfs: fix deadlock on osd_object::oo_guard
There is race condition inside osd-zfs, it may cause deadlock.
Consider the following scenarios:
1) The Thread1 calls osd_attr_set() to set flags on the object.
The osd_attr_set() will call the osd_xattr_get() with holding
the read mode semaphore on the object::oo_guard.
2) The Thread2 calls the osd_declare_destroy() to destroy such
object, it will down_write() on the object::oo_gurad, but be
blocked by the Thread1's granted read mode semaphore.
3) The osd_xattr_get() triggered by the osd_xattr_set() will also
down_read() on the object::oo_guard. But it will be blocked by
the Thread2's pending down_write() request.
Then the Thread1 and the Thread2 deadlock.
This patch makes the osd_attr_set() to call the lockless version
xattr_get osd_xattr_get_internal() to avoid such deadlock.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Iaac2e414b5f1fd197303bb7ec7d5e2763b6f3e9a
Reviewed-on: https://review.whamcloud.com/31511
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>