public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Copying to loop device hangs up everything
@ 2001-12-20 21:05 Momchil Velikov
  0 siblings, 0 replies; 17+ messages in thread
From: Momchil Velikov @ 2001-12-20 21:05 UTC (permalink / raw)
  To: linux-kernel


Ok, I'm convinced, given that writers are throttled above the loopback
thread.  Follows the Andrea's patch, but against 2.4.17-rc2 + removed
unused gfp_mask parameter of sync_page_buffers.

Regards,
-velco

--- 1.5/fs/buffer.c	Tue Dec 18 15:40:18 2001
+++ edited/fs/buffer.c	Thu Dec 20 22:45:36 2001
@@ -2432,7 +2432,7 @@
 	return 1;
 }
 
-static int sync_page_buffers(struct buffer_head *head, unsigned int gfp_mask)
+static int sync_page_buffers(struct buffer_head *head)
 {
 	struct buffer_head * bh = head;
 	int tryagain = 0;
@@ -2533,9 +2533,10 @@
 	/* Uhhuh, start writeback so that we don't end up with all dirty pages */
 	write_unlock(&hash_table_lock);
 	spin_unlock(&lru_list_lock);
+	gfp_mask = pf_gfp_mask(gfp_mask);
 	if (gfp_mask & __GFP_IO) {
 		if ((gfp_mask & __GFP_HIGHIO) || !PageHighMem(page)) {
-			if (sync_page_buffers(bh, gfp_mask)) {
+			if (sync_page_buffers(bh)) {
 				/* no IO or waiting next time */
 				gfp_mask = 0;
 				goto cleaned_buffers_try_again;
--- 1.2/include/linux/mm.h	Sat Dec  8 02:36:12 2001
+++ edited/include/linux/mm.h	Thu Dec 20 22:49:04 2001
@@ -547,6 +547,14 @@
    platforms, used as appropriate on others */
 
 #define GFP_DMA		__GFP_DMA
+static inline unsigned int pf_gfp_mask(unsigned int gfp_mask)
+{
+	/* avoid all memory balancing I/O methods if this task cannot block on I/O */
+	if (current->flags & PF_NOIO)
+		gfp_mask &= ~(__GFP_IO | __GFP_HIGHIO | __GFP_FS);
+
+	return gfp_mask;
+}
 
 /* vma is the first one with  address < vma->vm_end,
  * and even  address < vma->vm_start. Have to extend vma. */
--- 1.2/mm/vmscan.c	Tue Dec 18 15:40:23 2001
+++ edited/mm/vmscan.c	Thu Dec 20 22:49:47 2001
@@ -588,6 +588,8 @@
 	int priority = DEF_PRIORITY;
 	int nr_pages = SWAP_CLUSTER_MAX;
 
+	gfp_mask = pf_gfp_mask(gfp_mask);
+
 	do {
 		nr_pages = shrink_caches(classzone, priority, gfp_mask, nr_pages);
 		if (nr_pages <= 0)


^ permalink raw reply	[flat|nested] 17+ messages in thread
* Copying to loop device hangs up everything
@ 2001-12-16  3:40 David Gomez
  2001-12-16  4:00 ` Dave Jones
  0 siblings, 1 reply; 17+ messages in thread
From: David Gomez @ 2001-12-16  3:40 UTC (permalink / raw)
  To: Linux-kernel


Hi,

I'm using kernel 2.4.17-rc1 and found what i think is a bug, maybe related
to the loop device. This is the situation:

I've created and ext2 image (around 550Mb), and mounted it as loopback.
Then i've tried to copy some files from another ext2 image also mounted in
another loop device, with a 'cp -a'. After some data has been copied, I/O
stopped but the system was still usable, loop, and cp process were in D
state. Loop devices couldn't be umounted, so i rebooted the computer,
e2fsck the images because of the reboot, and tried again to copy the data,
this time successfully.
Next, i had some more data in my root partition to add to the ext2 images,
so i did another cp -a of some directory (around 200mb of data) to the
ext2 image mounted as loop. This time i got a 'full hang' ;), i couldn't
login, a alt+sysrq+t shows that cp and loop were again in D state, and
syncing/umounting with the magic key didn't work at all. I can reproduce
this hang always, copying the data to the mounted loop device.

All the data is in the same disk (hda1), which is an ext2 partition.

Any ideas about what is causing this ?



David Gómez

"The question of whether computers can think is just like the question of
 whether submarines can swim." -- Edsger W. Dijkstra



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2001-12-20 21:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-20 21:05 Copying to loop device hangs up everything Momchil Velikov
  -- strict thread matches above, loose matches on Subject: below --
2001-12-16  3:40 David Gomez
2001-12-16  4:00 ` Dave Jones
2001-12-16 11:41   ` David Gomez
2001-12-16 16:53     ` Momchil Velikov
2001-12-16 19:42       ` David Gomez
2001-12-16 19:50         ` Momchil Velikov
2001-12-16 21:52           ` Momchil Velikov
2001-12-18 19:46             ` Marcelo Tosatti
2001-12-18 20:54               ` Momchil Velikov
2001-12-18 19:57                 ` Marcelo Tosatti
2001-12-18 21:26                   ` Momchil Velikov
     [not found]                   ` <3C1FC254.525B9108@zip.com.au>
     [not found]                     ` <3C1FCB96.83E49ECB@zip.com.au>
     [not found]                       ` <3C204C4F.C989AD71@zip.com.au>
2001-12-19 13:42                         ` Andrea Arcangeli
2001-12-20  7:41                           ` Andrew Morton
2001-12-20 11:27                             ` Andrea Arcangeli
2001-12-20 11:34                               ` Andrea Arcangeli
2001-12-17  3:30       ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox