• [6.11.5] Cannot write to deep directories with btrfs compression when supported by cache - only 1 directory made each write request


    robobub
    • Annoyance

    Previous title: write "not supported" on cache=yes shares - only 1 level of directory made each write request

     

    For a $share that has cache=yes and a directory that doesn't exist on /mnt/cache/$share, when a write request is given, instead of making all the parent directories to the request, only the first non-existant directory is made.  So for /mnt/cache/$share/1/2/3/file, 4 write requests are required.  The directory is made instantly, and no more directories are made no longer how much time passes.  Until then, both on the server and via SMB, errors are given:

     

    Quote

    root@tower:/mnt/user/Archive/FamilyPhotoVideo/Kids/2020/# touch a
    touch: cannot touch 'a': Operation not supported

    windows_smb_error.png.0260d0b64ab4f477347cc6d6999e925a.png.a3e4c0a1c089da30a3f59de4fc6cd327.png


     

    Explicit setup instructions to reproduce:

     

    Create a new share, test. Set cache=yes. Execute these commands

     

    ## no compression, no issue
    root@Tower:/mnt/user/test# rm -rf /mnt/user/test/1; 
    root@Tower:/mnt/user/test# rm -rf /mnt/cache/test/1 # should be no-op, but just in case
    root@Tower:/mnt/user/test# cd /mnt/disk1/test
    root@Tower:/mnt/disk1/test# v
    total 0
    root@Tower:/mnt/disk1/test# btrfs property get .
    root@Tower:/mnt/disk1/test# ## no compression, no issue
    root@Tower:/mnt/disk1/test# mkdir -p 1/2/3
    root@Tower:/mnt/disk1/test# cd /mnt/user/test/1/2/3/
    root@Tower:/mnt/user/test/1/2/3# touch a
    root@Tower:/mnt/user/test/1/2/3# v /mnt/cache/test/1/2/3/a
    -rw-rw-rw- 1 root root 0 Jan 31 18:13 /mnt/cache/test/1/2/3/a
    root@Tower:/mnt/user/test/1/2/3# cd /mnt/user/test
    
    
    ## re-do test with compression
    root@Tower:/mnt/user/test# rm -rf /mnt/user/test/1; 
    root@Tower:/mnt/user/test# rm -rf /mnt/cache/test/1 # should be no-op, but just in case
    root@Tower:/mnt/user/test# cd /mnt/disk1/test
    root@Tower:/mnt/disk1/test# btrfs property get .
    root@Tower:/mnt/disk1/test# btrfs property set . compression zstd
    root@t1000:/mnt/disk1/test# btrfs property get .
    compression=zlib
    root@Tower:/mnt/disk1/test# mkdir -p 1/2/3
    root@Tower:/mnt/disk1/test# cd /mnt/user/test/1/2/3/
    root@Tower:/mnt/user/test/1/2/3# touch a
    touch: cannot touch 'a': Operation not supported
    root@Tower:/mnt/user/test/1/2/3# tree /mnt/cache/test/
    /mnt/cache/test/
    └── 1
    
    1 directory, 0 files
    root@Tower:/mnt/user/test/1/2/3# touch a
    touch: cannot touch 'a': Operation not supported
    root@Tower:/mnt/user/test/1/2/3# tree /mnt/cache/test/
    /mnt/cache/test/
    └── 1
        └── 2
    
    2 directories, 0 files

    Occurs with zlib, std, lzo.

    Workaround: Does NOT occur with mount -o remount,compress-force, updating this to annoyance

     

     Outdated Test command: 

     

    Quote

    root@tower:/mnt/user/Archive/1/2/3/4/5/6/7/8/9# while (true); do tree /mnt/cache/Archive; touch a; tree /mnt/cache/Archive; echo "Sleeping for 5 seconds..."; sleep 5; done

     

    output: 

    20200119_unraid_cache_write_issue.log

     

    • Occurs on any share with cache=yes on any directory that does not exist on /mnt/cache
    • Occurs in safe mode
    • Array disks are Btrfs-encrypted
    • cache is xfs-encrypted
    • ample free space
    • drives spun up
    • Docker Safe New Permissions has no effect. 
    • This was not necessarily introduced in 6.8.1, this is my first unRAID setup, starting in 6.8.0, and only added a cache drive with 6.8.1
    • occurs on 6.8.2, 6.10.3, 6.11.5, potentially worked on 6.9.0-beta as per this comment

     

    Diagnostics from safe mode:

    tower-diagnostics-20200119-2337.zip

     

    Diagnostics from 6.11.5:

    t1000-diagnostics-20230211-1611.zip

     

    Previous Post in General Support




    User Feedback

    Recommended Comments

    Works for me.

     

    I created a share called 'test' with all defaults except set Use cache to Yes.  Creating the share resulted in creating the 'test' directory on /mnt/disk1

     

    root@Tower:~# cd /mnt/disk1
    root@Tower:/mnt/disk1# v
    total 0
    drwxrwxrwx 2 nobody users 6 Jan 27 11:50 test/
    root@Tower:/mnt/disk1# cd test/
    root@Tower:/mnt/disk1/test# mkdir 1
    root@Tower:/mnt/disk1/test# cd 1/
    root@Tower:/mnt/disk1/test/1# mkdir 2
    root@Tower:/mnt/disk1/test/1# cd 2/
    root@Tower:/mnt/disk1/test/1/2# mkdir 3
    root@Tower:/mnt/disk1/test/1/2# cd /mnt/user/test/1/2/3/
    root@Tower:/mnt/user/test/1/2/3# touch a
    root@Tower:/mnt/user/test/1/2/3# v
    total 0
    -rw-rw-rw- 1 root root 0 Jan 27 11:51 a
    root@Tower:/mnt/user/test/1/2/3# v /mnt/cache/test/1/2/3/a 
    -rw-rw-rw- 1 root root 0 Jan 27 11:51 /mnt/cache/test/1/2/3/a
    root@Tower:/mnt/user/test/1/2/3# v /mnt/disk1/test/1/2/3/
    total 0
    root@Tower:/mnt/user/test/1/2/3# 

     

    Link to comment
    1 hour ago, robobub said:

    With Btrfs-encrypted array disks and xfs-encrypted cache disk?

     

    Any diagnostic recommendations on my end? 

    Encryption doesn't matter.  You can try to reproduce my test on your server.

    Link to comment

    Ah, with a new share the issue doesn't exist.  The issue is caused by using any form of btrfs compression on the disk.  Please see if you can reproduce:

     

    
    ## no compression, no issue
    root@Tower:/mnt/user/test# rm -rf /mnt/user/test/1; 
    root@Tower:/mnt/user/test# rm -rf /mnt/cache/test/1 # should be no-op, but just in case
    root@Tower:/mnt/user/test# cd /mnt/disk1/test
    root@Tower:/mnt/disk1/test# v
    total 0
    root@Tower:/mnt/disk1/test# btrfs property get .
    root@Tower:/mnt/disk1/test# ## no compression, no issue
    root@Tower:/mnt/disk1/test# mkdir -p 1/2/3
    root@Tower:/mnt/disk1/test# cd /mnt/user/test/1/2/3/
    root@Tower:/mnt/user/test/1/2/3# touch a
    root@Tower:/mnt/user/test/1/2/3# v /mnt/cache/test/1/2/3/a
    -rw-rw-rw- 1 root root 0 Jan 31 18:13 /mnt/cache/test/1/2/3/a
    root@Tower:/mnt/user/test/1/2/3# cd /mnt/user/test
    
    
    ## re-do test with compression
    root@Tower:/mnt/user/test# rm -rf /mnt/user/test/1; 
    root@Tower:/mnt/user/test# rm -rf /mnt/cache/test/1 # should be no-op, but just in case
    root@Tower:/mnt/user/test# cd /mnt/disk1/test
    root@Tower:/mnt/disk1/test# btrfs property get .
    root@Tower:/mnt/disk1/test# btrfs property set . compression zlib
    root@t1000:/mnt/disk1/test# btrfs property get .
    compression=zlib
    root@Tower:/mnt/disk1/test# mkdir -p 1/2/3
    root@Tower:/mnt/disk1/test# cd /mnt/user/test/1/2/3/
    root@Tower:/mnt/user/test/1/2/3# touch a
    touch: cannot touch 'a': Operation not supported
    root@Tower:/mnt/user/test/1/2/3# tree /mnt/cache/test/
    /mnt/cache/test/
    └── 1
    
    1 directory, 0 files
    root@Tower:/mnt/user/test/1/2/3# touch a
    touch: cannot touch 'a': Operation not supported
    root@Tower:/mnt/user/test/1/2/3# tree /mnt/cache/test/
    /mnt/cache/test/
    └── 1
        └── 2
    
    2 directories, 0 files

    Occurs with zlib, std, lzo, or chattr +C

    Edited by robobub
    Link to comment

    We've never enabled btrfs compression and there's no standard way to do so, so we've never tested this - apparently there's an issue 🤨  doesn't make sense tho

    Link to comment
    On 7/1/2020 at 8:23 PM, limetech said:

    Your exact sequence seems to work, using 6.9.0-beta

     

    I just tested this on 6.10.2 and the problem exists. I do feel at some point around 6.9 it was working though.


    EDIT: I see 6.10.3 is out, will test on that.

    EDIT2: Problem replicated on 6.10.3

    Edited by robobub
    Link to comment
    On 7/1/2020 at 8:23 PM, limetech said:

    Your exact sequence seems to work, using 6.9.0-beta

    I never ended up testing 6.9.0-beta but did replicate this on 6.11.5. Can you or anyone else try this sequence again?

     

    Side note: When I first upgraded to 6.11.5 it initially appeared to work, but I may not have had the conditions setup correctly and got distracted by other things. So there certainly could be some other configuration I forgot to add.

     

    Motivation: After reading more about zstd's impressive capabilities and thus have every drive set to compress-force=zstd:5 and am now running into this all the time

    Edited by robobub
    Link to comment

    I cannot reproduce this:


     

    root@Tower15:/mnt/user/test/1/2/3# rm -rf /mnt/user/test/1;
    root@Tower15:/mnt/user/test/1/2/3# rm -rf /mnt/user/test/1
    root@Tower15:/mnt/user/test/1/2/3# cd /mnt/disk1/test
    root@Tower15:/mnt/disk1/test# btrfs property set . compression zstd
    root@Tower15:/mnt/disk1/test# btrfs property get .
    compression=zstd
    root@Tower15:/mnt/disk1/test# mkdir -p 1/2/3
    root@Tower15:/mnt/disk1/test# cd /mnt/user/test/1/2/3/
    root@Tower15:/mnt/user/test/1/2/3# touch a
    root@Tower15:/mnt/user/test/1/2/3# tree /mnt/cache/test/
    /mnt/cache/test/
    └── 1
        └── 2
            └── 3
                └── a
    
    3 directories, 1 file
    root@Tower15:/mnt/user/test/1/2/3#

     

    Link to comment
    On 2/2/2023 at 7:17 AM, JorgeB said:

    I cannot reproduce this:


     

    root@Tower15:/mnt/user/test/1/2/3# rm -rf /mnt/user/test/1;
    root@Tower15:/mnt/user/test/1/2/3# rm -rf /mnt/user/test/1
    root@Tower15:/mnt/user/test/1/2/3# cd /mnt/disk1/test
    root@Tower15:/mnt/disk1/test# btrfs property set . compression zstd
    root@Tower15:/mnt/disk1/test# btrfs property get .
    compression=zstd
    root@Tower15:/mnt/disk1/test# mkdir -p 1/2/3
    root@Tower15:/mnt/disk1/test# cd /mnt/user/test/1/2/3/
    root@Tower15:/mnt/user/test/1/2/3# touch a
    root@Tower15:/mnt/user/test/1/2/3# tree /mnt/cache/test/
    /mnt/cache/test/
    └── 1
        └── 2
            └── 3
                └── a
    
    3 directories, 1 file
    root@Tower15:/mnt/user/test/1/2/3#

     

     

     

    Interesting, thanks for trying it out. Just now I reproduced the operation not supported again on my system after recreating my array (though not reformatting all of my disks). Any thoughts as to what it could?

     

    You are on 6.11.5 as well? What filesystem/encryption type do you have on cache and disk1 (I am using xfs-encrypted and btrfs-encrypted for reference)? Is disk1 the next drive to be written to based on your allocation method? Do you have space_cache=v2 on your btrfs mount options `mount | grep btrfs`?

     

    EDIT: Or a diagnostics would be sufficient instead of these individual questions . My diagnostics for the original 6.8.2 and with 6.11.5 are in the OP

     

    If you are up for trying more commands, can you do a `ls -l /mnt/cache/test; ls -l /mnt/disk*/test` ? 

     

    Also perhaps a `tree /mnt/cache/test` and `tree /mnt/disk*/test` before and after the mkdir and the touch steps? And maybe with `mount -o remount,compress-force=zstd /mnt/disk1`? You can undo it with `mount -o remount,compress-force=none /mnt/disk1`

     

    EDIT: Some further testing:

    I tried making /mnt/disk1/test/1/2/3 with compress=no then changing compress=zstd on just /mnt/disk1/test and it succeeds. Then I did the inverse, and (folders made with compress=zstd, then setting the root to compress=no) and it fails.

     

    I then made folder test/1/2 both with with compress=no, then went into that and made 3/4/5 after setting test/1/2 to compress=zstd, and then verified that when touching a file and having operation not supported, it made /mnt/cache/1/2/ (e.g. the number of folders deep with compress=no) then stopped

     

    Any thoughts as to what it could be are welcome.

    Edited by robobub
    Link to comment

    So it actually does not occur with mount -o remount,compress-force=zstd by itself. My disks still had btrfs set compress on specific folders, which at least for my setup, causes this issue. When removing per-folder settings, I do not get this error.

     

    It still would be nice to set higher compression levels and more expensive algorithms on certain folders (at least for whatever is different in my setup than JorgeB's), but this is good enough for now, so I'll downgrade this to "Annoyance"

    Link to comment


    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Restore formatting

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Status Definitions

     

    Open = Under consideration.

     

    Solved = The issue has been resolved.

     

    Solved version = The issue has been resolved in the indicated release version.

     

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

    Retest = Please retest in latest release.


    Priority Definitions

     

    Minor = Something not working correctly.

     

    Urgent = Server crash, data loss, or other showstopper.

     

    Annoyance = Doesn't affect functionality but should be fixed.

     

    Other = Announcement or other non-issue.