patch-2.3.23 linux/drivers/block/ll_rw_blk.c

Next file: linux/drivers/block/paride/pcd.c
Previous file: linux/drivers/block/ide.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.22/linux/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
@@ -416,10 +416,6 @@
 	count = bh->b_size >> 9;
 	sector = bh->b_rsector;
 
-	/* We'd better have a real physical mapping! */
-	if (!buffer_mapped(bh))
-		BUG();
-
 	/* It had better not be a new buffer by the time we see it */
 	if (buffer_new(bh))
 		BUG();
@@ -480,6 +476,13 @@
 			goto end_io;
 	}
 
+	/* We'd better have a real physical mapping!
+	   Check this bit only if the buffer was dirty and just locked
+	   down by us so at this point flushpage will block and
+	   won't clear the mapped bit under us. */
+	if (!buffer_mapped(bh))
+		BUG();
+
 /* look for a free request. */
        /* Loop uses two requests, 1 for loop and 1 for the real device.
         * Cut max_req in half to avoid running out and deadlocking. */
@@ -694,7 +697,7 @@
 
       sorry:
 	for (i = 0; i < nr; i++) {
-		clear_bit(BH_Dirty, &bh[i]->b_state);
+		mark_buffer_clean(bh[i]); /* remeber to refile it */
 		clear_bit(BH_Uptodate, &bh[i]->b_state);
 		bh[i]->b_end_io(bh[i], 0);
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)