Bug 14896 - vfs_snapper don't work as Windows "Previous Versions"
Summary: vfs_snapper don't work as Windows "Previous Versions"
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.14.9
Hardware: All All
: P5 normal with 10 votes (vote)
Target Milestone: ---
Assignee: David Disseldorp
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-08 03:16 UTC by yasuhiro.handa
Modified: 2024-06-21 01:04 UTC (History)
3 users (show)

See Also:


Attachments
smb.conf log.smbd journal log image1.png image2.png (432.80 KB, application/zip)
2021-11-08 03:16 UTC, yasuhiro.handa
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description yasuhiro.handa 2021-11-08 03:16:16 UTC
Created attachment 16965 [details]
smb.conf log.smbd journal log image1.png image2.png

vnf_snapper doesn't work as Windows "Previous Versions".
I tried samba 4.12.15, and it worked fine.
But, 4.14.9 and 4.15.0 don't work.
I tried Fedora 34, 33 and openSUSE 15.3 clean install, but same result.

Symptoms
  Top shared directory is fine.
    image1.png

  Sub directories do not work with an error.
    image2.png

Error within journal.
Nov 07 23:21:24 fedora smbd[34580]: [2021/11/07 23:21:24.956684,  0, pid=34580, effective(0, 0), real(0, 0)] ../../source3/smbd/filename.c:2007(filename_convert_inte>
Nov 07 23:21:24 fedora smbd[34580]:   filename_convert_internal: open_pathref_fsp [test {@GMT-2021.11.07-14.19.41}] failed: NT_STATUS_ACCESS_DENIED

Looks like a dev/ino mismatch has occurred.
log.smbd (log level = 10)
[2021/11/07 23:21:24.956657, 10, pid=34580, effective(0, 0), real(0, 0)] ../../source3/smbd/files.c:537(openat_pathref_fsp)
  openat_pathref_fsp: file [test {@GMT-2021.11.07-14.19.41}] - dev/ino mismatch. Old (dev=55, ino=257). New (dev=55, ino=256).
[2021/11/07 23:21:24.956664, 10, pid=34580, effective(0, 0), real(0, 0)] ../../source3/smbd/files.c:571(openat_pathref_fsp)
  openat_pathref_fsp: Opening pathref for [test {@GMT-2021.11.07-14.19.41}] failed: NT_STATUS_ACCESS_DENIED

I will attach some detailed information.
Comment 1 yasuhiro.handa 2021-11-10 10:59:23 UTC
I tried 4.13.14 with Fedora 34. Same issue occurred.
Comment 2 Yasuma Takeda 2022-07-12 05:36:52 UTC
I found the same problem and have investigated the details.

1. conditions
(1) Setup snapper to get snapshot under a share folder.
(2) The share folder has one or more sub directories.
(3) I try to recover the share folder from snapshot by windows explorer,
    it fails in the progress.

2. versions
4.13.0 and later versions : NG
4.12.15 and before versions : No problem

I investigated why this problem is occured.
I found O_PATH based operations is introduced in Samba 4.13.

The Linux "snapper" creates a new filesystem for a snapshot.
Then vfs-snapper module maps the file and directory which contains
the time information to the files in the backup taken by snapper.

"check_same_dev_ino()" fails because the inode number of the
subdirectory to be restored and the directory under the snapshot
do not match. As a result, NT_STATUS_ACCESS_DENIED error occurs.

I guess that this problem is caused by operations of O_PATH.
But it is difficult to fix by myself.
Comment 3 Philipp Gerlach 2023-05-23 10:05:12 UTC
I am aware that the developers have only limited time and do their best to work in the project. However, I would like to ask friendly If this bug could be assigned to someone so that there is a perspective for a solution.

Thanks!
Comment 4 Björn Jacke 2023-05-24 07:57:17 UTC
https://www.samba.org/samba/support/globalsupport.html has a list of companies that offer Samba support and employ Samba core developers - you might want to contact one of them if you have an urgent business need to get this solved in a shorter time frame.
Comment 5 David Disseldorp 2024-06-21 01:04:16 UTC
(In reply to Yasuma Takeda from comment #2)
> I found the same problem and have investigated the details.
> 
> 1. conditions
> (1) Setup snapper to get snapshot under a share folder.
> (2) The share folder has one or more sub directories.
> (3) I try to recover the share folder from snapshot by windows explorer,
>     it fails in the progress.
> 
> 2. versions
> 4.13.0 and later versions : NG
> 4.12.15 and before versions : No problem

Thanks for providing this information.

> I investigated why this problem is occured.
> I found O_PATH based operations is introduced in Samba 4.13.
> 
> The Linux "snapper" creates a new filesystem for a snapshot.
> Then vfs-snapper module maps the file and directory which contains
> the time information to the files in the backup taken by snapper.
> 
> "check_same_dev_ino()" fails because the inode number of the
> subdirectory to be restored and the directory under the snapshot
> do not match. As a result, NT_STATUS_ACCESS_DENIED error occurs.

Does the error occur when attempting to restore anything from the Explorer previous-versions list, or does it need to be a specific path or type (file / directory)?

Is this still reproducible with the latest Samba version? I'll have a go at reproducing this locally.