Skip to content

Commit 349f2c9

Browse files
committed
FST: Return EAGAIN instead of EBUSY in case a file is opened for writing via HTTP
This is a hack against the hack in XRootD in the Emsg() function. We initially wanted to use EBUSY. However, if EBUSY errno is passed in Emsg(), the Emsg() function in XRootD will return the integer 5 (Hack for proxy support). This is going to explose when this hack is removed in XRootD 6 hence the decision to use EAGAIN
1 parent 2e7b184 commit 349f2c9

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

common/http/HttpServer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ HttpServer::HttpError(const char* errorText, int errorCode)
373373
response->SetResponseCode(response->UNPROCESSABLE_ENTITY);
374374
} else if (errorCode == EPERM || errorCode == EACCES) {
375375
response->SetResponseCode(response->FORBIDDEN);
376-
} else if (errorCode == EBUSY) {
376+
} else if (errorCode == EAGAIN) {
377377
response->SetResponseCode(response->CONFLICT);
378378
} else {
379379
response->SetResponseCode(response->INTERNAL_SERVER_ERROR);

fst/XrdFstOfsFile.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ XrdFstOfsFile::open(const char* path, XrdSfsFileOpenMode open_mode,
278278
if (gOFS.openedForWriting.isOpen(mFsId, mFileId)) {
279279
eos_err("msg=\"forbid replica open for synchronization, file %s "
280280
"opened in RW mode\"", mNsPath.c_str());
281-
return gOFS.Emsg(epname, error, EBUSY, "open - cannot synchronize "
281+
// Return resource temporarily unavailable as EBUSY cannot be used due to XRootD hack
282+
// in Emsg() that returns the integer "5" (proxy hack)
283+
return gOFS.Emsg(epname, error, EAGAIN, "open - cannot synchronize "
282284
"file opened in RW mode", mNsPath.c_str());
283285
}
284286
}

0 commit comments

Comments
 (0)