]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Client: Fast return if len is 0
authorHaomai Wang <haomaiwang@gmail.com>
Thu, 30 Apr 2015 16:34:54 +0000 (00:34 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Thu, 30 Apr 2015 16:34:54 +0000 (00:34 +0800)
If len == 0,
osdc/Striper.cc: 50: FAILED assert(len > 0)
 2: (Striper::file_to_extents(CephContext*, char const*, ceph_file_layout const*, unsigned long, unsigned long, unsigned long, std::map<object_t, std::vector<ObjectExtent, std::allocator<ObjectExtent> >, std::less<object_t>, std::allocator<std::pair<object_t const, std::vector<ObjectExtent, std::allocator<ObjectExtent> > > > >&, unsigned long)+0x1c6) [0x7fd1a0f4f522]
 3: (Striper::file_to_extents(CephContext*, char const*, ceph_file_layout const*, unsigned long, unsigned long, unsigned long, std::vector<ObjectExtent, std::allocator<ObjectExtent> >&, unsigned long)+0x69) [0x7fd1a0f4f315]
 4: (Striper::file_to_extents(CephContext*, inodeno_t, ceph_file_layout const*, unsigned long, unsigned long, unsigned long, std::vector<ObjectExtent, std::allocator<ObjectExtent> >&)+0x8a) [0x7fd1a0ef9c3c]
 5: (ObjectCacher::file_read(ObjectCacher::ObjectSet*, ceph_file_layout*, snapid_t, long, unsigned long, ceph::buffer::list*, int, Context*)+0x7e) [0x7fd1a0efb186]
 6: (Client::_read_async(Fh*, unsigned long, unsigned long, ceph::buffer::list*)+0x4ca) [0x7fd1a0ec90d4]
 7: (Client::_read(Fh*, long, unsigned long, ceph::buffer::list*)+0x3dc) [0x7fd1a0ec8744]
 8: (Client::read(int, char*, long, long)+0x208) [0x7fd1a0ec8100]
 9: (ceph_read()+0x5e) [0x7fd1a0e80603]

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/client/Client.cc

index 1a2a4e6202b6de3d4e53b97fc26010e362f0a71d..de285676448290f052c8bcde6111c93e8f1336a5 100644 (file)
@@ -7138,6 +7138,8 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl)
   // trim read based on file size?
   if (off >= in->size)
     return 0;
+  if (len == 0)
+    return 0;
   if (off + len > in->size) {
     len = in->size - off;    
   }