From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 19 Oct 2004 00:53:52 +0400 From: "Konstantin A. Lepikhov" To: ALT Linux Kernel Devel Mailing List Message-ID: <20041018205352.GA15608@lks.home> Mail-Followup-To: ALT Linux Kernel Devel Mailing List Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4.2.1i X-Operation-System: ALT Linux Sisyphus (20040921) 2.6.8-wks26-up-alt3 X-Virus-Scanned: by amavisd-new at smtp.elektrostal.ru Subject: [d-kernel] PATCH: acpi irq safe gendisk_lock X-BeenThere: devel-kernel@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Linux kernel packages development List-Id: ALT Linux kernel packages development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Oct 2004 20:53:30 -0000 Archived-At: List-Archive: List-Post: --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit Здравствуйте! МБ этот патчик в -fix-acpi? Найден в логах BK. -- WBR, Konstantin chat with ==>ICQ: 109916175 Lepikhov, speak to ==>JID: lakostis@jabber.org aka L.A. Kostis write to ==>mailto:lakostis@pisem.net.nospam ...The information is like the bank... (c) EC8OR --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="acpi_irq_safe.patch" # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/09/29 13:56:57-03:00 axboe@suse.de # [PATCH] irq safe gendisk_lock # # Hi, # # There's a problem with gendisk_lock in 2.4 right now - it never disables # interrupts, but io completion stat updates can grab the lock from # end_that_request_last -> req_finished_io -> locate_hd_struct -> # get_gendisk. So make the lock irq safe so we don't risk deadlocking with # eg people doing add_gendisk(). This race has been seen and traced in # real life. # # ===== drivers/block/genhd.c 1.26 vs edited ===== # TAG: MailDone # # drivers/block/genhd.c # 2004/09/29 04:00:23-03:00 axboe@suse.de +14 -10 # irq safe gendisk_lock # # arch/i386/kernel/acpi.c # 2004/09/14 17:27:58-03:00 ha505@hszk.bme.hu +2 -0 # [i386] acpi.c: implicit declaration of mp_irqs_alloc() # diff -Nru a/arch/i386/kernel/acpi.c b/arch/i386/kernel/acpi.c --- a/arch/i386/kernel/acpi.c 2004-09-29 12:03:30 -07:00 +++ b/arch/i386/kernel/acpi.c 2004-09-29 12:03:30 -07:00 @@ -389,6 +389,8 @@ } +extern int mp_irqs_alloc(void); + /* * acpi_boot_init() * called from setup_arch(), always. diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c --- a/drivers/block/genhd.c 2004-09-29 12:03:30 -07:00 +++ b/drivers/block/genhd.c 2004-09-29 12:03:30 -07:00 @@ -49,8 +49,9 @@ add_gendisk(struct gendisk *gp) { struct gendisk *sgp; + unsigned long flags; - write_lock(&gendisk_lock); + write_lock_irqsave(&gendisk_lock, flags); /* * In 2.5 this will go away. Fix the drivers who rely on @@ -70,7 +71,7 @@ gp->next = gendisk_head; gendisk_head = gp; out: - write_unlock(&gendisk_lock); + write_unlock_irqrestore(&gendisk_lock, flags); } EXPORT_SYMBOL(add_gendisk); @@ -87,15 +88,16 @@ del_gendisk(struct gendisk *gp) { struct gendisk **gpp; + unsigned long flags; - write_lock(&gendisk_lock); + write_lock_irqsave(&gendisk_lock, flags); gendisk_array[gp->major] = NULL; for (gpp = &gendisk_head; *gpp; gpp = &((*gpp)->next)) if (*gpp == gp) break; if (*gpp) *gpp = (*gpp)->next; - write_unlock(&gendisk_lock); + write_unlock_irqrestore(&gendisk_lock, flags); } EXPORT_SYMBOL(del_gendisk); @@ -113,8 +115,9 @@ { struct gendisk *gp = NULL; int maj = MAJOR(dev); + unsigned long flags; - read_lock(&gendisk_lock); + read_lock_irqsave(&gendisk_lock, flags); if ((gp = gendisk_array[maj])) goto out; @@ -123,7 +126,7 @@ if (gp->major == maj) break; out: - read_unlock(&gendisk_lock); + read_unlock_irqrestore(&gendisk_lock, flags); return gp; } @@ -143,12 +146,13 @@ { struct gendisk *gp; int error = 0; + unsigned long flags; - read_lock(&gendisk_lock); + read_lock_irqsave(&gendisk_lock, flags); for (gp = gendisk_head; gp; gp = gp->next) if ((error = walk(gp, data))) break; - read_unlock(&gendisk_lock); + read_unlock_irqrestore(&gendisk_lock, flags); return error; } @@ -160,7 +164,7 @@ struct gendisk *gp; loff_t pos = *ppos; - read_lock(&gendisk_lock); + read_lock_irq(&gendisk_lock); for (gp = gendisk_head; gp; gp = gp->next) if (!pos--) return gp; @@ -175,7 +179,7 @@ static void part_stop(struct seq_file *s, void *v) { - read_unlock(&gendisk_lock); + read_unlock_irq(&gendisk_lock); } static int part_show(struct seq_file *s, void *v) --0OAP2g/MAC+5xKAE--