Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files with very long name will become not accessible after converting #31

Closed
keuin opened this issue Sep 26, 2021 · 4 comments
Closed

Comments

@keuin
Copy link

keuin commented Sep 26, 2021

I have a file with a very long name which contains non-ascii characters (Japanese and its marks). After converting the partition from NTFS to btrfs under Windows, the file become inaccessible with Winbtrfs. The file cannot be read or deleted with explorer.exe. The partition cannot be mounted under Linux with following error:

[  773.543848] BTRFS info (device sdd1): disk space caching is enabled
[  773.543851] BTRFS info (device sdd1): has skinny extents
[  774.873924] BTRFS critical (device sdd1): corrupt leaf: root=2 block=1489133600768 slot=176 bg_start=4000763084800 bg_len=23003136, invalid block group used, have 23064576 expect [0, 23003136)
[  774.873927] BTRFS error (device sdd1): block=1489133600768 read time tree block corruption detected
[  774.873934] BTRFS error (device sdd1): failed to read block groups: -5
[  774.890804] BTRFS error (device sdd1): open_ctree failed

In NTFS, file names can be at most 255 unicode characters. While in btrfs, the limit is 255 Bytes. Maybe we need truncate names exceeded the length limit?

@keuin
Copy link
Author

keuin commented Sep 26, 2021

btrfsck without --repair reported:

# btrfsck /dev/sdd1
Opening filesystem to check...
Checking filesystem on /dev/sdd1
UUID: <REDACTED>
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
[4/7] checking fs roots
root 5 inode 24364 errors 40000
Dir items with mismatch hash:
        name: <REDACTED FILE NAME> namelen: 255 wanted 0x46feff6b has 0x5259de5e
root 5 inode 81055 errors 1, no inode item
root 5 inode 81110 errors 1, no inode item
root 5 inode 81158 errors 1, no inode item
root 5 inode 81213 errors 1, no inode item
root 5 inode 81266 errors 1, no inode item
root 5 inode 81321 errors 1, no inode item
root 5 inode 81373 errors 1, no inode item
root 5 inode 81430 errors 1, no inode item
root 5 inode 81482 errors 1, no inode item
root 5 inode 81532 errors 1, no inode item
root 5 inode 81584 errors 1, no inode item
root 5 inode 81639 errors 1, no inode item
root 5 inode 81695 errors 1, no inode item
root 5 inode 81751 errors 1, no inode item
root 5 inode 81804 errors 1, no inode item
root 5 inode 81863 errors 1, no inode item
root 5 inode 81918 errors 1, no inode item
root 5 inode 81973 errors 1, no inode item
root 5 inode 82028 errors 1, no inode item
root 5 inode 82083 errors 1, no inode item
root 5 inode 82139 errors 1, no inode item
root 5 inode 82190 errors 1, no inode item
root 5 inode 82242 errors 1, no inode item
root 5 inode 82293 errors 1, no inode item
root 5 inode 82347 errors 1, no inode item
root 5 inode 82399 errors 1, no inode item
root 5 inode 82451 errors 1, no inode item
root 5 inode 82505 errors 1, no inode item
root 5 inode 82560 errors 1, no inode item
root 5 inode 82617 errors 1, no inode item
root 5 inode 82672 errors 1, no inode item
root 5 inode 82723 errors 1, no inode item
root 5 inode 82778 errors 1, no inode item
root 5 inode 82831 errors 1, no inode item
root 5 inode 82884 errors 1, no inode item
root 5 inode 82937 errors 1, no inode item
root 5 inode 230227 errors 2000, link count wrong
        unresolved ref dir 24364 index 1867 namelen 255 name <REDACTED FILE NAME> filetype 1 errors 101, no dir item, name too long
ERROR: errors found in fs roots
found 3096924971008 bytes used, error(s) found
total csum bytes: 3020416744
total tree bytes: 4016390144
total fs tree bytes: 388022272
total extent tree bytes: 189480960
btree space waste bytes: 366626121
file data blocks allocated: 6154865479680
 referenced 6154865479680

Note that <REDACTED FILE NAME> is the truncated file name (whose length is exactly 255 Bytes encoded with utf-8).

@maharmstone
Copy link
Owner

Good point - it really should be truncating these filenames and showing a warning. I'll fix it in the next version.

If I were you, I'd rollback the filesystem, rename the offending file, and try again.

@keuin
Copy link
Author

keuin commented Sep 26, 2021

Good point - it really should be truncating these filenames and showing a warning. I'll fix it in the next version.

If I were you, I'd rollback the filesystem, rename the offending file, and try again.

Thank you. I will rollback and try again soon.

@maharmstone
Copy link
Owner

Fixed by 1317c88.

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

No branches or pull requests

2 participants