Skip to contentSkip to conversation

Kernel Oops (bCache hangs on registering 3rd device)

DISCUSSION James Sefton 2 participants 8 messages Nov 4, 2012 – Nov 5, 2012 3 messages not in the archive bcache (block layer cache)

lore
Share & tools
lore
#0 lore raw

Hi,

Seems I broke something.

I have run into this problem about 3 times now where bCache (or something!) seems to hang and I only just thought to check kern.log before trying to reboot so was previously assuming something else had just got stuck!

I only had 3 servers available to me and once this problem occurs, the servers seems to get stuck rebooting so I cannot do another test to confirm tonight. (I have put a reboot request in for them to be force rebooted but that will not get actioned until tomorrow)

Here is what I know about the most recent time this happened:

I had already set-up and been using /dev/bcache0 and /dev/bcache1. They are attached to the cache set and set to writeback.

The problem occurred when I ran "echo /dev/rbd2 >/sys/fs/bcache/register".
This device had been newly formatted with "make-bcache -B /dev/rbd2" (rbd2 is
a SAN based block device)

If it makes any difference - these commands are in a script so the register command would have been run *immediately* after the make-bcache command returned. (I am going to try sticking a sleep 3 or something in there tomorrow
- just in case its related to trying to register the device so quickly after it was prepared)

At this point my console just stops. I cannot CTRL+C to abort the echo command. top shows increasing load average - presumably it thinks a process is stuck waiting for something. Rebooting server kicks me out of console and then never comes back.

/dev/rbd0 and /dev/rbd1 are already registered at this point and were working fine. If I open another console (did this before rebooting) and create /dev/rbd3, and then try and register it - the same happens again.

Here is what came up in kern.log:

http://pastebin.com/xNBuv3sj
(Using Gmane to post and it complained about long lines)

Any ideas?

Cheers,

James

#1 lore raw
Quoted 7 lines · James Sefton

Hi,

Seems I broke something.

I have run into this problem about 3 times now where bCache (or something!) seems to hang and I only just thought to check kern.log before trying to

reboot

Quoted 4 lines

so was previously assuming something else had just got stuck!

I only had 3 servers available to me and once this problem occurs, the servers seems to get stuck rebooting so I cannot do another test to confirm tonight.

(I

Quoted 1 line

have put a reboot request in for them to be force rebooted but that will not

get

Quoted 9 lines

actioned until tomorrow)

Here is what I know about the most recent time this happened:

I had already set-up and been using /dev/bcache0 and /dev/bcache1. They are attached to the cache set and set to writeback.

The problem occurred when I ran "echo /dev/rbd2 >/sys/fs/bcache/register".
This device had been newly formatted with "make-bcache -B /dev/rbd2" (rbd2

is

Quoted 5 lines

a SAN based block device)

If it makes any difference - these commands are in a script so the register command would have been run *immediately* after the make-bcache command returned. (I am going to try sticking a sleep 3 or something in there

tomorrow

Quoted 1 line

- just in case its related to trying to register the device so quickly after

it

Quoted 3 lines

was prepared)

At this point my console just stops. I cannot CTRL+C to abort the echo

command.

Quoted 2 lines

top shows increasing load average - presumably it thinks a process is stuck waiting for something. Rebooting server kicks me out of console and then

never

Quoted 8 lines

comes back.

/dev/rbd0 and /dev/rbd1 are already registered at this point and were working fine. If I open another console (did this before rebooting) and create /dev/rbd3, and then try and register it - the same happens again.

Here is what came up in kern.log:

Quoted 10 lines

http://pastebin.com/xNBuv3sj
(Using Gmane to post and it complained about long lines)

Any ideas?

Cheers,

James

Yes, reproduced it after a clean boot.
It gets stuck creating the third cache device. (/dev/bcache2)

Here is the latest info from kern.log, but it looks very similar to what I posted before.

http://pastebin.com/r8YRSNGR

Any idea if I am doing something wrong or is this a bug?
I need to create up to 64 cache devices. Possibly slightly over that on rare occasions. (The majority of servers will have 16-32)

Many Thanks,

James

#2 lore raw
Quoted 17 lines · James Sefton
Quoted 5 lines · James Sefton

Hi,

Seems I broke something.
<.. pruned previous post ..>

Yes, reproduced it after a clean boot.
It gets stuck creating the third cache device. (/dev/bcache2)

Here is the latest info from kern.log, but it looks very similar to what I posted before.

http://pastebin.com/r8YRSNGR

Quoted 9 lines

Any idea if I am doing something wrong or is this a bug?
I need to create up to 64 cache devices. Possibly slightly over that on rare occasions. (The majority of servers will have 16-32)

Many Thanks,

James

Aha, I have more information.

ls /dev/block -l

<filtered results to relevant>

lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:0 -> ../bcache0
lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:1 -> ../bcache1
lrwxrwxrwx 1 root root 12 Nov  5 12:51 252:2 -> ../bcache1p1

Our script does things in the following order:
1. Registers bcache0 - OK
- links bcache0 in /dev/block/252:0
2. Registers bcache1 - OK
- links bcache1 in /dev/block/252:1
3. Partitions bcache1 - OK (single partition at the moment)
- links bcache1p1 in /dev/block/252:2
4. Partitions bcache0 - Partition table writes okay, but bcache0p1 does not get created.
- presumably attempts to link /dev/block/252:1 or something, and fails.
5. Registers bcache2 - FAIL, prevents any further bcache devices being registered and prevents system shut-down.
- attempts to link bcache2 in /dev/block/252:2, which is already used for
bcache1p1.

Probably explains why this has not been seen before since we only just added support for partitions with the patch details you recently gave me.

Any chance of a patch to fix the numbering?
(I wish my C++ was up to scratch so that I could do it myself as it looks like it could be relatively simple!)

Many Thanks,

James

#4 lore raw
In reply to a message not in the archive
Quoted 64 lines · James Sefton
Quoted 17 lines · James Sefton
Quoted 5 lines · James Sefton

Hi,

Seems I broke something.
<.. pruned previous post ..>

Yes, reproduced it after a clean boot.
It gets stuck creating the third cache device. (/dev/bcache2)

Here is the latest info from kern.log, but it looks very similar to what I posted before.

http://pastebin.com/r8YRSNGR

Quoted 9 lines

Any idea if I am doing something wrong or is this a bug?
I need to create up to 64 cache devices. Possibly slightly over that on rare occasions. (The majority of servers will have 16-32)

Many Thanks,

James

Aha, I have more information.

ls /dev/block -l

<filtered results to relevant>

lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:0 -> ../bcache0
lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:1 -> ../bcache1
lrwxrwxrwx 1 root root 12 Nov  5 12:51 252:2 -> ../bcache1p1

Our script does things in the following order:
1. Registers bcache0 - OK
- links bcache0 in /dev/block/252:0
2. Registers bcache1 - OK
- links bcache1 in /dev/block/252:1
3. Partitions bcache1 - OK (single partition at the moment)
- links bcache1p1 in /dev/block/252:2
4. Partitions bcache0 - Partition table writes okay, but bcache0p1 does not get created.
- presumably attempts to link /dev/block/252:1 or something, and fails.
5. Registers bcache2 - FAIL, prevents any further bcache devices being registered and prevents system shut-down.
- attempts to link bcache2 in /dev/block/252:2, which is already used for
bcache1p1.

Probably explains why this has not been seen before since we only just added support for partitions with the patch details you recently gave me.

Any chance of a patch to fix the numbering?
(I wish my C++ was up to scratch so that I could do it myself as it looks like it could be relatively simple!)

Many Thanks,

Quoted 7 lines

James

--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Though not a fix, a workaround could be to use LVM rather than partitions.

LVM ontop of bcache works quite nicely you just need to add the following to /etc/lvm.conf

types = [ "bcache", 16 ]

Also check your filter line to ensure that /dev/bcacheX will be scanned as a PV.

Once you have done that you can create a volume group as usual:

vgcreate vg0 /dev/bcache0

And then any number of LVs:

lvcreate -n root -L50G vg0

In my opinion this is considerably better than partitions.

Joseph.

Signature · 2 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846
#5 lore raw
Quoted 14 lines · Joseph Glanville
Quoted 12 lines · James Sefton

James Sefton <james@...> writes:

Aha, I have more information.

ls /dev/block -l

<filtered results to relevant>

lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:0 -> ../bcache0
lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:1 -> ../bcache1
lrwxrwxrwx 1 root root 12 Nov  5 12:51 252:2 -> ../bcache1p1
Quoted 8 lines
Quoted 8 lines

Our script does things in the following order:
1. Registers bcache0 - OK
- links bcache0 in /dev/block/252:0
2. Registers bcache1 - OK
- links bcache1 in /dev/block/252:1
3. Partitions bcache1 - OK (single partition at the moment)
- links bcache1p1 in /dev/block/252:2
4. Partitions bcache0 - Partition table writes okay, but bcache0p1 does not

get

Quoted 7 lines
Quoted 7 lines

created.
- presumably attempts to link /dev/block/252:1 or something, and fails.
5. Registers bcache2 - FAIL, prevents any further bcache devices being registered and prevents system shut-down.
- attempts to link bcache2 in /dev/block/252:2, which is already used for
bcache1p1.

Quoted 5 lines
Quoted 5 lines

Probably explains why this has not been seen before since we only just added support for partitions with the patch details you recently gave me.

Any chance of a patch to fix the numbering?
(I wish my C++ was up to scratch so that I could do it myself as it looks

like

Quoted 12 lines
Quoted 11 lines

it could be relatively simple!)

Many Thanks,

James

--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to majordomo@...
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 8 lines

Though not a fix, a workaround could be to use LVM rather than partitions.

LVM ontop of bcache works quite nicely you just need to add the following to /etc/lvm.conf

types = [ "bcache", 16 ]

Also check your filter line to ensure that /dev/bcacheX will be scanned as a

PV.

Quoted 5 lines

Once you have done that you can create a volume group as usual:

vgcreate vg0 /dev/bcache0

Quoted 8 lines

And then any number of LVs:

lvcreate -n root -L50G vg0

In my opinion this is considerably better than partitions.

Joseph.

Hi Joseph,

Many thanks for the suggestion.

I wish I could do that but the cache devices are being exposed to virtual machines as virtual disks and so the clients could easily repartition them back which would then reproduce the conflicting block device numbers.

I am also not sure how well LVM might cope if the PV's (etc..) were detected both in the host operating system and within a guest.

Even if LVM could work - I would still need to be able to accommodate a client the does not want LVM and chooses to repartition the device, and currently that would break the host server.

I do really appreciate the suggestion though.

Regards,

James

#7 lore raw
In reply to a message not in the archive
Quoted 82 lines · James Sefton
Quoted 14 lines · Joseph Glanville
Quoted 12 lines · James Sefton

James Sefton <james@...> writes:

Aha, I have more information.

ls /dev/block -l

<filtered results to relevant>

lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:0 -> ../bcache0
lrwxrwxrwx 1 root root 10 Nov  5 12:51 252:1 -> ../bcache1
lrwxrwxrwx 1 root root 12 Nov  5 12:51 252:2 -> ../bcache1p1
Quoted 8 lines
Quoted 8 lines

Our script does things in the following order:
1. Registers bcache0 - OK
- links bcache0 in /dev/block/252:0
2. Registers bcache1 - OK
- links bcache1 in /dev/block/252:1
3. Partitions bcache1 - OK (single partition at the moment)
- links bcache1p1 in /dev/block/252:2
4. Partitions bcache0 - Partition table writes okay, but bcache0p1 does not

get

Quoted 7 lines
Quoted 7 lines

created.
- presumably attempts to link /dev/block/252:1 or something, and fails.
5. Registers bcache2 - FAIL, prevents any further bcache devices being registered and prevents system shut-down.
- attempts to link bcache2 in /dev/block/252:2, which is already used for
bcache1p1.

Quoted 5 lines
Quoted 5 lines

Probably explains why this has not been seen before since we only just added support for partitions with the patch details you recently gave me.

Any chance of a patch to fix the numbering?
(I wish my C++ was up to scratch so that I could do it myself as it looks

like

Quoted 12 lines
Quoted 11 lines

it could be relatively simple!)

Many Thanks,

James

--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to majordomo@...
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 8 lines

Though not a fix, a workaround could be to use LVM rather than partitions.

LVM ontop of bcache works quite nicely you just need to add the following to /etc/lvm.conf

types = [ "bcache", 16 ]

Also check your filter line to ensure that /dev/bcacheX will be scanned as a

PV.

Quoted 5 lines

Once you have done that you can create a volume group as usual:

vgcreate vg0 /dev/bcache0

Quoted 8 lines

And then any number of LVs:

lvcreate -n root -L50G vg0

In my opinion this is considerably better than partitions.

Joseph.

Hi Joseph,

Many thanks for the suggestion.

I wish I could do that but the cache devices are being exposed to virtual machines as virtual disks and so the clients could easily repartition them back which would then reproduce the conflicting block device numbers.

Quoted 6 lines

I am also not sure how well LVM might cope if the PV's (etc..) were detected both in the host operating system and within a guest.

Even if LVM could work - I would still need to be able to accommodate a client the does not want LVM and chooses to repartition the device, and currently that would break the host server.

What kind of guests are these?

If I am correct this is some sort of VPS environment, probably Xen or KVM?

In that case if you pass through a logical volume and you properly adjust the filter in the host OS to only scan the bcache devices and not traverse recursively this works perfectly.
The guest OS will be able to partition the logical volume and the guest will not be able the see the underlying volume group.

Quoted 11 lines

I do really appreciate the suggestion though.

Regards,

James

--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Joseph.

Signature · 2 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846
#8 lore raw
Quoted 9 lines · Joseph Glanville
Quoted 9 lines
Quoted 9 lines

Though not a fix, a workaround could be to use LVM rather than partitions.

LVM ontop of bcache works quite nicely you just need to add the following to /etc/lvm.conf

types = [ "bcache", 16 ]

Also check your filter line to ensure that /dev/bcacheX will be scanned as

a

Quoted 10 lines
Quoted 10 lines

PV.

Quoted 9 lines

Once you have done that you can create a volume group as usual:

vgcreate vg0 /dev/bcache0

And then any number of LVs:

lvcreate -n root -L50G vg0

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

In my opinion this is considerably better than partitions.

Joseph.

I wish I could do that but the cache devices are being exposed to virtual machines as virtual disks and so the clients could easily repartition them

back

Quoted 10 lines
Quoted 5 lines

which would then reproduce the conflicting block device numbers.

I am also not sure how well LVM might cope if the PV's (etc..) were detected both in the host operating system and within a guest.

What kind of guests are these?

If I am correct this is some sort of VPS environment, probably Xen or KVM?

Quoted 9 lines

In that case if you pass through a logical volume and you properly adjust the filter in the host OS to only scan the bcache devices and not traverse recursively this works perfectly.
The guest OS will be able to partition the logical volume and the guest will not be able the see the underlying volume group.

Joseph.

Hi Joseph,

Again, thank you for putting in the time to help me.

Yes, it is KVM.

I don't think I had thought about it the way you describe. (Passing an LV to KVM
instead of the bcache device) I will certainly give it a try. Sounds like it
could solve all my problems.

I will drop a reply here if it works.

Thanks again,

James

#10 lore raw
In reply to a message not in the archive
Quoted 57 lines · James Sefton
Quoted 9 lines · Joseph Glanville
Quoted 9 lines
Quoted 9 lines

Though not a fix, a workaround could be to use LVM rather than partitions.

LVM ontop of bcache works quite nicely you just need to add the following to /etc/lvm.conf

types = [ "bcache", 16 ]

Also check your filter line to ensure that /dev/bcacheX will be scanned as

a

Quoted 10 lines
Quoted 10 lines

PV.

Quoted 9 lines

Once you have done that you can create a volume group as usual:

vgcreate vg0 /dev/bcache0

And then any number of LVs:

lvcreate -n root -L50G vg0

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

In my opinion this is considerably better than partitions.

Joseph.

I wish I could do that but the cache devices are being exposed to virtual machines as virtual disks and so the clients could easily repartition them

back

Quoted 10 lines
Quoted 5 lines

which would then reproduce the conflicting block device numbers.

I am also not sure how well LVM might cope if the PV's (etc..) were detected both in the host operating system and within a guest.

What kind of guests are these?

If I am correct this is some sort of VPS environment, probably Xen or KVM?

Quoted 9 lines

In that case if you pass through a logical volume and you properly adjust the filter in the host OS to only scan the bcache devices and not traverse recursively this works perfectly.
The guest OS will be able to partition the logical volume and the guest will not be able the see the underlying volume group.

Joseph.

Hi Joseph,

Again, thank you for putting in the time to help me.

Yes, it is KVM.

Quoted 7 lines

I don't think I had thought about it the way you describe. (Passing an LV to KVM
instead of the bcache device) I will certainly give it a try. Sounds like it
could solve all my problems.

I will drop a reply here if it works.

Thanks again,

No problem.

A word of warning though, if you intend to use LVM inside the guests (or if they are untrusted guests) then you should certainly adjust the filter line in lvm.conf to prevent recursive scanning. Otherwise you will see the guest PVs (and thus VGs and LVs) inside the host. Which is usually -bad-.

Something like:

filter = ["a/bcache.*/", "r/.*/"]

You obviously will need to also have an appropriate white list filter for other LVM volumes you want to use. ( "a/sdb/" for example)

Quoted 7 lines

James

--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846