• Steve French's avatar
    smb3: allow previous versions to be mounted with snapshot= mount parm · cdeaf9d0
    Steve French authored
    mounting with the "snapshots=" mount parm allows a read-only
    view of a previous version of a file system (see MS-SMB2
    and "timewarp" tokens, section 2.2.13.2.6) based on the timestamp
    passed in on the snapshots mount parm.
    
    Add processing to optionally send this create context.
    
    Example output:
    
    /mnt1 is mounted with "snapshots=..." and will see an earlier
    version of the directory, with three fewer files than /mnt2
    the current version of the directory.
    
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# cat /proc/mounts | grep cifs
    //172.22.149.186/public /mnt1 cifs
    ro,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,snapshot=131748608570000000,actimeo=1
    
    //172.22.149.186/public /mnt2 cifs
    rw,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1
    
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1
    EmptyDir  newerdir
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1/newerdir
    
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2
    EmptyDir  file  newerdir  newestdir  timestamp-trace.cap
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2/newerdir
    new-file-not-in-snapshot
    
    Snapshots are extremely useful for comparing previous versions of files or directories,
    and recovering from data corruptions or mistakes.
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
    cdeaf9d0
smb2pdu.c 119 KB