← Back to team overview

kernel-packages team mailing list archive

[Bug 1377130] Re: Crash at creation of bcache if caching size > backing size

 

** Description changed:

  Hi,
  
  I found a bug that crashes the machine if you create a bcache where the
  caching device size is bigger than backing device.
  
  This case may happen if you create a bcache with a plan to add a bigger
  disk/partition/raid later to it.
  
  To reproduce it follow this steps:
  
  start a vm with utopic-amd64-desktop iso, it must have 2 disks, one of
  16G and on of 8G
  
- apt-get update && apt-get install bcache-tools
- /dev/sda is 16G caching device
- /dev/sdb is 8G backing device
+ 		apt-get update && apt-get install bcache-tools
+ 		/dev/sda is 16G caching device
+ 		/dev/sdb is 8G backing device
  
- make-bcache --write-back --discard -C /dev/sda -B /dev/sdb
- now the machine is hanged.
+                 make-bcache --write-back --discard -C /dev/sda -B
+ /dev/sdb
+ 
+ now the machine is hanged!
  
  if you reboot and reinstall bcache-tools
  the bcache device has been created
  
- ************************************
- bcache-super-show -f /dev/sda:
- ==============================
- sb.magic		ok
- sb.first_sector		8 [match]
- sb.csum			45C96B38A79275A7 [match]
- sb.version		0 [cache device]
+ 		************************************
+ 		bcache-super-show -f /dev/sda:
+ 		==============================
+ 		sb.magic		ok
+ 		sb.first_sector		8 [match]
+ 		sb.csum			45C96B38A79275A7 [match]
+ 		sb.version		0 [cache device]
  
- dev.label		(empty)
- dev.uuid		155ab65e-e74a-4ca8-91da-467ef696db63
- dev.sectors_per_block	1
- dev.sectors_per_bucket	1024
- dev.cache.first_sector	1024
- dev.cache.cache_sectors	33553408
- dev.cache.total_sectors	33554432
- dev.cache.ordered	no
- dev.cache.discard	yes
- dev.cache.pos		0
- dev.cache.replacement	0 [lru]
+ 		dev.label		(empty)
+ 		dev.uuid		155ab65e-e74a-4ca8-91da-467ef696db63
+ 		dev.sectors_per_block	1
+ 		dev.sectors_per_bucket	1024
+ 		dev.cache.first_sector	1024
+ 		dev.cache.cache_sectors	33553408
+ 		dev.cache.total_sectors	33554432
+ 		dev.cache.ordered	no
+ 		dev.cache.discard	yes
+ 		dev.cache.pos		0
+ 		dev.cache.replacement	0 [lru]
  
- cset.uuid               bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8
+                 cset.uuid
+ bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8
  
- *****************************************************
- bcache-super-show /dev/sdb:
- =============================================
- sb.magic		ok
- sb.first_sector		8 [match]
- sb.csum			F37A1BB08A7F5DE7 [match]
- sb.version		1 [backing device]
+ 		*****************************************************
+ 		bcache-super-show /dev/sdb:
+ 		=============================================
+ 		sb.magic		ok
+ 		sb.first_sector		8 [match]
+ 		sb.csum			F37A1BB08A7F5DE7 [match]
+ 		sb.version		1 [backing device]
  
- dev.label		(empty)
- dev.uuid		341f1c83-1797-4157-aa9e-524107db5606
- dev.sectors_per_block	1
- dev.sectors_per_bucket	1024
- dev.data.first_sector	16
- dev.data.cache_mode	1 [writeback]
- dev.data.cache_state	0 [detached]
+ 		dev.label		(empty)
+ 		dev.uuid		341f1c83-1797-4157-aa9e-524107db5606
+ 		dev.sectors_per_block	1
+ 		dev.sectors_per_bucket	1024
+ 		dev.data.first_sector	16
+ 		dev.data.cache_mode	1 [writeback]
+ 		dev.data.cache_state	0 [detached]
  
- cset.uuid		bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8
- *****************************************************
+ 		cset.uuid		bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8
+ 		*****************************************************
  
  you can format it:
- mkfs.ext4 /dev/bcache0
- Rejet des blocs de périphérique : complété
- Creating filesystem with 2097150 4k blocks and 524288 inodes
- Filesystem UUID: b99a09de-3a92-4a44-82cd-29f75f8bf0c9
- Superblocs de secours stockés sur les blocs :
-  32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
+ 		mkfs.ext4 /dev/bcache0
+ 		Rejet des blocs de périphérique : complété
+ 		Creating filesystem with 2097150 4k blocks and 524288 inodes
+ 		Filesystem UUID: b99a09de-3a92-4a44-82cd-29f75f8bf0c9
+ 		Superblocs de secours stockés sur les blocs :
+ 		 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
  
- Allocation des tables de groupe : complété
- Écriture des tables d'i-noeuds : complété
- Création du journal (32768 blocs) : complété
- Écriture des superblocs et de l'information de comptabilité du système de
- fichiers :
+ 		Allocation des tables de groupe : complété
+ 		Écriture des tables d'i-noeuds : complété
+ 		Création du journal (32768 blocs) : complété
+ 		Écriture des superblocs et de l'information de comptabilité du système de
+ 		fichiers :
  
  restarting the format gave me an other bug (X.org crashing):
- free from cli:
-              total       used       free     shared    buffers     cached
- Mem:       1017168     814040     203128     195568      91264     513064
- -/+ buffers/cache:     209712     807456
- Swap:            0          0          0
+ 		free from cli:
+ 			     total       used       free     shared    buffers     cached
+ 		Mem:       1017168     814040     203128     195568      91264     513064
+ 		-/+ buffers/cache:     209712     807456
+ 		Swap:            0          0          0
  
- tail /var/log/syslog:
- [  568.016481] [ 4983]     0  4983     3332      121      11        0             0 mdadm
- [  568.016483] [ 5259]     0  5259     6703      300      19        0             0 mkfs.ext4
- [  568.016484] Out of memory: Kill process 1947 (Xorg) score 38 or sacrifice child
- [  568.016485] Killed process 1947 (Xorg) total-vm:313160kB, anon-rss:35976kB, file-rss:4232kB
- [  568.707107] systemd-logind[1396]: Failed to start unit user@112.service: Unknown unit: user@112.service
- [  568.707113] systemd-logind[1396]: Failed to start user service: Unknown unit: user@112.service
- [  568.709876] systemd-logind[1396]: New session c8 of user lightdm.
- [  568.709890] systemd-logind[1396]: Linked /tmp/.X11-unix/X0 to /run/user/112/X11-display.
+ 		tail /var/log/syslog:
+ 		[  568.016481] [ 4983]     0  4983     3332      121      11        0             0 mdadm
+ 		[  568.016483] [ 5259]     0  5259     6703      300      19        0             0 mkfs.ext4
+ 		[  568.016484] Out of memory: Kill process 1947 (Xorg) score 38 or sacrifice child
+ 		[  568.016485] Killed process 1947 (Xorg) total-vm:313160kB, anon-rss:35976kB, file-rss:4232kB
+ 		[  568.707107] systemd-logind[1396]: Failed to start unit user@112.service: Unknown unit: user@112.service
+ 		[  568.707113] systemd-logind[1396]: Failed to start user service: Unknown unit: user@112.service
+ 		[  568.709876] systemd-logind[1396]: New session c8 of user lightdm.
+ 		[  568.709890] systemd-logind[1396]: Linked /tmp/.X11-unix/X0 to /run/user/112/X11-display.
  
- You can unregister the bcache device:
- [  830.811150] bcache: cached_dev_detach_finish() Caching disabled for sdb
- [  830.949898] bcache: cache_set_free() Cache set bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8 unregistered
+ You can unregister the bcache device,but to re-use all disks, you'll need a reboot (cf bug 1377142):
+ 		[  830.811150] bcache: cached_dev_detach_finish() Caching disabled for sdb
+ 		[  830.949898] bcache: cache_set_free() Cache set bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8 unregistered

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1377130

Title:
  Crash at creation of bcache if caching size > backing size

Status in “bcache-tools” package in Ubuntu:
  New
Status in “linux” package in Ubuntu:
  Incomplete

Bug description:
  Hi,

  I found a bug that crashes the machine if you create a bcache where
  the caching device size is bigger than backing device.

  This case may happen if you create a bcache with a plan to add a
  bigger disk/partition/raid later to it.

  To reproduce it follow this steps:

  start a vm with utopic-amd64-desktop iso, it must have 2 disks, one of
  16G and on of 8G

  		apt-get update && apt-get install bcache-tools
  		/dev/sda is 16G caching device
  		/dev/sdb is 8G backing device

                  make-bcache --write-back --discard -C /dev/sda -B
  /dev/sdb

  now the machine is hanged!

  if you reboot and reinstall bcache-tools
  the bcache device has been created

  		************************************
  		bcache-super-show -f /dev/sda:
  		==============================
  		sb.magic		ok
  		sb.first_sector		8 [match]
  		sb.csum			45C96B38A79275A7 [match]
  		sb.version		0 [cache device]

  		dev.label		(empty)
  		dev.uuid		155ab65e-e74a-4ca8-91da-467ef696db63
  		dev.sectors_per_block	1
  		dev.sectors_per_bucket	1024
  		dev.cache.first_sector	1024
  		dev.cache.cache_sectors	33553408
  		dev.cache.total_sectors	33554432
  		dev.cache.ordered	no
  		dev.cache.discard	yes
  		dev.cache.pos		0
  		dev.cache.replacement	0 [lru]

                  cset.uuid
  bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8

  		*****************************************************
  		bcache-super-show /dev/sdb:
  		=============================================
  		sb.magic		ok
  		sb.first_sector		8 [match]
  		sb.csum			F37A1BB08A7F5DE7 [match]
  		sb.version		1 [backing device]

  		dev.label		(empty)
  		dev.uuid		341f1c83-1797-4157-aa9e-524107db5606
  		dev.sectors_per_block	1
  		dev.sectors_per_bucket	1024
  		dev.data.first_sector	16
  		dev.data.cache_mode	1 [writeback]
  		dev.data.cache_state	0 [detached]

  		cset.uuid		bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8
  		*****************************************************

  you can format it:
  		mkfs.ext4 /dev/bcache0
  		Rejet des blocs de périphérique : complété
  		Creating filesystem with 2097150 4k blocks and 524288 inodes
  		Filesystem UUID: b99a09de-3a92-4a44-82cd-29f75f8bf0c9
  		Superblocs de secours stockés sur les blocs :
  		 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

  		Allocation des tables de groupe : complété
  		Écriture des tables d'i-noeuds : complété
  		Création du journal (32768 blocs) : complété
  		Écriture des superblocs et de l'information de comptabilité du système de
  		fichiers :

  restarting the format gave me an other bug (X.org crashing):
  		free from cli:
  			     total       used       free     shared    buffers     cached
  		Mem:       1017168     814040     203128     195568      91264     513064
  		-/+ buffers/cache:     209712     807456
  		Swap:            0          0          0

  		tail /var/log/syslog:
  		[  568.016481] [ 4983]     0  4983     3332      121      11        0             0 mdadm
  		[  568.016483] [ 5259]     0  5259     6703      300      19        0             0 mkfs.ext4
  		[  568.016484] Out of memory: Kill process 1947 (Xorg) score 38 or sacrifice child
  		[  568.016485] Killed process 1947 (Xorg) total-vm:313160kB, anon-rss:35976kB, file-rss:4232kB
  		[  568.707107] systemd-logind[1396]: Failed to start unit user@112.service: Unknown unit: user@112.service
  		[  568.707113] systemd-logind[1396]: Failed to start user service: Unknown unit: user@112.service
  		[  568.709876] systemd-logind[1396]: New session c8 of user lightdm.
  		[  568.709890] systemd-logind[1396]: Linked /tmp/.X11-unix/X0 to /run/user/112/X11-display.

  You can unregister the bcache device,but to re-use all disks, you'll need a reboot (cf bug 1377142):
  		[  830.811150] bcache: cached_dev_detach_finish() Caching disabled for sdb
  		[  830.949898] bcache: cache_set_free() Cache set bcaa2595-bbc8-43a7-8c44-5d0aca0f3fc8 unregistered

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bcache-tools/+bug/1377130/+subscriptions


References