[Samba] vfs_shadow_copy2: unmount snapshot while user is restoring from it
alex at zadarastorage.com
Mon Feb 8 16:33:25 UTC 2016
I am trying to use vfs_shadow_copy2 with samba samba-4.2.7.
I have a share exported at /export/smb400/. A snapshot of the share is on a
separate block device, which is mounted at
configuration for the share is:
vfs objects = shadow_copy2
shadow:snapdir = /export_shadows/volume-00000001
shadow:fixinodes = yes
(Note: I had to pull two patches by Uri Simchoni to make the snapshots
mounted outside of the share working  and ).
Everything is working fine, and on Windows the “Previous version" tab allows
to restore files from the snapshot.
However, when a large file (say 10GB) is being restored, during that time it
is not possible to unmount the snapshot block device, because Samba is
holding open file descriptors on its mount point. Question: is there a way
to forcefully unmount the snapshot block device, such that all ongoing
Restore operations will fail?
I did some debugging and saw that during the Restore process
shadow_copy2_fstat() is being called a lot (by
smb_vfs_call_copy_chunk_send). So I tried to return a failure in this
function (-1 with errno=ENOENT). I saw that it indeed helps: Restore
operation hits an error. But it takes about 10 seconds, until unmount of the
snapshot finally succeeds.
My question is: is there any other operation in “vfs_fn_pointers” that I can
implement or fail to make vfs_shadow_copy2 quickly close all open file
descriptors, such that unmount of the snapshot succeeds?
vfs_shadow_copy2: add shadow_copy2_do_convert()
vfs_shadow_copy2: fix case where snapshots are outside the share
More information about the samba