From 0a80afc58b4c64f3e7478ccfe1949ba30a28dfa3 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Sun, 2 Feb 2020 16:45:29 +0300 Subject: [PATCH] LU-13190 mds: send mbo_max_mdsize in open intent reply - client sends open|create intent before a connection to OST cl_default_mds_easize is 0 since initialization - MDS replies back without UPDATE bit in LDLM lock, but wit EAh (MDS doesn't send OBD_MD_FLMODEASIZE and mbo_max_mdsize back - client's cl_default_mds_easize is still 0 - client sends getattr intent with 0-size buffer for EA - MDS replies LAYOUT lock, but empty EA due to 0-size buffer - client sets local layout to EMPTY - all subsequent I/O fails with -EBADF Signed-off-by: Alex Zhuravlev Change-Id: Iadd5595d956f0469e3916cdc1cca2ac8f802a149 Reviewed-on: https://review.whamcloud.com/37400 Reviewed-by: Mike Pershin Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_open.c | 3 +++ lustre/tests/sanity.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index ae3cb8e..98f80b8 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -1575,6 +1575,9 @@ again: } } + repbody->mbo_max_mdsize = info->mti_mdt->mdt_max_mdsize; + repbody->mbo_valid |= OBD_MD_FLMODEASIZE; + rc = mdt_pack_secctx_in_reply(info, child); if (unlikely(rc)) GOTO(out_child, result = rc); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 8ac81384..e24e301 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -23001,6 +23001,42 @@ test_819b() { } run_test 819b "too big niobuf in write" + +function test_820_start_ost() { + sleep 5 + + for num in $(seq $OSTCOUNT); do + start ost$num $(ostdevname $num) $OST_MOUNT_OPTS + done +} + +test_820() { + [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs" + + mkdir $DIR/$tdir + umount_client $MOUNT || error "umount failed" + for num in $(seq $OSTCOUNT); do + stop ost$num + done + + # mount client with no active OSTs + # so that the client can't initialize max LOV EA size + # from OSC notifications + mount_client $MOUNT || error "mount failed" + # delay OST starting to keep this 0 max EA size for a while + test_820_start_ost & + + # create a directory on MDS2 + test_mkdir -i 1 -c1 $DIR/$tdir/mds2 || + error "Failed to create directory" + # open intent should update default EA size + # see mdc_update_max_ea_from_body() + # notice this is the very first RPC to MDS2 + cp /etc/services $DIR/$tdir/mds2 || + error "Failed to copy files to mds$n" +} +run_test 820 "update max EA from open intent" + # # tests that do cleanup/setup should be run at the end # -- 1.8.3.1