This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: forkables: About hardlink creation and NTFS transaction in rename()
- From: Michael Haubenwallner <michael dot haubenwallner at ssi-schaefer dot com>
- To: cygwin-developers at cygwin dot com
- Date: Fri, 25 Nov 2016 15:03:40 +0100
- Subject: Re: forkables: About hardlink creation and NTFS transaction in rename()
- Authentication-results: sourceware.org; auth=none
- References: <8804b006-de61-9ebd-a386-9cc579c88564@ssi-schaefer.com>
On 11/21/2016 04:19 PM, Michael Haubenwallner wrote:
> Hi Corinna,
>
> now working with the cygfork patches (hardlinks to retain forkability
> beyond exe/dll update): when creating the forkable hardlink using the
> earlier opened file handle I may get STATUS_TRANSACTION_NOT_ACTIVE.
>
> It turns out that when loaded 'some.dll' was readonly, then
> rename("new/some.dll", "some.dll") uses an NTFS-transaction to drop
> the readonly attribute, breaking the subsequent hardlink creation
> of "/var/run/cygfork/.../soname.dll" via the original file handle.
I've been wrong here about the readonly flag:
The transaction is started in rename() where the initial
NtSetInformationFile (Rename) returns STATUS_ACCESS_DENIED,
simply because the target "some.dll" is in use.
Not starting that transaction keeps the previously opened file handle
intact to subsequently create a hardlink. But the transaction makes
sense - so what can I do for the original file handle?
> Now I can see these options:
> * As using NTFS transactions seems not to be recommended any more,
> might we drop the NTFS transaction from rename() and _unlink_nt ()?
> * Or do I need to create an NTFS-transaction in dll_list::alloc()
> when opening the original dll file handle?
>
> Thoughts?
Thanks!
/haubi/