Stat() failed on subfolder of cifs mount

Nextcloud version (eg, 12.0.2): 15.0.5
Operating system and version (eg, Ubuntu 17.04): CentOS Linux release 7.4.1708 (Core)
Apache or nginx version (eg, Apache 2.4.25): httpd-2.4.6-67.el7.centos.6.x86_64
PHP version (eg, 7.1): 7.2 remi

The issue you are facing:
Using subfolders of a CIFS-mount as local storage is not possible, even if OS-level access is perfectly fine.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Mount a samba/CIFS share to /mnt/samba/
  2. Adjust the permissions to this folder, so that the httpd/apache user has access (in my case this user is called apache, group apache) (in my case SELINUX is disabled, so this should not harm).
  3. Add a local storage using some directory that is not inside a CIFS mount >= this works.
  4. Add the folder /mnt/samba as a local storage => this works
  5. Create a subfolder using your apache-user
sudo -u apache mkdir /mnt/samba/foobar
  1. Add this subfolder as a local storage to your Nextcloud => this fails
  2. Check that the apache user can successfully execute stat:
sudo -u apache stat /mnt/samba/foobar

The output of your Nextcloud log in Admin > Logging:

stat(): stat failed for \/mnt\/samba\/foobar\/ at \/var\/www\/html\/nextcloud\/lib\/private\/Files\/Storage\/Local.php#142

The output of your Apache/nginx/system log in /var/log/____:

none