The "sys_path_to_bdev() failed for path [.]!" error has already been
posted upstream 5 years ago
(https://bugzilla.samba.org/show_bug.cgi?id=10541), yet this error still
shows up. It doesn't do harm in my setup, but it's annoying and clutters
the logs. I've done some Google-Fu on this matter and I think I've found
the root cause and an easy workaround.

The culprit seems to be within sys_path_to_bdev(): getmntent(). Issue
is, if you have a nested BTRFS subvolume as a Samba share, which gets
auto-mounted by its parents, there is no fstab entry for this subvolume,
but getmntent() looks in fstab for mount points.

Lets say your fstab contains / and /srv as mount points, but you have
created a BTRFS subvolume for your share /srv/samba/share. getmntent()
tries to find /srv/samba/share in fstab, but fails, thus leading to that
error message. Sidenote: there are good reasons to use BTRFS subvolumes
for shares e.g. snapper support via "vfs object = snapper", which
**requires** the share to be a BTRFS subvolume.

Knowing the root cause, the workaround is pretty simple: add the BTRFS
subvolume you're using for Samba to /etc/fstab.

Also: if your Samba share is not a BTRFS subvolume itself, but it's
located under an auto-mounted BTRFS subvolume, will still require you to
add that subvolue to /etc/fstab. E.g. /srv is in /etc/fstab, /srv/samba
is a BTRFS subvolume and your share is a usual folder /srv/samba/share,
you will need to add /srv/samba to /etc/fstab.

I've successfully tried this workaround on samba 4.10.10-2, kernel
5.3.11.1-1, btrfs-progs 5.3.1-3 on Arch Linux. Should also work on
Ubuntu.

Hope this helps someone.

Cheers,
Tolga

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1735953

Title:
  samba mount fails to write

To manage notifications about this bug go to:
https://bugs.launchpad.net/samba/+bug/1735953/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to