All of lore.kernel.org
 help / color / mirror / Atom feed
* Inserting Into Buffer Cache
@ 2004-12-17 12:19 Erwin Can Sar
  0 siblings, 0 replies; only message in thread
From: Erwin Can Sar @ 2004-12-17 12:19 UTC (permalink / raw)
  To: linux-fsdevel

Hi,

I'm trying to write a driver that can insert a dirty buffer of data into its
buffer cache (for a research project). My block device has a sectorsize of
512 and 512 sectors. For some reason inserting into sector 0 works
correctly, but sector 1 does not work. What happens is that __getblk never
returns and it seems like it is looping forever. I think that the culprit
is the loop inside __getblk_slow that will loop forever if grow_buffer
keeps failing. The problematic call is:

  bh = __getblk(bdev, 1, hardsect_size);

In order to figure out what's going on I've put more and more of that code
into my own driver, so that it is now:

static int sbd_temp(struct block_device *bdev)
{
  struct buffer_head *bh;
  bh = __find_get_block(bdev, 1, hardsect_size);
  if(!bh) {
    printk("Not Found\n");
    if(!grow_buffers(bdev, 1, hardsect_size)) {
      printk("Couldn't grow\n");
      return -1;
    }
  }
  brelse(bh);
  return 0;
}

Unfortunately this leads to an OOPS:

------------[ cut here ]------------
Dec 17 13:05:13 ubuntu kernel: kernel BUG at fs/buffer.c:1619!
Dec 17 13:05:13 ubuntu kernel: invalid operand: 0000 [#1]
Dec 17 13:05:13 ubuntu kernel: PREEMPT
Dec 17 13:05:13 ubuntu kernel: Modules linked in: sbd proc_intf freq_table
cpufreq_userspace cpufreq_powersave ipv6 af_packet orinoco_cs orinoco
hermes ds button ac battery yenta_socket pcmcia_core e100 eepro100 mii
snd_intel8x0m snd_intel8x0 snd_ac97_codec snd_pcm_oss snd_mixer_oss snd_pcm
snd_timer snd_page_alloc gameport snd_mpu401_uart snd_rawmidi snd_seq_device
snd soundcore uhci_hcd usbcorepciehp shpchp pci_hotplug intel_agp agpgart
pcspkr rtc md dm_mod parport_pc lp p arport tsdev ide_cd joydev evdev cdrom
mousedev psmouse ext3 jbd ide_generic piix ide_disk ide_core unix fan
thermal processor
Dec 17 13:05:13 ubuntu kernel: CPU:    0
Dec 17 13:05:13 ubuntu kernel: EIP:    0060:[set_bh_page+23/54]    Not
tainted
Dec 17 13:05:13 ubuntu kernel: EFLAGS: 00010216   (2.6.8.1)
Dec 17 13:05:13 ubuntu kernel: EIP is at set_bh_page+0x17/0x36
Dec 17 13:05:13 ubuntu kernel: eax: c108b700   ebx: c03358d0   ecx: c03358d0
  e dx: 2f4da5f9
Dec 17 13:05:13 ubuntu kernel: esi: 2f4da5f9   edi: d0b26a07   ebp: 00000000
  e sp: cd30be94
Dec 17 13:05:13 ubuntu kernel: ds: 007b   es: 007b   ss: 0068
Dec 17 13:05:13 ubuntu kernel: Process simple (pid: 4534,
threadinfo=cd30a000 task=c315c3f0)
Dec 17 13:05:13 ubuntu kernel: Stack: c0146874 c03358d0 c108b700 2f4da5f9
c108b700 00000001 00000000 d0b26a07
Dec 17 13:05:13 ubuntu kernel:        c014698b c108b700 d0b26a07 00000000
00000001 00000000 00000000 d0b26a07
Dec 17 13:05:13 ubuntu kernel:        c0148a5f cf561080 00000001 00000000
00000001 d0b26a07 00000001 00000200
Dec 17 13:05:13 ubuntu kernel: Call Trace:
Dec 17 13:05:13 ubuntu kernel:  [create_buffers+88/144]
create_buffers+0x58/0x90Dec 17 13:05:13 ubuntu kernel: 
[grow_dev_page+119/264] grow_dev_page+0x77/0x108Dec 17 13:05:13 ubuntu
kernel:  [grow_buffers+79/148] grow_buffers+0x4f/0x94
Dec 17 13:05:13 ubuntu kernel:  [__crc___bitmap_andnot+8756634/10939662]
sbd_temp+0x5f/0x81 [sbd]
Dec 17 13:05:13 ubuntu kernel:  [__crc___bitmap_andnot+8757248/10939662]
sbd_ioctl+0x244/0x30b [sbd]
Dec 17 13:05:13 ubuntu kernel:  [blkdev_ioctl+838/859]
blkdev_ioctl+0x346/0x35bDec 17 13:05:13 ubuntu kernel:  [block_ioctl+26/30]
block_ioctl+0x1a/0x1e
Dec 17 13:05:13 ubuntu kernel:  [sys_ioctl+461/532] sys_ioctl+0x1cd/0x214
Dec 17 13:05:13 ubuntu kernel:  [sysenter_past_esp+82/113]
sysenter_past_esp+0x52/0x71
Dec 17 13:05:13 ubuntu kernel: Code: 0f 0b 53 06 22 e0 25 c0 2b 05 30 64 34
c0 c 1 f8 05 c1 e0 0c

Is there some problem with the way I am using __getblk? I've been spending a
lot of time on trying to figure this, but can't see what's wrong with my
code.
Thank you very much for your help,
Can Sar

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-17 12:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 12:19 Inserting Into Buffer Cache Erwin Can Sar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.