|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Force SectorSize to 512
Bad things happen when the backend tries to indicate 4k sectors.
4k sectors will not fit into the block protocol, and some backends
pass sector-size as 4k, but the sector count in 512b. Force sector
size to 512, and warn when the backend is attempring to use 4k
sectors.
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
src/xendisk/pdo.c | 4 ++++
src/xenvbd/frontend.c | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/xendisk/pdo.c b/src/xendisk/pdo.c
index 07f4cfd..d927834 100644
--- a/src/xendisk/pdo.c
+++ b/src/xendisk/pdo.c
@@ -348,6 +348,10 @@ __PdoQueryProperty(
Descriptor = Irp->AssociatedIrp.SystemBuffer;
Pdo->SectorSize = Descriptor->BytesPerLogicalSector;
+ if (Pdo->SectorSize != 512) {
+ Error("%p : %u bytes per sector is invalid\n", Pdo->Dx->DeviceObject,
Pdo->SectorSize);
+ Pdo->SectorSize = 512;
+ }
Verbose("%p : %u bytes per sector\n", Pdo->Dx->DeviceObject,
Pdo->SectorSize);
done:
diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c
index 94e7f5b..85a03f8 100644
--- a/src/xenvbd/frontend.c
+++ b/src/xenvbd/frontend.c
@@ -749,8 +749,9 @@ __ReadDiskInfo(
if (Frontend->DiskInfo.DiskInfo & VDISK_CDROM) {
Warning("Target[%d] : DiskInfo contains VDISK_CDROM flag!\n",
Frontend->TargetId);
}
- if (Frontend->DiskInfo.SectorSize == 0) {
- Error("Target[%d] : Invalid SectorSize!\n", Frontend->TargetId);
+ if (Frontend->DiskInfo.SectorSize != 512) {
+ Error("Target[%d] : Invalid SectorSize (%u)!\n", Frontend->TargetId,
Frontend->DiskInfo.SectorSize);
+ Frontend->DiskInfo.SectorSize = 512;
}
if (Frontend->DiskInfo.SectorCount == 0) {
Error("Target[%d] : Invalid SectorCount!\n", Frontend->TargetId);
--
1.9.4.msysgit.1
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |