result = -MDT_EREMOTE_OPEN;
GOTO(out_child, result);
} else if (mdt_object_exists(child)) {
+ /* Check early for MDS_OPEN_DIRECTORY/O_DIRECTORY to
+ * avoid opening regular files from lfs getstripe
+ * since doing so breaks the leases used by lfs
+ * mirror. See LU-13693. */
+ if (open_flags & MDS_OPEN_DIRECTORY &&
+ S_ISREG(lu_object_attr(&child->mot_obj)))
+ GOTO(out_child, result = -ENOTDIR);
+
/* We have to get attr & LOV EA & HSM for this
* object. */
mdt_prep_ma_buf_from_rep(info, child, ma);
}
run_test 51d "layout lock: losing layout lock should clean up memory map region"
+test_51e() {
+ local pid
+
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:eW_E+eUc &
+ pid=$!
+ sleep 1
+
+ $LFS getstripe $DIR2/$tfile
+ kill -USR1 $pid
+ wait $pid || error "multiop failed"
+
+ $MULTIOP $DIR/$tfile oO_RDONLY:eR_E+eUc &
+ pid=$!
+ sleep 1
+
+ $LFS getstripe $DIR2/$tfile
+ kill -USR1 $pid
+ wait $pid || error "multiop failed"
+}
+run_test 51e "lfs getstripe does not break leases, part 2"
+
test_54_part1()
{
echo "==> rename vs getattr vs setxattr should not deadlock"