From: Greg Farnum Date: Tue, 2 Nov 2010 16:37:04 +0000 (-0700) Subject: uclient: Warn on truncate_[size|seq] changes for non-file inodes. X-Git-Tag: v0.23~54^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5310ab6e108d5090d1a76c56719b56173c82e16e;p=ceph.git uclient: Warn on truncate_[size|seq] changes for non-file inodes. --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 08850fc15296..61a21bdccefc 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -372,18 +372,21 @@ void Client::update_inode_file_bits(Inode *in, } } if (truncate_seq >= in->truncate_seq && - in->truncate_size != truncate_size && - in->is_file()) { - dout(10) << "truncate_size " << in->truncate_size << " -> " - << truncate_size << dendl; - in->truncate_size = truncate_size; - in->oset.truncate_size = truncate_size; - if (g_conf.client_oc && prior_size) { //do actual truncation - vector ls; - filer->file_to_extents(in->ino, &in->layout, - truncate_size, prior_size - truncate_size, - ls); - objectcacher->truncate_set(&in->oset, ls); + in->truncate_size != truncate_size) { + if (in->is_file()) { + dout(10) << "truncate_size " << in->truncate_size << " -> " + << truncate_size << dendl; + in->truncate_size = truncate_size; + in->oset.truncate_size = truncate_size; + if (g_conf.client_oc && prior_size) { //do actual truncation + vector ls; + filer->file_to_extents(in->ino, &in->layout, + truncate_size, prior_size - truncate_size, + ls); + objectcacher->truncate_set(&in->oset, ls); + } + } else { + dout(0) << "Hmmm, truncate_seq && truncate_size changed on non-file inode!" << dendl; } }