Received: from mnm [127.0.0.1]
	by localhost with POP3 (fetchmail-5.9.0)
	for akpm@localhost (single-drop); Tue, 10 Jun 2003 08:36:55 -0700 (PDT)
Received: from digeo-e2k04.digeo.com ([192.168.2.24]) by pao-ex01.pao.digeo.com with Microsoft SMTPSVC(5.0.2195.5329);
	 Tue, 10 Jun 2003 08:35:44 -0700
Received: from digeo-nav01.digeo.com ([192.168.1.233]) by digeo-e2k04.digeo.com with Microsoft SMTPSVC(5.0.2195.5329);
	 Tue, 10 Jun 2003 08:35:43 -0700
Received: from packet.digeo.com ([192.168.17.15])
 by digeo-nav01.digeo.com (SAVSMTP 3.1.1.32) with SMTP id M2003061008375706288
 for <akpm@digeo.com>; Tue, 10 Jun 2003 08:37:57 -0700
Received: from mtvmime01.veritas.com (bay-bridge.veritas.com [143.127.3.10])
	by packet.digeo.com (8.12.8/8.12.8) with ESMTP id h5AFZgX8020671
	for <akpm@digeo.com>; Tue, 10 Jun 2003 08:35:42 -0700 (PDT)
Received: from megami (unverified) by mtvmime01.veritas.com
 (Content Technologies SMTPRS 4.2.10) with SMTP id <T62bd46d97f0a891151528@mtvmime01.veritas.com>;
 Tue, 10 Jun 2003 08:38:52 -0700
Received: from luxury.wat.veritas.com([10.10.185.105]) (1220 bytes) by megami
	via sendmail with P:esmtp/R:smart_host/T:smtp
	(sender: <hugh@veritas.com>) 
	id <m19Pl9x-000014C@megami>
	for <linux-kernel@vger.kernel.org>; Tue, 10 Jun 2003 08:35:41 -0700 (PDT)
	(Smail-3.2.0.101 1997-Dec-17 #15 built 2001-Aug-30)
Date: Tue, 10 Jun 2003 16:38:03 +0100 (BST)
From: Hugh Dickins <hugh@veritas.com>
X-X-Sender: hugh@localhost.localdomain
To: Andrew Morton <akpm@digeo.com>
cc: linux-kernel@vger.kernel.org
Subject: [PATCH] loop 9/9 don't lose PF_MEMDIE
In-Reply-To: <Pine.LNX.4.44.0306101606080.2285-100000@localhost.localdomain>
Message-ID: <Pine.LNX.4.44.0306101637090.2285-100000@localhost.localdomain>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang)
Return-Path: hugh@veritas.com
X-OriginalArrivalTime: 10 Jun 2003 15:35:43.0642 (UTC) FILETIME=[F47B27A0:01C32F65]
X-Spam-Status: No, hits=-15.8 required=6.0
	tests=BAYES_01,IN_REP_TO,PATCH_UNIFIED_DIFF,USER_AGENT_PINE
	autolearn=ham version=2.53
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53 (1.174.2.15-2003-03-30-exp)

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);

