[DRBD-user] [patch] Fix BLK* ioctls with 32bit userspace/64bit kernel

Guido Guenther agx at sigxcpu.org
Mon Jul 3 19:47:55 CEST 2006

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Hi,
according to block/ioctl.c drbd_ioctl() is supposed to return -ENOCTLCMD
instead of -EINVAL when it doesn't handle that specific ioctl:

/* Most of the generic ioctls are handled in the normal fallback path.
   This assumes the blkdev's low level compat_ioctl always returns
   ENOIOCTLCMD for unknown ioctls. */

If we don't do this all ioctl's like BLKGETSIZE64 and friends return
EINVAL which makes drbd almost unusable with a 32bit userspace on e.g.
amd64 (except for the trivial case where you create the fs direcly on
the /dev/drbd? device). With this one liner partitioning and lvm
work as expected, please apply:

--- drbd0.7-0.7.19/drbd/drbd_fs.c.orig	2006-07-03 19:21:57.000000000 +0200
+++ drbd0.7-0.7.19/drbd/drbd_fs.c	2006-07-03 19:22:27.000000000 +0200
@@ -1451,7 +1451,7 @@
 		break;
 
 	default:
-		err = -EINVAL;
+		err = -ENOIOCTLCMD;
 	}
  /* out: */
 	up(&mdev->device_mutex);

Cheers,
 -- Guido




More information about the drbd-user mailing list