Thoughts on correct support for Windows Previous versions

Richard Sharpe realrichardsharpe at gmail.com
Sun Jan 25 18:49:35 MST 2015


When we implemented support for Windows Previous Versions at Panzura
we started with one of the existing Shadow Copy modules and adapted it
to the SnapShots provided by the file system (ZFS-based), and life
seemed good.

Then in came the bug reports from QA and we were forced to check what
Windows actually did.

At first I assumed that Windows would return an error like
STATUS_ACCESS_DENIED if one tried to open a previous version for
write-like access, eg, opening a previous version in Notepad or
wordpad, but this turned out to be incorrect. In fact, Windows allows
you to do that, at least according to our tests, but returns
STATUS_MEDIA_WRITE_PROTECTED.

We also found that Windows will ask for FS_INFO on open files,
presumably to check that the volume is write protected.

This does lead to some interesting problems, because it means that
when the client asks for WRITE access to a file and the ACL allows it,
you then try to open the file for WRITE access, but the file system
denies it (or at least ours did) and returns EROFS. You have to turn
around and open the file RO and pretend that you opened it for WRITE
to get the correct behavior.

Unfortunately, at Panzura we modified Samba too much, and I am now
convinced that most of the changes could have been done in the VFS
module we had.

However, there are a few small changes I think are needed. One is to
add a field to the FSP to record whether or not a file is a previous
version. This would only ever be set by a VFS module providing
previous versions functionality, but it seems simpler than adorning
the FSP with an extension and is needed in one place in Samba.

The other one is to pass an FSP into one function and to return the
correct value when Windows asks for FS_INFO on an open file.

Attached is a patch for discussion that makes those changes.

However, this might not be enough because VFS calls like ntimes does
not get passed an FSP (something I want to fix at some time as well,
as soon as 4.2 is finally cut.) (The only way to return
STATUS_MEDIA_WRITE_PROTECTED from VFS modules is if all functions that
implement WRITE-like behavior get access to the FSP.)

Over the next few weeks I will try to get a capture of the behavior of
Windows with respect to getting FS_INFO on an open file to document
this.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win-prev-versions.patch
Type: text/x-patch
Size: 2780 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150125/ba742784/attachment.bin>


More information about the samba-technical mailing list