}
}
+ if (*flags & LDLM_FL_RESENT)
+ RETURN(ELDLM_OK);
+
/* For a replaying lock, it might be already in granted list. So
* unlinking the lock will cause the interval node to be freed, we
* have to allocate the interval node early otherwise we can't regrant
ldlm_grant_lock(lock, NULL);
GOTO(out, rc = ELDLM_OK);
#ifdef HAVE_SERVER_SUPPORT
- } else if (*flags & LDLM_FL_RESENT) {
- GOTO(out, rc = ELDLM_OK);
} else if (*flags & LDLM_FL_REPLAY) {
if (*flags & LDLM_FL_BLOCK_CONV) {
ldlm_resource_add_lock(res, &res->lr_converting, lock);
GOTO(out_put_new, rc = -EXDEV);
}
+ /* Before locking the target dir, check we do not replace
+ * a dir with a non-dir, otherwise it may deadlock with
+ * link op which tries to create a link in this dir
+ * back to this non-dir. */
if (S_ISDIR(lu_object_attr(&mnew->mot_obj)) &&
!S_ISDIR(lu_object_attr(&mold->mot_obj)))
GOTO(out_put_new, rc = -EISDIR);
#define OBD_FAIL_MDS_RENAME3 0x155
do_facet mds $LCTL set_param fail_loc=0x155
- mv $DIR/f1 $DIR/d1 &
+ mv $DIR/f1 $DIR/$tdir &
PID1=$!
sleep 2
- # while rename is sleeping, create d2, but as a directory
- mkdir -p $DIR2/d1 || error "(1) mkdir failed"
+ # while rename is sleeping, create $tdir, but as a directory
+ mkdir -p $DIR2/$tdir || error "(1) mkdir failed"
# link in reverse locking order
- ln $DIR2/f1 $DIR2/d1/
+ ln $DIR2/f1 $DIR2/$tdir/
wait $PID1 && error "(2) mv succeeded"
- lctl dk > ../log1
- ls -la $DIR/
- ls -la $DIR/d1
-
- rm -rf $DIR/d1
+ rm -rf $DIR/f1
}
run_test 55d "rename file vs link"