Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XrdPosix] Fix a case where delayed destroy would never re-try to close the file #1724

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/XrdPosix/XrdPosixXrootd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ int XrdPosixXrootd::Close(int fildes)
EPNAME("Close");
XrdCl::XRootDStatus Status;
XrdPosixFile *fP;
bool ret;
bool dnocb, ret;

// Map the file number to the file object. In the prcess we relese the file
// number so no one can reference this file again.
Expand All @@ -284,7 +284,7 @@ int XrdPosixXrootd::Close(int fildes)
// the caller will get a zero return code should we delay the close.
//
fP->Ref();
if (fP->XCio->Detach((XrdOucCacheIOCD&)*fP) && fP->Refs() < 2)
if ((dnocb = fP->XCio->Detach((XrdOucCacheIOCD&)*fP)) && fP->Refs() < 2)
{if ((ret = fP->Close(Status))) {delete fP; fP = 0;}
else if (DEBUGON)
{std::string eTxt = Status.ToString();
Expand All @@ -294,6 +294,11 @@ int XrdPosixXrootd::Close(int fildes)
ret = true;
}

// If Detach indicates it completed without the need to call the callback
// take the reference count down as there will be no callback to do it
//
if (fP && dnocb) fP->unRef();

// If we still have a handle then we need to do a delayed delete on this
// object because either the close failed or there is still active I/O
//
Expand Down