Summary:
SMB mounts do not support hard links. The ENOTSUP error code is
returned, which should be interpreted by PosixFileSystem as
IOStatus::NotSupported().

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9657

Reviewed By: mrambacher

Differential Revision: D34634783

Pulled By: anand1976

fbshipit-source-id: 0d57f5b2e6118e4c20e9ed1a293327428c3aecac
This commit is contained in:
anand76 2022-03-07 11:39:31 -08:00 committed by Facebook GitHub Bot
parent dab19afe56
commit 7574841aac

6
env/fs_posix.cc vendored
View File

@ -753,8 +753,10 @@ class PosixFileSystem : public FileSystem {
const IOOptions& /*opts*/, const IOOptions& /*opts*/,
IODebugContext* /*dbg*/) override { IODebugContext* /*dbg*/) override {
if (link(src.c_str(), target.c_str()) != 0) { if (link(src.c_str(), target.c_str()) != 0) {
if (errno == EXDEV) { if (errno == EXDEV || errno == ENOTSUP) {
return IOStatus::NotSupported("No cross FS links allowed"); return IOStatus::NotSupported(errno == EXDEV
? "No cross FS links allowed"
: "Links not supported by FS");
} }
return IOError("while link file to " + target, src, errno); return IOError("while link file to " + target, src, errno);
} }