In a setup where GlusterFS snapshots are browsed to list previous versions of a directory, it says "There are no previous versions available". Following is the configuration: # testparm -s Load smb config files from /usr/local/etc/samba/smb.conf Loaded services file OK. Weak crypto is allowed Server role: ROLE_STANDALONE # Global parameters [global] clustering = Yes load printers = No log file = /usr/local/var/log/samba/log.%I netbios name = GFS-SMB-CLUSTER security = USER server string = Samba Server idmap config * : backend = tdb [gluster-vol] comment = For samba share of volume vol kernel share modes = No path = / read only = No vfs objects = shadow_copy2 glusterfs shadow:format = _GMT-%Y.%m.%d-%H.%M.%S shadow:snapprefix = ^s[A-Za-z0-9]*p$ shadow:sort = desc shadow:basedir = / shadow:snapdir = /.snaps glusterfs:loglevel = 7 glusterfs:logfile = /usr/local/var/log/samba/glusterfs-vol.%M.log glusterfs:volume = vol As a side effect snapshot directories are not browsable from SMB clients: # smbclient \\\\192.168.122.101\\gluster-vol -U anoopcs%smb Try "help" to get a list of possible commands. smb: \> cd .snaps\ smb: \.snaps\> ls . D 0 Thu Nov 12 10:44:49 2020 .. D 0 Wed Nov 4 16:11:30 2020 snap_GMT-2020.10.09-09.48.22 D 0 Fri Oct 9 15:17:41 2020 snap_GMT-2020.10.12-11.05.59 D 0 Fri Oct 9 15:17:41 2020 1044984 blocks of size 1024. 970284 blocks available smb: \.snaps\> cd snap_GMT-2020.10.12-11.05.59 cd \.snaps\snap_GMT-2020.10.12-11.05.59\: NT_STATUS_FILE_IS_A_DIRECTORY smb: \.snaps\> exit Steps to reproduce: 1. Have a GlusterFS-Samba setup 2. Create some files and directories 3. Create and activate snapshots using `gluster` command line utility 4. Try to list Previous versions by right clicking on directories. Additional info: [2020/11/11 16:04:59.437798, 10, pid=99412, effective(1001, 1001), real(1001, 0)] ../../source3/smbd/open.c:813(fd_open) fd_open: name .snaps/snap_GMT-2020.10.12-11.05.59, flags = 0200000 mode = 00, fd = -1. Is a directory [2020/11/11 16:04:59.437840, 5, pid=99412, effective(1001, 1001), real(1001, 0)] ../../source3/smbd/open.c:4534(open_directory) open_directory: Could not open fd for .snaps/snap_GMT-2020.10.12-11.05.59 (NT_STATUS_FILE_IS_A_DIRECTORY) . . . [2020/11/11 16:04:59.438458, 10, pid=99412, effective(1001, 1001), real(1001, 0)] ../../source3/smbd/open.c:5854(create_file_unixpath) create_file_unixpath: NT_STATUS_FILE_IS_A_DIRECTORY [2020/11/11 16:04:59.438489, 10, pid=99412, effective(1001, 1001), real(1001, 0)] ../../source3/smbd/open.c:6046(create_file_default) create_file: NT_STATUS_FILE_IS_A_DIRECTORY
vfs_shadow_copy2_openat() replaces received open flags with just O_RDONLY which results in calling glfs_open() instead of glfs_opendir() causing EISDIR while trying to open "."
This bug was referenced in samba master: e9e06a11daf036abf7a7022ebc8eaefde178aa52
Created attachment 16334 [details] git-am fix for 4.13.next.
Comment on attachment 16334 [details] git-am fix for 4.13.next. Cherry-pick from master.
Comment on attachment 16334 [details] git-am fix for 4.13.next. LGTM
Created attachment 16335 [details] patch for v4-12 and v4-11 Backports for older versions since the overwrite with O_RDONLY is present as well.
Karolin, please add to the relevant branches. Thanks!
(In reply to Guenther Deschner from comment #7) Pushed to autobuild-v4-{13,12}-test.
This bug was referenced in samba v4-13-test: 8c82d0fd49b0406b34e60f49fd4c3b2ff95cb049
This bug was referenced in samba v4-12-test: b3665f70109b634564974de966d255807c0547f0
Pushed to both branches. Closing out bug report. Thanks!
This bug was referenced in samba v4-13-stable (Release samba-4.13.3): 8c82d0fd49b0406b34e60f49fd4c3b2ff95cb049
This bug was referenced in samba v4-12-stable (Release samba-4.12.11): b3665f70109b634564974de966d255807c0547f0