OSDN Git Service

dasd: fix ped_disk_new_fresh to not read old data from disk
authorHans de Goede <hdegoede@redhat.com>
Mon, 9 Nov 2009 17:26:55 +0000 (18:26 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 12 Nov 2009 14:37:40 +0000 (15:37 +0100)
commit91170c1ba20c7c296f7b2dc8d4dadf0587ccd0b0
tree4605fbb36235542cbd200f4be7ad3119f90ad583
parent574a13671f8659f5ba4217a1748f6ccd893b2feb
dasd: fix ped_disk_new_fresh to not read old data from disk

dasd_write(), was reading the volume label from the disk (trough
fdasd_check_volume()) and later writing it back again, this is fine for
existing dasd labels, but when creating a fresh label, this would
also cause the old volume label to be re-used, and if the old label
was corrupt, it would cause fdasd_check_volume() and thus dasd_write()
to fail.  Reported here: http://bugzilla.redhat.com/533808

* libparted/arch/linux.c: include fdasd.h.
(init_dasd): Do BIODASDINFO ioctl, and store the dasd devno in
arch_specific.
(init_dasd): Remove dead (never reached) code.
* libparted/arch/linux.h (struct _LinuxSpecific): Add devno member.
* libparted/labels/dasd.c (DasdDiskSpecific): add vlabel member.
(dasd_alloc): Init DasdDiskSpecific.vlabel for fresh disks
(dasd_read): Store read vlabel in DasdDiskSpecific.vlabel.
(dasd_write): Write DasdDiskSpecific.vlabel instead of on disk vlabel.
libparted/arch/linux.c
libparted/arch/linux.h
libparted/labels/dasd.c