From: huanwen ren Date: Tue, 27 Jun 2017 09:18:53 +0000 (+0800) Subject: client: add unlock_fh_pos when abort X-Git-Tag: v12.1.2~179^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a6a2c62fa42d2f56ee629148c7cac41bf276ff6a;p=ceph.git client: add unlock_fh_pos when abort add unlock_fh_pos when abort Signed-off-by: huanwen ren --- diff --git a/src/client/Client.cc b/src/client/Client.cc index cbb216aa7682..b8d902b61d8a 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -8444,17 +8444,22 @@ int Client::_read(Fh *f, int64_t offset, uint64_t size, bufferlist *bl) if (in->inline_version == 0) { int r = _getattr(in, CEPH_STAT_CAP_INLINE_DATA, f->actor_perms, true); - if (r < 0) + if (r < 0) { + if (movepos) + unlock_fh_pos(f); return r; + } assert(in->inline_version > 0); } retry: int have; int r = get_caps(in, CEPH_CAP_FILE_RD, CEPH_CAP_FILE_CACHE, &have, -1); - if (r < 0) + if (r < 0) { + if (movepos) + unlock_fh_pos(f); return r; - + } if (f->flags & O_DIRECT) have &= ~CEPH_CAP_FILE_CACHE; @@ -8556,7 +8561,12 @@ done: if (have) put_cap_ref(in, CEPH_CAP_FILE_RD); - return r < 0 ? r : bl->length(); + if (r < 0) { + if (movepos) + unlock_fh_pos(f); + return r; + } else + return bl->length(); } Client::C_Readahead::C_Readahead(Client *c, Fh *f) :