diff --git a/src/XrdXrootd/XrdXrootdXeq.cc b/src/XrdXrootd/XrdXrootdXeq.cc index c4e0619ab3a..1ca6cf79d83 100644 --- a/src/XrdXrootd/XrdXrootdXeq.cc +++ b/src/XrdXrootd/XrdXrootdXeq.cc @@ -557,14 +557,24 @@ int XrdXrootdProtocol::do_Close() fp->cbArg = ReqID.getID(); fp->XrdSfsp->error.setErrCB(&closeCB, (unsigned long long)fp); +// Add a reference count to the file in case the close will be deferred. In +// the deferred case the reference is used to prevent the callback from +// deleting the file until we have done necessary processing of the object +// during its removal from the open table. +// + fp->Ref(1); + // Do an explicit close of the file here; check for exceptions. Stall requests // leave the file open as there will be a retry. Otherwise, we remove the // file from our open table but a "started" return defers the the delete. // rc = fp->XrdSfsp->close(); TRACEP(FS, " fh=" <