patch-2.1.5 linux/fs/buffer.c

Next file: linux/fs/ext2/symlink.c
Previous file: linux/fs/binfmt_elf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.4/linux/fs/buffer.c linux/fs/buffer.c
@@ -210,7 +210,31 @@
 			next->b_count--;
 			retry = 1;
 		}
-	
+
+    repeat2:
+		bh = lru_list[BUF_LOCKED];
+		if (!bh)
+			break;
+		for (i = nr_buffers_type[BUF_LOCKED]*2 ; i-- > 0 ; bh = next) {
+			if (bh->b_list != BUF_LOCKED)
+				goto repeat2;
+			next = bh->b_next_free;
+			if (!lru_list[BUF_LOCKED])
+				break;
+			if (dev && bh->b_dev != dev)
+				continue;
+			if (buffer_locked(bh)) {
+				/* Buffer is locked; skip it unless wait is
+				   requested AND pass > 0. */
+				if (!wait || !pass) {
+					retry = 1;
+					continue;
+				}
+				wait_on_buffer (bh);
+				goto repeat2;
+			}
+		}
+
 	/* If we are waiting for the sync to succeed, and if any dirty
 	   blocks were written, then repeat; on the second pass, only
 	   wait for buffers being written (do not pass to write any

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov