]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/filestore: make 0-length zero avoid touching object length
authorSage Weil <sage@redhat.com>
Fri, 6 Oct 2017 20:29:15 +0000 (15:29 -0500)
committerShinobu Kinjo <shinobu@redhat.com>
Sun, 5 Nov 2017 03:39:05 +0000 (12:39 +0900)
Fixes: http://tracker.ceph.com/issues/21712
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 979b7c9cd2e4919b8c7d5ed2418019310959f4bf)

src/os/filestore/FileStore.cc

index caac76ec41408127d8155f84dbdd5be294c7ad95..8b596a7236160a64ba77fe5285b0e00e1b1a481f 100644 (file)
@@ -3578,8 +3578,8 @@ int FileStore::_zero(const coll_t& cid, const ghobject_t& oid, uint64_t offset,
     if (ret < 0) {
       ret = -errno;
     } else {
-      // ensure we extent file size, if needed
-      if (offset + len > (uint64_t)st.st_size) {
+      // ensure we extend file size, if needed
+      if (len > 0 && offset + len > (uint64_t)st.st_size) {
        ret = ::ftruncate(**fd, offset + len);
        if (ret < 0) {
          ret = -errno;