- if (S_ISDIR(dt->do_lu.lo_header->loh_attr))
- return lo->ldo_dir_stripe_count != 0;
-
- if (lo->ldo_is_foreign)
- return false;
-
- for (i = 0; i < lo->ldo_comp_cnt; i++) {
- if (lo->ldo_comp_entries[i].llc_stripe == NULL)
- continue;
- LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0);
- return true;
+ mutex_lock(&lo->ldo_layout_mutex);
+
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+ rc = lo->ldo_dir_stripe_count != 0;
+ } else if (lo->ldo_is_foreign) {
+ rc = false;
+ } else {
+ for (i = 0; i < lo->ldo_comp_cnt; i++) {
+ if (lo->ldo_comp_entries[i].llc_stripe == NULL)
+ continue;
+ LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0);
+ rc = true;
+ break;
+ }