OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_1-538-ga193d76
Gerrit Code Review
gerrit@openafs.org
Wed, 9 Oct 2024 21:11:55 -0400
The following commit has been merged in the master branch:
commit a193d760700ef19fcffa891fd5dd833ebdfc9bed
Author: Michael Meffie <mmeffie@sinenomine.net>
Date: Fri Jul 15 13:47:42 2022 -0400
vos: Open dump file before deleting volume in vos restore
When doing a full volume restore (vos restore -overwrite full), the
target volume is deleted by UV_RestoreVolume2() before the dump file is
opened.
After the target volume is deleted, UV_RestoreVolume2() calls the
WriteData() callback function to open the dump file and send the volume
data to the volume server. If the volume dump file cannot be opened at
that point, then the volume restore operation is aborted before sending
any dump data, but the target volume was unnecessarily destroyed.
Currently, a precheck is done by the FileExists() function, but the file
handled acquired by FileExists() is discarded, and a new file handle is
opened in the WriteData() function.
To improve this situation, change the sequence to open the dump file
before calling UV_RestoreVolume2() and pass the opened file handle,
instead of the filename string, and close the file handle after
UV_RestoreVolume2() returns.
The FileExists() function is no longer needed since we no longer discard
the opened file handle when processing the vos restore arguments, so
remove the now unused FileExists() function.
Also remove the afilename string from RestoreVolumeCmd() and pass the
opened file handle to UV_RestoreVolume2() instead.
Because of this refactoring, we no longer report an error when the
USC_CLOSE of the dump file handle fails, and we no longer run
USD_IOCTL_GETSIZE when opening the dump file (and exit with an error if
it fails.)
Change-Id: I6092e43a5dcaa795191143b65388ad1117b582f3
Reviewed-on: https://gerrit.openafs.org/15069
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
src/volser/vos.c | 63 ++++++++++++++------------------------------------------
1 file changed, 15 insertions(+), 48 deletions(-)
--
OpenAFS Master Repository