mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
vol_split: avoid using stale open directory vnodes
we could in case of multiple splits end up using a stale open vnode for a directory; attempt to close and thus force-reopen any fdhandles backing ihandles. Change-Id: I50ff39873b523b05287c7a183d84e6f16eb7cd90 Reviewed-on: http://gerrit.openafs.org/5553 Reviewed-by: Hartmut Reuter <reuter@rzg.mpg.de> Tested-by: Derrick Brashear <shadow@dementix.org> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
4a1d319177
commit
3df03f0abe
@ -247,6 +247,15 @@ copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh)
|
|||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
outfdP = IH_OPEN(outh);
|
outfdP = IH_OPEN(outh);
|
||||||
|
/*
|
||||||
|
* In case that a file with the same (NAMEI) name existed before and is still
|
||||||
|
* open outfdP may point to the wrong (unlinked) file. To make sure we write
|
||||||
|
* into the correct file it's safer to 1st FDH_REALLYCLOSE it and then to
|
||||||
|
* re-open it.
|
||||||
|
*/
|
||||||
|
if (outfdP)
|
||||||
|
FDH_REALLYCLOSE(outfdP);
|
||||||
|
outfdP = IH_OPEN(outh);
|
||||||
if (!outfdP) {
|
if (!outfdP) {
|
||||||
sprintf(m->line, "Couldn't open output directory %u.%u.%u\n",
|
sprintf(m->line, "Couldn't open output directory %u.%u.%u\n",
|
||||||
outfdP->fd_ih->ih_vid,
|
outfdP->fd_ih->ih_vid,
|
||||||
@ -496,7 +505,7 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent,
|
|||||||
afs_int32 code;
|
afs_int32 code;
|
||||||
Inode ino, newino;
|
Inode ino, newino;
|
||||||
DirHandle dir;
|
DirHandle dir;
|
||||||
IHandle_t *h;
|
IHandle_t *h, *hp;
|
||||||
struct VnodeDiskObject vnode;
|
struct VnodeDiskObject vnode;
|
||||||
FdHandle_t *fdP, *fdP2;
|
FdHandle_t *fdP, *fdP2;
|
||||||
afs_uint64 size;
|
afs_uint64 size;
|
||||||
@ -605,6 +614,13 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent,
|
|||||||
code = afs_dir_Create(&dir, name, &fid);
|
code = afs_dir_Create(&dir, name, &fid);
|
||||||
FidZap(&dir);
|
FidZap(&dir);
|
||||||
|
|
||||||
|
/* Make sure the directory file doesn't remain open */
|
||||||
|
IH_INIT(hp, V_device(vol), V_parentId(vol), ino);
|
||||||
|
fdP = IH_OPEN(hp);
|
||||||
|
if (fdP)
|
||||||
|
FDH_REALLYCLOSE(fdP);
|
||||||
|
IH_RELEASE(hp);
|
||||||
|
|
||||||
class = vLarge;
|
class = vLarge;
|
||||||
vcp = &VnodeClassInfo[class];
|
vcp = &VnodeClassInfo[class];
|
||||||
fdP = IH_OPEN(vol->vnodeIndex[class].handle);
|
fdP = IH_OPEN(vol->vnodeIndex[class].handle);
|
||||||
|
Loading…
Reference in New Issue
Block a user