Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

eio_cli create ioctl call fails #77

Open
hlein opened this issue Jul 3, 2014 · 4 comments
Open

eio_cli create ioctl call fails #77

hlein opened this issue Jul 3, 2014 · 4 comments

Comments

@hlein
Copy link

hlein commented Jul 3, 2014

kernel: 3.15.2-gentoo, x86_64, python 2.7.6
EnhanceIO 88cd79a
/dev/md4 is 2x Samsung SSD 840 in raid0 (~970 GB)
/dev/md6 is 9x 2TB HDD in raid6 (~13.5 TB)

Create fails:

# /sbin/eio_cli create -d /dev/md6 -s /dev/md4 -p lru -m wb -b 4096 -c cache1
Cache Name       : cache1
Source Device    : /dev/md6
SSD Device       : /dev/md4
Policy           : lru
Mode             : Write Back
Block Size       : 4096
Associativity    : 256
signed integer is greater than maximum
Cache creation failed (dmesg can provide you more info)

But nothing is logged by the kernel. The "signed integer is greater than maximum" seems to be a python error before ioctl is actually called; confirmed w/strace that no ioctl(2) call is made.

Based on my read of http://stackoverflow.com/questions/17210650/64-bit-argument-for-fcntl-ioctl, I tried blindly changing do_eio_ioctl in eio_cli from:

try:
        if ioctl(fd, IOC_TYPE, addressof(self)) == SUCCESS:

to:

selfaddr = c_uint64(addressof(self))
try:
        if ioctl(fd, IOC_TYPE, selfaddr) == SUCCESS:

That gets me a different failure:

[snip]
Associativity    : 256
[Errno 22] Invalid argument
Cache creation failed (dmesg can provide you more info)

And this time ioctl(2) does get called, and something does get syslogged:

ioctl(3, 0x41d04500, 0x7fffc0d74ea0)    = -1 EINVAL (Invalid argument)
Jul  2 21:32:44 foo kernel: [34365.203132] enhanceio: Cache creation failed: get_device for source device failed.

Progress... I guess?

Any recommendations? Is enhancedio known to work / known not to work with 3.15.x? With RAID devices this big?

@ec-c
Copy link

ec-c commented Jul 31, 2014

Same problem here.
kernel: 3.14.14-0-grsec, x86_64, python 2.7.6

/dev/sda is 1TB (btrfs raid1 with /dev/sdb)
/dev/sdc is 256GB

# eio_cli create -d /dev/sdb -s /dev/sdc -m wb -c enhanceio0
Cache Name       : enhanceio0
Source Device    : /dev/sdb
SSD Device       : /dev/sdc
Policy           : lru
Mode             : Write Back
Block Size       : 4096
Associativity    : 256
signed integer is greater than maximum
Cache creation failed (dmesg can provide you more info)

Nothing is logged by the kernel.

strace logfile: http://pastebin.com/g05nTEuR

@marcin-github
Copy link

Based on hlein work I've made such changes to eio_cli:

diff --git a/CLI/eio_cli b/CLI/eio_cli
index 3453b35..a0b60c5 100755
--- a/CLI/eio_cli
+++ b/CLI/eio_cli
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 #
 # Copyright (C) 2012 STEC, Inc. All rights not specifically granted
 # under a license included herein are reserved
@@ -305,10 +305,12 @@ class Cache_rec(Structure):

        def do_eio_ioctl(self,IOC_TYPE):
                #send ioctl to driver
-               fd = open(EIODEV, "r")
+               libc = CDLL('libc.so.6')
+               fd = os.open (EIODEV, os.O_RDWR, 0400)
                fmt = ''
+               selfaddr = c_uint64(addressof(self))
                try:
-                       if ioctl(fd, IOC_TYPE, addressof(self)) == SUCCESS:
+                       if libc.ioctl(fd, IOC_TYPE, selfaddr) == SUCCESS:
                                return SUCCESS
                except Exception as e:
                        print e

And it works for me.

@flrichar
Copy link

flrichar commented Jun 8, 2015

I have this same issue, latest enhanceio from git... kernel 4.0.5-ARCH, x86_64, python 2.7.10. The fix seemed to work for me as well. Something had "broken" with recent kernels, as recent as 4.0.2. HDD is /dev/vg0/eio (402gb lvm volume) and SSD is /dev/ssd/pyro (30gb lvm volume from Patriot Pyro SSD).

@feldsam
Copy link

feldsam commented Sep 12, 2015

Hi, I have also problem with creating cache device. I have multipath device /dev/mapper/images and one ssd. I try plain ssd and also ssd with one partition. I also try apply patch to cli. When using original cli, I got two errors:

[Errno 16] Device or resource busy
enhanceio: Cache creation failed: get_device for cache device failed.

After patch I got just
enhanceio: Cache creation failed: get_device for cache device failed.

Centos 7.1.1503 3.10.0-229.11.1.el7.x86_64

Can somebody help? Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants