From: Derrick Brashear Date: Wed, 9 Nov 2011 15:34:10 +0000 (-0500) Subject: viced: avoid bogus handle in rename X-Git-Tag: upstream/1.6.1.pre1^2~97 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f718feb826926a67f428b482a580d03c788dfabf;p=packages%2Fo%2Fopenafs.git viced: avoid bogus handle in rename because fileptr's handle can be reset during CopyOnWrite we need to SetDirHandle after that call FIXES 130215 Reviewed-on: http://gerrit.openafs.org/5818 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear (cherry picked from commit a1669f3e37299c11bf29a458212e03d1bdb22334) Change-Id: I57e084102048916b04e45aa32792dc91193e43d8 Reviewed-on: http://gerrit.openafs.org/6081 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 4fe7d58f7..0a4f8b5e0 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -4199,6 +4199,9 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, ViceLog(25, ("Rename : calling CopyOnWrite on target dir\n")); if ((errorCode = CopyOnWrite(fileptr, volptr, 0, MAXFSIZE))) goto Bad_Rename; + /* since copyonwrite would mean fileptr has a new handle, do it here */ + FidZap(&filedir); + SetDirHandle(&filedir, fileptr); } /* If the new name exists already, delete it and the file it points to */