Subject: [PATCH] loop 9/9 don't lose PF_MEMDIE
From: Hugh Dickins <[email-masked]>
To: Andrew Morton <[email-masked]>
Cc: [email-masked]
Date: Tue, 10 Jun 2003 16:38:03 +0100 (BST)

loop_get_buffer loses PF_MEMDIE if it's added while in loop_copy_bio:
not a high probability since it's not waiting there, but could happen,
and sets a bad example (compare with add_to_swap fixed a while back).

--- loop8/drivers/block/loop.c	Tue Jun 10 11:55:11 2003
+++ loop9/drivers/block/loop.c	Tue Jun 10 12:05:17 2003
@@ -484,7 +484,9 @@
 
 		current->flags &= ~PF_MEMALLOC;
 		bio = loop_copy_bio(rbh);
-		current->flags = flags;
+		if (flags & PF_MEMALLOC)
+			current->flags |= PF_MEMALLOC;
+
 		if (bio == NULL)
 			blk_congestion_wait(WRITE, HZ/10);
 	} while (bio == NULL);