+test_46i() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ touch $DIR1/$tfile-2
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ link $DIR1/$tfile-2 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
+ check_pdo_conflict $PID1 && { wait $PID1;
+ error "remote mkdir isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 46i "pdirops: link vs remote mkdir"
+
+# test 47: remote mkdir and blocking operations
+test_47a() {
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ mkdir $DIR2/$tfile && error "mkdir must fail"
+ check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47a "pdirops: remote mkdir vs mkdir"
+
+test_47b() {
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
+ check_pdo_conflict $PID1 && { wait $PID1;
+ error "create isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47b "pdirops: remote mkdir vs create"
+
+test_47c() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ touch $DIR1/$tfile-2
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
+ check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47c "pdirops: remote mkdir vs link"
+
+test_47d() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ rmdir $DIR2/$tfile || error "unlink must succeed"
+ check_pdo_conflict $PID1 && { wait $PID1;
+ error "unlink isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47d "pdirops: remote mkdir vs unlink"
+
+test_47e() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ touch $DIR1/$tfile-2
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
+ check_pdo_conflict $PID1 && { wait $PID1;
+ error "rename isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47e "pdirops: remote mkdir and rename (tgt)"
+
+test_47f() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
+ check_pdo_conflict $PID1 && { wait $PID1;
+ error "rename isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47f "pdirops: remote mkdir and rename (src)"
+
+test_47g() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
+ $LFS mkdir -i 1 $DIR1/$tfile &
+ PID1=$!
+ sleep 1
+ stat $DIR2/$tfile > /dev/null || error "stat must succeed"
+ check_pdo_conflict $PID1 && { wait $PID1;
+ error "getattr isn't blocked"; }
+ rm -r $DIR1/*
+ return 0
+}
+run_test 47g "pdirops: remote mkdir vs getattr"
+