windows-hard-link-count-20090628

LICENSE MIT

cm_Link() is used to create hard links.  It did not apply the updated
link target status info to the target cm_scache_t object.  As a result
the linkCount would be incorrect.

cm_Unlink() did not take linkCount into account.  It did not reduce the
locally known linkCount, nor did it invalidate any currently known
callback.  As a result the linkCount would be incorrect.
This commit is contained in:
Jeffrey Altman 2009-06-29 04:25:16 +00:00
parent d54859c6ac
commit b8a1dba293

View File

@ -1629,7 +1629,9 @@ long cm_Unlink(cm_scache_t *dscp, fschar_t *fnamep, clientchar_t * cnamep,
cm_ReleaseSCache(scp);
if (code == 0) {
lock_ObtainWrite(&scp->rw);
scp->flags |= CM_SCACHEFLAG_DELETED;
if (--scp->linkCount == 0)
scp->flags |= CM_SCACHEFLAG_DELETED;
cm_DiscardSCache(scp);
lock_ReleaseWrite(&scp->rw);
}
}
@ -3036,6 +3038,13 @@ long cm_Link(cm_scache_t *dscp, clientchar_t *cnamep, cm_scache_t *sscp, long fl
}
cm_EndDirOp(&dirop);
/* Update the linked object status */
if (code == 0) {
lock_ObtainWrite(&sscp->rw);
cm_MergeStatus(NULL, sscp, &newLinkStatus, &volSync, userp, 0);
lock_ReleaseWrite(&sscp->rw);
}
free(fnamep);
return code;