From e4bfcac449b66a373afe6120e874d225754b59c8 Mon Sep 17 00:00:00 2001
From: alex <alex>
Date: Wed, 27 Apr 2005 03:18:37 +0000
Subject: [PATCH] b=6049

 - handle final completion calls only
---
 lustre/obdfilter/filter_io_26.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c
index 34f459a1f9..5a5f2349a4 100644
--- a/lustre/obdfilter/filter_io_26.c
+++ b/lustre/obdfilter/filter_io_26.c
@@ -57,6 +57,30 @@ static int dio_complete_routine(struct bio *bio, unsigned int done, int error)
         struct dio_request *dreq = bio->bi_private;
         unsigned long flags;
 
+        if (bio->bi_size) {
+                CWARN("gets called against non-complete bio 0x%p: %d/%d/%d\n",
+                      bio, bio->bi_size, done, error);
+                return 1;
+        }
+
+        if (dreq == NULL) {
+                CERROR("***** bio->bi_private is NULL!  This should never "
+                       "happen.  Normally, I would crash here, but instead I "
+                       "will dump the bio contents to the console.  Please "
+                       "report this to CFS, along with any interesting messages "
+                       "leading up to this point (like SCSI errors, perhaps).  "
+                       "Because bi_private is NULL, I can't wake up the thread "
+                       "that initiated this I/O -- so you will probably have to "
+                       "reboot this node.");
+                CERROR("bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d, "
+                       "bi_idx: %d, bi->size: %d, bi_end_io: %p, bi_cnt: %d, "
+                       "bi_private: %p\n", bio->bi_next, bio->bi_flags,
+                       bio->bi_rw, bio->bi_vcnt, bio->bi_idx, bio->bi_size,
+                       bio->bi_end_io, atomic_read(&bio->bi_cnt),
+                       bio->bi_private);
+                return 0;
+        }
+
         spin_lock_irqsave(&dreq->dr_lock, flags);
         bio->bi_private = dreq->dr_bios;
         dreq->dr_bios = bio;
-- 
GitLab