Graças a toda a ajuda do meu amigo, o problema está resolvido.
Na primeira tentativa, ele comentou a linha ti->error = "Error creating mirror dirty log";
no dm-raid1.c
e inseriu algumas linhas de depuração em dm-log.c
para determinar o que causou o erro acima:
log = kmalloc(sizeof(*log), GFP_KERNEL);
if (!log)
ti->error = "kmalloc error";
return NULL;
type = get_type(type_name);
if (!type) {
kfree(log);
ti->error = "get_type error";
return NULL;
}
log->flush_callback_fn = flush_callback_fn;
log->type = type;
if (type->ctr(log, ti, argc, argv)) {
kfree(log);
put_type(type);
ti->error = "ctr error";
return NULL;
}
então recompilamos o kernel e conseguimos:
Nasegundatentativa,eledesejaobterovalordetype_name
:
if (type->ctr(log, ti, argc, argv)) {
kfree(log);
put_type(type);
char* typeN = kmalloc(1000, GFP_KERNEL);
char* pTypeN = typeN;
char* ptype_name = type_name;
while (*ptype_name != 'static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
unsigned int argc, char **argv,
struct dm_dev *dev)
{
enum sync sync = DEFAULTSYNC;
struct log_c *lc;
uint32_t region_size;
unsigned int region_count;
size_t bitset_size, buf_size;
int r;
if (argc < 1 || argc > 2) {
DMWARN("wrong number of arguments to dirty region log");
ti->error = "argc < 1 or > 2";
return -EINVAL;
}
if (argc > 1) {
if (!strcmp(argv[1], "sync"))
sync = FORCESYNC;
else if (!strcmp(argv[1], "nosync"))
sync = NOSYNC;
else {
DMWARN("unrecognised sync argument to "
"dirty region log: %s", argv[1]);
ti->error = "unrecognised sync argument to";
return -EINVAL;
}
}
') {
*pTypeN = *ptype_name;
++pTypeN;
++ptype_name;
}
ti->error = typeN;
return NULL;
}
Continueorastreamentoparaocore_ctr
eocreate_log_context
usandoométodoacima:
if (argc < 1 || argc > 2) {
DMWARN("wrong number of arguments to dirty region log");
char* argcStr = kmalloc(1000, GFP_KERNEL);
char* pArgc = argcStr;
unsigned int temp = argc;
do {
*pArgc = temp % 10;
++pArgc;
temp = temp / 10;
} while (temp > 0);
*pArgc = ' ';
++pArgc;
//copy argv;
int i = 0;
for (i; i < argc; ++i) {
char* pArgv = argv[i];
while (*pArgv != 'struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
struct dm_target *ti,
int (*flush_callback_fn)(struct dm_target *ti),
unsigned int argc, char **argv)
{
struct dm_dirty_log_type *type;
struct dm_dirty_log *log;
log = kmalloc(sizeof(*log), GFP_KERNEL);
if (!log) {
ti->error = "kmalloc error";
return NULL;
}
char* core = "core";
char* pCore = core;
int is_core = 1;
char* ptype_name = type_name;
while (*ptype_name != '# uname -r
2.6.34.14
# dmraid -s
*** Group superset .ddf1_disks
--> Active Subset
name : ddf1_VCBOOT
size : 489971712
stride : 128
type : mirror
status : ok
subsets: 0
devs : 2
spares : 0
# modprobe ceph
# lsmod | grep ceph
ceph 176676 0
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ddf1_VCBOOTp3
219G 17G 191G 8% /
/dev/mapper/ddf1_VCBOOTp1
99M 64M 30M 69% /boot
tmpfs 48G 16M 48G 1% /dev/shm
192.168.2.13:6789,192.168.2.14:6789,192.168.2.15:6789:/
72T 28T 45T 39% /mnt/ceph
') {
if (*pCore != *ptype_name) {
is_core = 0;
}
++pCore;
++ptype_name;
}
if (is_core && *pCore == *ptype_name && argc == 3) {
--argc;
}
type = get_type(type_name);
') {
*pArgc = *pArgv;
++pArgc;
++pArgv;
}
*pArgc = ' ';
++pArgc;
}
*pArgc = ' log = kmalloc(sizeof(*log), GFP_KERNEL);
if (!log)
ti->error = "kmalloc error";
return NULL;
type = get_type(type_name);
if (!type) {
kfree(log);
ti->error = "get_type error";
return NULL;
}
log->flush_callback_fn = flush_callback_fn;
log->type = type;
if (type->ctr(log, ti, argc, argv)) {
kfree(log);
put_type(type);
ti->error = "ctr error";
return NULL;
}
';
ti->error = argcStr;
return -EINVAL;
}
if (type->ctr(log, ti, argc, argv)) {
kfree(log);
put_type(type);
char* typeN = kmalloc(1000, GFP_KERNEL);
char* pTypeN = typeN;
char* ptype_name = type_name;
while (*ptype_name != 'static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
unsigned int argc, char **argv,
struct dm_dev *dev)
{
enum sync sync = DEFAULTSYNC;
struct log_c *lc;
uint32_t region_size;
unsigned int region_count;
size_t bitset_size, buf_size;
int r;
if (argc < 1 || argc > 2) {
DMWARN("wrong number of arguments to dirty region log");
ti->error = "argc < 1 or > 2";
return -EINVAL;
}
if (argc > 1) {
if (!strcmp(argv[1], "sync"))
sync = FORCESYNC;
else if (!strcmp(argv[1], "nosync"))
sync = NOSYNC;
else {
DMWARN("unrecognised sync argument to "
"dirty region log: %s", argv[1]);
ti->error = "unrecognised sync argument to";
return -EINVAL;
}
}
') {
*pTypeN = *ptype_name;
++pTypeN;
++ptype_name;
}
ti->error = typeN;
return NULL;
}
ObservequeocódigoASCIIdosímbolodocoraçãopretoé...3.
Nãoseiporqueoautorestámisturandoocore_ctr
comodisk_ctr
.Otype_name
écore
,masonúmerodeargumentosé3,entãoeleaparaoúltimoargumento(block_on_error
)inserindooseguintenodm_dirty_log_create
struct:
if (argc < 1 || argc > 2) {
DMWARN("wrong number of arguments to dirty region log");
char* argcStr = kmalloc(1000, GFP_KERNEL);
char* pArgc = argcStr;
unsigned int temp = argc;
do {
*pArgc = temp % 10;
++pArgc;
temp = temp / 10;
} while (temp > 0);
*pArgc = ' ';
++pArgc;
//copy argv;
int i = 0;
for (i; i < argc; ++i) {
char* pArgv = argv[i];
while (*pArgv != 'struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
struct dm_target *ti,
int (*flush_callback_fn)(struct dm_target *ti),
unsigned int argc, char **argv)
{
struct dm_dirty_log_type *type;
struct dm_dirty_log *log;
log = kmalloc(sizeof(*log), GFP_KERNEL);
if (!log) {
ti->error = "kmalloc error";
return NULL;
}
char* core = "core";
char* pCore = core;
int is_core = 1;
char* ptype_name = type_name;
while (*ptype_name != '# uname -r
2.6.34.14
# dmraid -s
*** Group superset .ddf1_disks
--> Active Subset
name : ddf1_VCBOOT
size : 489971712
stride : 128
type : mirror
status : ok
subsets: 0
devs : 2
spares : 0
# modprobe ceph
# lsmod | grep ceph
ceph 176676 0
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ddf1_VCBOOTp3
219G 17G 191G 8% /
/dev/mapper/ddf1_VCBOOTp1
99M 64M 30M 69% /boot
tmpfs 48G 16M 48G 1% /dev/shm
192.168.2.13:6789,192.168.2.14:6789,192.168.2.15:6789:/
72T 28T 45T 39% /mnt/ceph
') {
if (*pCore != *ptype_name) {
is_core = 0;
}
++pCore;
++ptype_name;
}
if (is_core && *pCore == *ptype_name && argc == 3) {
--argc;
}
type = get_type(type_name);
') {
*pArgc = *pArgv;
++pArgc;
++pArgv;
}
*pArgc = ' ';
++pArgc;
}
*pArgc = '%pre%';
ti->error = argcStr;
return -EINVAL;
}
Vamos ver o que acontece:
%pre%