Bug 1001214

Summary: ENOSPC on btrfs balance on almost empty filesystem
Product: [Fedora] Fedora Reporter: Ralf Ertzinger <redhat-bugzilla>
Component: kernelAssignee: fedora-kernel-btrfs
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: gansalmon, itamar, jonathan, josef, kernel-maint, madhu.chinakonda, marcelo.barbosa
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-23 20:20:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralf Ertzinger 2013-08-26 18:46:09 UTC
Description of problem:
Converting a btrfs RAID10 filesystem to RAID1 using balance ends with ENOSPC errors although there should be ample space

Version-Release number of selected component (if applicable):
kernel-3.10.9-200.fc19.x86_64

How reproducible:
Always

Steps to Reproduce:
# mkfs.btrfs -f -m raid10 -d raid10 /dev/sd{b,c,d,e,f,g}
[...]

# mount /dev/sdb /tank
# btrfs filesystem show /dev/sdb
Label: none  uuid: 64fc9652-004c-4cf1-8be9-90e7a6ea546e
        Total devices 6 FS bytes used 28.00KB
        devid    6 size 2.73TB used 2.00GB path /dev/sdg
        devid    5 size 2.73TB used 2.00GB path /dev/sdf
        devid    4 size 2.73TB used 2.00GB path /dev/sde
        devid    3 size 2.73TB used 2.00GB path /dev/sdd
        devid    2 size 2.73TB used 2.00GB path /dev/sdc
        devid    1 size 2.73TB used 2.02GB path /dev/sdb

# dd if=/dev/zero of=/tank/outfile bs=1M count=10k
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 19.3461 s, 555 MB/s

# umount /tank
# mount /dev/sdb /tank
# md5sum /tank/outfile
2dd26c4d4799ebd29fa31e48d49e8e53  /tank/outfile

# btrfs balance start -dconvert=raid1 -mconvert=raid1 /tank
ERROR: error during balancing '/tank' - No space left on device
There may be more info in syslog - try dmesg | tail

---
[  320.348412] device fsid 64fc9652-004c-4cf1-8be9-90e7a6ea546e devid 1 transid 8 /dev/sdb
[  320.350086] btrfs: disk space caching is enabled
[  320.351432] SELinux: initialized (dev sdg, type btrfs), uses xattr
[  453.781449] btrfs: relocating block group 12914130944 flags 65
[  453.978438] btrfs: relocating block group 9692905472 flags 65
[  463.650472] btrfs: found 3 extents
[  475.883302] btrfs: found 3 extents
[  476.117307] btrfs: relocating block group 6471680000 flags 65
[  476.295196] btrfs: relocating block group 3250454528 flags 65
[  476.450862] btrfs: relocating block group 29229056 flags 68
[  477.161875] btrfs: found 3265 extents
[  477.351047] btrfs: relocating block group 20971520 flags 66
[  477.550992] btrfs: found 2 extents
[  477.744960] btrfs: relocating block group 12582912 flags 1
[  477.940231] btrfs: relocating block group 4194304 flags 4
[  478.153028] btrfs: 3 enospc errors during balance

---

# btrfs filesystem df /tank
Data, RAID10: total=9.00GB, used=8.59GB
Data, RAID1: total=11.00GB, used=1.41GB
System, RAID1: total=32.00MB, used=12.00KB
System: total=4.00MB, used=0.00
Metadata, RAID1: total=1.00GB, used=12.98MB

# umount /tank
# mount /dev/sdb /tank
# md5sum /tank/outfile
2dd26c4d4799ebd29fa31e48d49e8e53  /tank/outfile





The fs is still mountable, and the file seems to be intact. It seems the file is in some kind of limbo, part RAID10, part RAID1.

Comment 1 Ralf Ertzinger 2013-09-16 14:31:44 UTC
Not quite sure where to put this, but this is the kernel-bugzilla entry for this:

https://bugzilla.kernel.org/show_bug.cgi?id=60808

Comment 2 Josh Boyer 2013-09-18 20:53:06 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 19 kernel bugs.

Fedora 19 has now been rebased to 3.11.1-200.fc19.  Please test this kernel update and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you experience different issues, please open a new bug report for those.

Comment 3 Josef Bacik 2013-09-23 20:20:11 UTC
Fixed the upstream bugzilla.