mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Get blockdev size right in pktcdvd after switching discs
Date: 15 Aug 2004 16:00:32 +0200	[thread overview]
Message-ID: <m3r7q8sdq7.fsf@telia.com> (raw)


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

                 reply	other threads:[~2004-08-15 14:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m3r7q8sdq7.fsf@telia.com \
    --to=petero2@telia.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®