* [PATCH] Get blockdev size right in pktcdvd after switching discs
@ 2004-08-15 14:00 Peter Osterlund
0 siblings, 0 replies; only message in thread
From: Peter Osterlund @ 2004-08-15 14:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
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 <petero2@telia.com>
---
linux-petero/drivers/block/pktcdvd.c | 2 ++
1 files changed, 2 insertions(+)
diff -puN drivers/block/pktcdvd.c~packet-capacity drivers/block/pktcdvd.c
--- linux/drivers/block/pktcdvd.c~packet-capacity 2004-08-15 15:08:08.000000000 +0200
+++ linux-petero/drivers/block/pktcdvd.c 2004-08-15 15:44:18.102726968 +0200
@@ -1971,6 +1971,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
_
--
Peter Osterlund - petero2@telia.com
http://w1.894.telia.com/~u89404340
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-15 14:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-15 14:00 [PATCH] Get blockdev size right in pktcdvd after switching discs Peter Osterlund
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.