#define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
#define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
#define OBD_FAIL_MDS_LLOG_CREATE_FAILED2 0x15b
+#define OBD_FAIL_MDS_INTENT_DELAY 0x160
/* layout lock */
#define OBD_FAIL_MDS_NO_LL_GETATTR 0x170
#define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214
#define OBD_FAIL_OST_ENOSPC 0x215
#define OBD_FAIL_OST_EROFS 0x216
-#define OBD_FAIL_OST_ENOENT 0x217
+#define OBD_FAIL_SRV_ENOENT 0x217
/* OBD_FAIL_OST_QUOTACHECK_NET 0x218 obsolete since 2.4 */
#define OBD_FAIL_OST_QUOTACTL_NET 0x219
#define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a
}
*flags |= LDLM_FL_LOCK_CHANGED;
RETURN(0);
+ } else if (rc != ELDLM_OK &&
+ lock->l_req_mode == lock->l_granted_mode) {
+ LASSERT(*flags & LDLM_FL_RESENT);
+ /* It may happen that ns_policy returns an error in
+ * resend case, object may be unlinked or just some
+ * error occurs. It is unclear if lock reached the
+ * client in the original reply, just leave the lock on
+ * server, not returning it again to client. Due to
+ * LU-6529, the server will not OOM. */
+ RETURN(rc);
} else if (rc != ELDLM_OK ||
(rc == ELDLM_OK && (*flags & LDLM_FL_INTENT_ONLY))) {
ldlm_lock_destroy(lock);
}
}
- if (rc != 0) {
+ if (rc != 0 && !(flags & LDLM_FL_RESENT)) {
if (lock->l_export) {
ldlm_lock_cancel(lock);
} else {
GOTO(out_parent, rc = PTR_ERR(child));
OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_RESEND, obd_timeout * 2);
+ if (!mdt_object_exists(child)) {
+ LU_OBJECT_DEBUG(D_INODE, info->mti_env,
+ &child->mot_obj,
+ "Object doesn't exist!\n");
+ GOTO(out_child, rc = -ENOENT);
+ }
+
rc = mdt_check_resent_lock(info, child, lhc);
if (rc < 0) {
GOTO(out_child, rc);
mdt_lock_reg_init(lhc, LCK_PR);
try_layout = false;
- if (!mdt_object_exists(child)) {
- LU_OBJECT_DEBUG(D_INODE, info->mti_env,
- &child->mot_obj,
- "Object doesn't exist!\n");
- GOTO(out_child, rc = -ENOENT);
- }
-
if (!(child_bits & MDS_INODELOCK_UPDATE) &&
mdt_object_exists(child) && !mdt_object_remote(child)) {
struct md_attr *ma = &info->mti_attr;
if (flv->it_act != NULL) {
struct ldlm_reply *rep;
+ OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_INTENT_DELAY, 10);
+
/* execute policy */
rc = flv->it_act(opc, info, lockp, flags);
LASSERT(oa != NULL);
- if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOENT)) {
+ if (OBD_FAIL_CHECK(OBD_FAIL_SRV_ENOENT)) {
struct ofd_seq *oseq;
oseq = ofd_seq_load(env, ofd, ostid_seq(&oa->o_oi));
LASSERT(info);
oic = &info->oti_cache;
- if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOENT))
+ if (OBD_FAIL_CHECK(OBD_FAIL_SRV_ENOENT))
RETURN(-ENOENT);
/* For the object is created as locking anchor, or for the object to
int rc = 0;
ENTRY;
- if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOENT))
+ if (OBD_FAIL_CHECK(OBD_FAIL_SRV_ENOENT))
RETURN(-ENOENT);
if (unlikely(fid_is_acct(fid))) {
}
run_test 113 "ldlm enqueue dropped reply should not cause deadlocks"
+T130_PID=0
+test_130_base() {
+ test_mkdir -p $DIR/$tdir
+
+ # get only LOOKUP lock on $tdir
+ cancel_lru_locks mdc
+ ls $DIR/$tdir/$tfile 2>/dev/null
+
+ # get getattr by fid on $tdir
+ #
+ # we need to race with unlink, unlink must complete before we will
+ # take a DLM lock, otherwise unlink will wait until getattr will
+ # complete; but later than getattr starts so that getattr found
+ # the object
+#define OBD_FAIL_MDS_INTENT_DELAY 0x160
+ set_nodes_failloc "$(mdts_nodes)" 0x80000160
+ stat $DIR/$tdir &
+ T130_PID=$!
+ sleep 2
+
+ rm -rf $DIR/$tdir
+
+ # drop the reply so that resend happens on an unlinked file.
+#define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
+ set_nodes_failloc "$(mdts_nodes)" 0x80000157
+}
+
+test_130a() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ test_130_base
+
+ wait $T130_PID || [ $? -eq 0 ] && error "stat should fail"
+ return 0
+}
+run_test 130a "enqueue resend on not existing file"
+
+test_130b() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ test_130_base
+ # let the reply to be dropped
+ sleep 10
+
+#define OBD_FAIL_SRV_ENOENT 0x217
+ set_nodes_failloc "$(mdts_nodes)" 0x80000217
+
+ wait $T130_PID || [ $? -eq 0 ] && error "stat should fail"
+ return 0
+}
+run_test 130b "enqueue resend on a stale inode"
+
complete $SECONDS
check_and_cleanup_lustre
exit_status
run_test 68b "support swapping to Lustre ========================"
# bug5265, obdfilter oa2dentry return -ENOENT
-# #define OBD_FAIL_OST_ENOENT 0x217
+# #define OBD_FAIL_SRV_ENOENT 0x217
test_69() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
remote_ost_nodsh && skip "remote OST with nodsh" && return
reset_async
- #define OBD_FAIL_OST_ENOENT 0x217
+ #define OBD_FAIL_SRV_ENOENT 0x217
set_nodes_failloc "$(osts_nodes)" 0x217
$MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?