Whamcloud - gitweb
LU-3192 osc: split different type of IO 30/10930/4
authorAlexander.Boyko <alexander_boyko@xyratex.com>
Tue, 1 Jul 2014 19:17:28 +0000 (23:17 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 11 Sep 2014 19:54:10 +0000 (19:54 +0000)
Do not allow different type of pages at the same rpc.

Signed-off-by: Alexander Boyko <alexander_boyko@xyratex.com>
Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Xyratex-bug-id: MRP-859
Change-Id: Ic595a29f685757faf4d9c3de9c2d2ae8fd039baf
Reviewed-on: http://review.whamcloud.com/10930
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osc/osc_cache.c
lustre/tests/sanity.sh

index 4a8e9ce..de90f1a 100644 (file)
@@ -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)
index a5570fd..ae85f4c 100644 (file)
@@ -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