@abh3 commented on this pull request. > @@ -2252,10 +2278,29 @@ int XrdOfs::rename(const char *old_name, // In evsObject->Notify(XrdOfsEvs::Mv, evInfo); } +// If we cannot overwrite, we must open-exclusive first. This will test whether +// we will destroy data in the rename (without actually destroying data). +// + std::unique_ptr<XrdSfsFile> tmp_fp = nullptr; + if (cannot_overwrite) + {tmp_fp.reset(newFile(einfo)); + if (!tmp_fp) + {return fsError(einfo, ENOMEM);} + if (SFS_OK != tmp_fp->open(new_name, SFS_O_CREAT, 0700, client, infoN)) Well, all of the side-effects of surreptitiously creating a file during rename certainly makes it unappealing. I'd really prefer an existence check. That way we get a reasonably predictable outcome regardless of what happens to the server. Frankly, the race condition hasn't been a problem in 20 years (yeah, famous last words). -- Reply to this email directly or view it on GitHub: https://github.com/xrootd/xrootd/pull/1697#discussion_r868680432 You are receiving this because you are subscribed to this thread. Message ID: <[log in to unmask]> ######################################################################## Use REPLY-ALL to reply to list To unsubscribe from the XROOTD-DEV list, click the following link: https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1