@@ -492,6 +492,7 @@ extern char obd_jobid_var[];
#define OBD_FAIL_LLITE_XATTR_PAUSE 0x1420
#define OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE 0x1421
#define OBD_FAIL_LLITE_READPAGE_PAUSE 0x1422
+#define OBD_FAIL_LLITE_PANIC_ON_ESTALE 0x1423
#define OBD_FAIL_FID_INDIR 0x1501
#define OBD_FAIL_FID_INLMA 0x1502
@@ -115,6 +115,10 @@ static void vvp_vmpage_error(struct inode *inode, struct page *vmpage,
obj->vob_discard_page_warned = 0;
} else {
SetPageError(vmpage);
+ if (ioret != -ENOSPC &&
+ OBD_FAIL_CHECK(OBD_FAIL_LLITE_PANIC_ON_ESTALE))
+ LBUG();
+
mapping_set_error(inode->i_mapping, ioret);
if ((ioret == -ESHUTDOWN || ioret == -EINTR ||
@@ -1370,6 +1370,24 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj,
LASSERT(conf->coc_opc == OBJECT_CONF_SET);
+ /*
+ * don't apply old layouts which can be brought
+ * if returned w/o ldlm lock.
+ * XXX: can we rollback in case of recovery?
+ */
+ if (lsm && lov->lo_lsm) {
+ u32 oldgen = lov->lo_lsm->lsm_layout_gen &= ~LU_LAYOUT_RESYNC;
+ u32 newgen = lsm->lsm_layout_gen & ~LU_LAYOUT_RESYNC;
+
+ if (newgen < oldgen) {
+ CDEBUG(D_HA, "skip old for "DFID": %d < %d\n",
+ PFID(lu_object_fid(lov2lu(lov))),
+ (int)newgen, (int)oldgen);
+ result = 0;
+ goto out;
+ }
+ }
+
if ((!lsm && !lov->lo_lsm) ||
((lsm && lov->lo_lsm) &&
(lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen) &&