]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: more carefully gaurd local cache truncate
authorSage Weil <sage.weil@dreamhost.com>
Sun, 6 Feb 2011 21:55:50 +0000 (13:55 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Sun, 6 Feb 2011 21:56:25 +0000 (13:56 -0800)
This fixes an assert when len=0 in file_to_extents when we get some weird
metadata from the MDS.

Fixes: #778
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/client/Client.cc

index c9876fc5b1b47f00bb00ba8914107adf065215fb..9f7fa9d90a0d97e8cf6fe4c3a30c16f6512dc0ac 100644 (file)
@@ -380,7 +380,7 @@ void Client::update_inode_file_bits(Inode *in,
               << truncate_size << dendl;
       in->truncate_size = truncate_size;
       in->oset.truncate_size = truncate_size;
-      if (g_conf.client_oc && prior_size) { //do actual truncation
+      if (g_conf.client_oc && prior_size > truncate_size) { //do actual truncation
        vector<ObjectExtent> ls;
        filer->file_to_extents(in->ino, &in->layout,
                               truncate_size, prior_size - truncate_size,