From: Haomai Wang Date: Fri, 12 Feb 2016 15:34:14 +0000 (+0800) Subject: BlueStore: fix spdk link file create failed X-Git-Tag: v10.1.0~347^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d208668d57c2098fb784c25d20f8474a2e79dbc6;p=ceph.git BlueStore: fix spdk link file create failed Signed-off-by: Haomai Wang --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d35cd44156cc..215fe76a151c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1578,6 +1578,9 @@ int BlueStore::_setup_block_symlink_or_file( dout(20) << __func__ << " name " << name << " path " << epath << " size " << size << " create=" << (int)create << dendl; int r = 0; + unsigned flags = O_RDWR; + if (create) + flags |= O_CREAT; if (epath.length()) { if (!epath.compare(0, sizeof(SPDK_PREFIX)-1, SPDK_PREFIX)) { string symbol_spdk_file = path + "/" + epath; @@ -1588,7 +1591,7 @@ int BlueStore::_setup_block_symlink_or_file( << symbol_spdk_file << ": " << cpp_strerror(r) << dendl; return r; } - int fd = ::openat(path_fd, epath.c_str(), O_RDWR, 0644); + int fd = ::openat(path_fd, epath.c_str(), flags, 0644); if (fd < 0) { r = -errno; derr << __func__ << " failed to open " << epath << " file: " @@ -1611,9 +1614,6 @@ int BlueStore::_setup_block_symlink_or_file( } } if (size) { - unsigned flags = O_RDWR; - if (create) - flags |= O_CREAT; int fd = ::openat(path_fd, name.c_str(), flags, 0644); if (fd >= 0) { // block file is present