]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: fix overwrite
authorSage Weil <sage@redhat.com>
Thu, 10 Dec 2015 21:49:56 +0000 (16:49 -0500)
committerSage Weil <sage@redhat.com>
Fri, 1 Jan 2016 18:06:56 +0000 (13:06 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc

index 30539909f2356d33792e79317792b7c52fce5250..984ae8f1ec70652bddfbe85d747677dc36a2bcc1 100644 (file)
@@ -1110,6 +1110,8 @@ int BlueFS::open_for_write(
     file_map[ino_last] = file;
     dir->file_map[filename] = file;
     ++file->refs;
+    log_t.op_file_update(file->fnode);
+    log_t.op_dir_link(dirname, filename, file->fnode.ino);
   } else {
     // overwrite existing file?
     if (!overwrite) {
@@ -1119,11 +1121,9 @@ int BlueFS::open_for_write(
       return -EEXIST;
     }
     file = q->second;
+    log_t.op_file_update(file->fnode);
   }
 
-  log_t.op_file_update(file->fnode);
-  log_t.op_dir_link(dirname, filename, file->fnode.ino);
-
   *h = new FileWriter(file);
   dout(10) << __func__ << " h " << *h << " on " << file->fnode << dendl;
   return 0;