open files

Jason M. Felice jfelice at cronosys.com
Sun Feb 22 18:41:59 GMT 2004


On Sun, Feb 22, 2004 at 08:13:33PM +0200, Ville Herva wrote:
> Hi!
> 
> I had a brief look sometime ago at hacking something like this into rsync,
> but I didn't find a C API for reparse points. If you make progress, please
> keep me (or rsync mailing list) posted!
> 
> On Fri, Feb 20, 2004 at 12:26:56PM -0500, you [Jason M. Felice] wrote:
> > > jason::
> > > Win32 backup semantics : what are these?????
> > 
> > Like anything else in Windows, it's a kludge ontop of a kludge ontop of
> > another kludge in order to fix the original kludge.  Since Windows
> > programs can't rely on being able to open files that other programs have
> > open, there would be no way to write a useful tape backup program.  To
> > fix, they added "backup semantics".  If your process has permission to
> > do so, it can request backup semantics which will allow it to open files
> > which are already open.  
> > 
> > Of course it's this sort of thinking which is the reason why the Windows
> > API to open a stupid file has seven parameters and a buttload of flags
> > and pointers to structures which no longer work in recent versions of
> > Windows.  </rant>
> 
> Well apart from being kludge, there is some merit to the Windows solution.
> I'm not sure what exactly you are referring to with "backup semantics", but
> I've understood ntbackup.exe on W2k or newer uses reparse points for backing
> up files. That way it is not only capable of reading files that are open for
> writing, but also gets a (somewhat) consistent snapshot of the files that
> are written to. 
> 
> For example, Outlook likes to create mailboxes that are ~1GB. Rsyncing them
> takes a considerable amount of time. During that time, Outlook may write all
> over the file which mean the rsync's backep up version will be hugely
> inconsistent. With a reparse point, the backup file will be a snapshot of
> one point of time -- Outlook may have been in the middle of writing
> something, but the the situation is similar to a sudden powerloss, and
> Outlook has much better chance at recovering.
> 
> So do you reparse points by "backup sementics" or "just" being able to read
> every open file (backup capability)?

I don't know anything about reparse points, just being able to read open files.

>  
> > I've received a reply from the Cygwin people that suggests Cygwin
> > _always_ uses backup semantics, and a little information about how.  It's
> > some pretty hairy code and I'm still deciphering it, but it could be that
> > I was authoring that patch for nothing.  I'll post more when I figure it
> > out.
> 
> Hmm, cygwin always uses backup semantics for what? Everything? The rsync
> I've compiled on cygwin does fail to read certain files...

It appears that Cygwin always uses backup semantics
(FILE_FLAG_BACKUP_SEMANTICS flag to CreateFile() API); however, for this
to have an effect, the process needs SE_BACKUP_NAME/SE_RESTORE_NAME
permissions.  I've never deciphered the NT permissions system, but
that's what I'm attempting to do now.  There's tokens and permissions
and access lists and all sorts of strangeness in it.  IIRC, the process
needs to request something, even if it has permission to use the
SE_BACKUP_NAME permission.  *sigh*  I will keep the list posted.

> regards,
> 
> -- v --
> 
> v at iki.fi

-- 
 Jason M. Felice
 Cronosys, LLC <http://www.cronosys.com/>
 216.221.4600 x302


More information about the rsync mailing list