From 77306d587df5482dcada8505178e7e94f2ff2bba Mon Sep 17 00:00:00 2001 From: "Alexander.Boyko" Date: Tue, 1 Jul 2014 23:17:28 +0400 Subject: [PATCH] LU-3192 osc: split different type of IO Do not allow different type of pages at the same rpc. Signed-off-by: Alexander Boyko Signed-off-by: Vitaly Fertman Xyratex-bug-id: MRP-859 Change-Id: Ic595a29f685757faf4d9c3de9c2d2ae8fd039baf Reviewed-on: http://review.whamcloud.com/10930 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/osc/osc_cache.c | 11 +++++++++++ lustre/tests/sanity.sh | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 4a8e9ce..de90f1a 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1827,6 +1827,9 @@ static int try_to_add_extent_for_io(struct client_obd *cli, int *pc, unsigned int *max_pages) { struct osc_extent *tmp; + struct osc_async_page *oap = list_first_entry(&ext->oe_pages, + struct osc_async_page, + oap_pending_item); ENTRY; EASSERT((ext->oe_state == OES_CACHE || ext->oe_state == OES_LOCK_DONE), @@ -1837,6 +1840,9 @@ static int try_to_add_extent_for_io(struct client_obd *cli, RETURN(0); list_for_each_entry(tmp, rpclist, oe_link) { + struct osc_async_page *oap2; + oap2 = list_first_entry(&tmp->oe_pages, struct osc_async_page, + oap_pending_item); EASSERT(tmp->oe_owner == current, tmp); #if 0 if (overlapped(tmp, ext)) { @@ -1844,6 +1850,11 @@ static int try_to_add_extent_for_io(struct client_obd *cli, EASSERT(0, ext); } #endif + if (oap2cl_page(oap)->cp_type != oap2cl_page(oap2)->cp_type) { + CDEBUG(D_CACHE, "Do not permit different type of IO" + " for a same RPC\n"); + RETURN(0); + } if (tmp->oe_srvlock != ext->oe_srvlock || !tmp->oe_grants != !ext->oe_grants) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index a5570fd..ae85f4c 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12586,6 +12586,31 @@ test_240() { } run_test 240 "race between ldlm enqueue and the connection RPC (no ASSERT)" +test_241_bio() { + for LOOP in $(seq $1); do + dd if=$DIR/$tfile of=/dev/null bs=40960 count=1 2>/dev/null + cancel_lru_locks osc + done +} + +test_241_dio() { + for LOOP in $(seq $1); do + dd if=$DIR/$tfile of=/dev/null bs=40960 count=1 \ + iflag=direct 2>/dev/null + done +} + +test_241() { + dd if=/dev/zero of=$DIR/$tfile count=1 bs=40960 + ls -la $DIR/$tfile + cancel_lru_locks osc + test_241_bio 1000 & + PID=$! + test_241_dio 1000 + wait $PID +} +run_test 241 "bio vs dio" + cleanup_test_300() { trap 0 umask $SAVE_UMASK -- 1.8.3.1