Open riobard opened 1 year ago
If you could simply tell me how to configure the btrfs subvolume, it would be very helpful for me to quickly reproduce this problem.
You could find many tutorials online to setup btrfs filesystem and subvolumes, e.g. https://linuxhint.com/create-mount-btrfs-subvolumes/
The difficult part is that I'm unable to reliably reproduce the behavior. The directory-shown-as-file symptom seems a result of interaction between btrfs subvolumes with snapshots and ksmbd
(recall that samba
does not have this problem), but I cannot just create new directories to reproduce the symptom (though existing problematic directories can reliably be shown as files on clients). It might have something to do with non-unique inode numbers as the article (https://lwn.net/Articles/866582/) suggests, or it might be some other problems.
I was hoping you could provide me some directions or tools to further investigate, as the issue seems pretty intricate to trigger.
Okay. Let me check it.
Symptom
Some (not all) directories in
btrfs
subvolumes onksmbd
servers appear as files when mounted over SMB on Windows and macOS clients.On
ksmbd
serverNote that the leading
d
indicates bothDir1
andDir2
are (real) directories, however their parent/mnt/raid/shares/Public
and grandparent/mnt/raid/shares
are bothbtrfs
subvolumes. The root of thebtrfs
filesystem is mounted at/mnt/raid
.On Windows/macOS client after mounting the share over SMB3,
Dir2
somehow becomes a file, e.g. on macOSNote the missing leading
d
forDir2
. Additionally on macOS, attempting to list/Volumes/root/mnt/raid
causes Terminal.app to stuck and Finder.app to beachball (application not responding).None of the above happens with Samba server.
Environment
Related
https://github.com/cifsd-team/ksmbd/issues/556 looks related and also involves
btrfs
subvolumes, but its symptom is different from this one.https://lwn.net/Articles/866582/ might give some clues but I don't really understand the underlying mechanisms.
Please let me know how I could further investigate and provide additional information to pinpoint the root cause.
Thanks very much!