Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: brking@us.ibm.com
Cc: Matthew Wilcox <matthew@wil.cx>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>,
	dwmw2@infradead.org
Subject: Re: [PATCH 1/1] scsicam_getgeo_odd_sector_size
Date: 13 Oct 2004 10:45:15 -0500	[thread overview]
Message-ID: <1097682323.2204.142.camel@mulgrave> (raw)
In-Reply-To: <416D3ABE.6030107@us.ibm.com>

On Wed, 2004-10-13 at 09:25, Brian King wrote:
> Looks like the code in fs/buffer.c has changed since I originally submitted this.
> The BUG()s appear to have been moved directly into __getblk_slow. The patch is
> still appropriate and needed, but the text at the beginning is now incorrect.
> Here was the backtrace of the original failure.
> 
> 
> GPR24: C0000000CCC9BB00 C0000000CF7B3C20 0000000000001050 0000000000001050
> GPR28: 0000000000000000 C0000000CCC9BB00 C0000000005E1480 C0000000CCC9BB00
> NIP [c0000000000c479c] .__getblk_slow+0xa8/0x484
> LR [c0000000000c474c] .__getblk_slow+0x58/0x484
> Call Trace:
> [c0000000cf7b3520] [c0000000000c474c] .__getblk_slow+0x58/0x484 (unreliable)
> [c0000000cf7b35e0] [c0000000000c4bdc] .__getblk+0x64/0x6c
> [c0000000cf7b3680] [c0000000000c7b3c] .__bread+0x20/0x14c
> [c0000000cf7b3710] [d000000000098044] .scsi_bios_ptable+0x50/0xd4 [scsi_mod]
> [c0000000cf7b37a0] [d0000000000980f8] .scsicam_bios_param+0x30/0x18c [scsi_mod]
> [c0000000cf7b3840] [d000000000063118] .sd_ioctl+0x240/0x274 [sd_mod]
> [c0000000cf7b38f0] [c000000000258a64] .blkdev_ioctl+0xd0/0x9e4
> [c0000000cf7b3a50] [c0000000000cbbc8] .block_ioctl+0x18/0x2c
> [c0000000cf7b3ad0] [c0000000000dd3d4] .sys_ioctl+0x450/0x690
> [c0000000cf7b3bb0] [c00000000002715c] .hdio_getgeo+0x40/0xcc
> [c0000000cf7b3c50] [c0000000000fc57c] .compat_sys_ioctl+0x178/0x32c
> [c0000000cf7b3d10] [c00000000001045c] .ret_from_syscall_1+0x0/0xa4

But this isn't a BUG().  It should be a warning followed by a stack
dump.  However, it looks like the correct fix is to get rid of the
__bread() in the cam code.

How does the attached work for you?

James

===== drivers/scsi/scsicam.c 1.16 vs edited =====
--- 1.16/drivers/scsi/scsicam.c	2004-06-19 09:45:02 -05:00
+++ edited/drivers/scsi/scsicam.c	2004-10-13 10:38:25 -05:00
@@ -29,10 +29,11 @@
 	unsigned char *res = kmalloc(66, GFP_KERNEL);
 	if (res) {
 		struct block_device *bdev = dev->bd_contains;
-		struct buffer_head *bh = __bread(bdev, 0, block_size(bdev));
-		if (bh) {
-			memcpy(res, bh->b_data + 0x1be, 66);
-			brelse(bh);
+		Sector sect;
+		void *data = read_dev_sector(bdev, 0, &sect);
+		if (data) {
+			memcpy(res, data + 0x1be, 66);
+			put_dev_sector(sect);
 		} else {
 			kfree(res);
 			res = NULL;


  reply	other threads:[~2004-10-13 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-19 23:02 [PATCH 1/1] scsicam_getgeo_odd_sector_size brking
2004-10-13 14:01 ` Brian King
2004-10-13 14:04   ` Matthew Wilcox
2004-10-13 14:25     ` Brian King
2004-10-13 15:45       ` James Bottomley [this message]
2004-10-13 19:55         ` Brian King
2004-10-13 21:37           ` James Bottomley
2004-10-13 22:57             ` Brian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1097682323.2204.142.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=brking@us.ibm.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox