]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
BlueStore: fix spdk link file create failed
authorHaomai Wang <haomai@xsky.com>
Fri, 12 Feb 2016 15:34:14 +0000 (23:34 +0800)
committerHaomai Wang <haomai@xsky.com>
Sun, 21 Feb 2016 10:23:54 +0000 (18:23 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/os/bluestore/BlueStore.cc

index d35cd44156cc3c2ce0855063733d383dd12216c8..215fe76a151c10f2d904b90ef199eedca1874918 100644 (file)
@@ -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