mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
STABLE14-ubik-recovery-swap-in-new-fd-20080428
LICENSE IPL10
when recovery is done, forcibly invalidate the old fd
(cherry picked from commit 888bc28b18
)
This commit is contained in:
parent
602963f781
commit
19c0fdda30
@ -130,7 +130,7 @@ uphys_close(register int afd)
|
||||
return EBADF;
|
||||
tfd = fdcache;
|
||||
for (i = 0; i < MAXFDCACHE; i++, tfd++) {
|
||||
if (tfd->fd == afd) {
|
||||
if (tfd->fd == afd && tfd->fileID != -10000) {
|
||||
tfd->refCount--;
|
||||
return 0;
|
||||
}
|
||||
@ -282,3 +282,20 @@ uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile)
|
||||
uphys_close(fd);
|
||||
return code;
|
||||
}
|
||||
|
||||
void
|
||||
uphys_invalidate(register struct ubik_dbase *adbase, afs_int32 afid)
|
||||
{
|
||||
register int i;
|
||||
register struct fdcache *tfd;
|
||||
|
||||
/* scan file descr cache */
|
||||
for (tfd = fdcache, i = 0; i < MAXFDCACHE; i++, tfd++) {
|
||||
if (afid == tfd->fileID) {
|
||||
tfd->fileID = -10000;
|
||||
if (tfd->fd >= 0 && tfd->refCount == 0)
|
||||
close(tfd->fd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -648,6 +648,8 @@ urecovery_Interact(void *dummy)
|
||||
#endif
|
||||
if (!code)
|
||||
code = rename(pbuffer, tbuffer);
|
||||
if (!code)
|
||||
code = (*ubik_dbase->open) (ubik_dbase, 0);
|
||||
if (!code)
|
||||
#endif
|
||||
/* after data is good, sync disk with correct label */
|
||||
|
@ -615,6 +615,8 @@ SDISK_SendFile(rxcall, file, length, avers)
|
||||
#endif
|
||||
if (!code)
|
||||
code = rename(pbuffer, tbuffer);
|
||||
if (!code)
|
||||
code = (*ubik_dbase->open) (ubik_dbase, 0);
|
||||
if (!code)
|
||||
#endif
|
||||
code = (*ubik_dbase->setlabel) (dbase, file, avers);
|
||||
|
@ -208,7 +208,7 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort,
|
||||
tdb->read = uphys_read;
|
||||
tdb->write = uphys_write;
|
||||
tdb->truncate = uphys_truncate;
|
||||
tdb->open = 0; /* this function isn't used any more */
|
||||
tdb->open = uphys_invalidate; /* this function isn't used any more */
|
||||
tdb->sync = uphys_sync;
|
||||
tdb->stat = uphys_stat;
|
||||
tdb->getlabel = uphys_getlabel;
|
||||
|
@ -303,7 +303,8 @@ extern int uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile,
|
||||
extern int uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile,
|
||||
struct ubik_version *aversion);
|
||||
extern int uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile);
|
||||
|
||||
extern void uphys_invalidate(register struct ubik_dbase *adbase,
|
||||
afs_int32 afid);
|
||||
|
||||
/* recovery.c */
|
||||
extern int urecovery_ResetState(void);
|
||||
|
Loading…
Reference in New Issue
Block a user