From: Peter Osterlund If you do "pktsetup 0 /dev/hdd", insert a CD and write some data to it, remove the CD and insert a DVD, the /dev/hdd block device will not have the correct size. This leads to bogus "attempt to access beyond end of device" errors. This patch fixes it. Signed-off-by: Peter Osterlund Signed-off-by: Andrew Morton --- 25-akpm/drivers/block/pktcdvd.c | 2 ++ 1 files changed, 2 insertions(+) diff -puN drivers/block/pktcdvd.c~get-blockdev-size-right-in-pktcdvd-after-switching-discs drivers/block/pktcdvd.c --- 25/drivers/block/pktcdvd.c~get-blockdev-size-right-in-pktcdvd-after-switching-discs 2004-08-15 17:36:51.151820712 -0700 +++ 25-akpm/drivers/block/pktcdvd.c 2004-08-15 17:36:51.157819800 -0700 @@ -1917,6 +1917,8 @@ static int pkt_open_dev(struct pktcdvd_d } set_capacity(pd->disk, lba << 2); + set_capacity(pd->bdev->bd_disk, lba << 2); + bd_set_size(pd->bdev, (loff_t)lba << 11); /* * The underlying block device needs to have its merge logic _