Bug 2293933

Summary: [RBD] "rbd du" fails if image created with 0 size [7.1z]
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Ilya Dryomov <idryomov>
Component: RBDAssignee: Ilya Dryomov <idryomov>
Status: CLOSED ERRATA QA Contact: Sunil Angadi <sangadi>
Severity: medium Docs Contact: Akash Raj <akraj>
Priority: unspecified    
Version: 7.1CC: akraj, ceph-eng-bugs, cephqe-warriors, mcaldeir, sangadi, tserlin
Target Milestone: ---   
Target Release: 7.1z1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-18.2.1-196.el9cp Doc Type: Bug Fix
Doc Text:
Previously, due to an implementation defect, `rbd du` command would crash if it encountered a 0-sized RBD image. With this fix, the implementation defect is fixed and the `rbd du` command no longer crashes if a 0-sized RBD image is encountered.
Story Points: ---
Clone Of: 2291447 Environment:
Last Closed: 2024-08-07 11:20:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ilya Dryomov 2024-06-24 13:08:00 UTC
+++ This bug was initially created as a clone of Bug #2291447 +++

Description of problem:
Created image with 0GB size 
rbd create rep_pool_SiLuJSPClg/image1 -s 0G

when try to check rbd du it fails as below

[root@ceph-rbd1-sangadi-01-ljut20-node2 ~]# rbd du -p rep_pool_SiLuJSPClg
/builddir/build/BUILD/ceph-18.2.1/src/librbd/api/DiffIterate.cc: In function 'int librbd::api::DiffIterate<ImageCtxT>::execute() [with ImageCtxT = librbd::ImageCtx]' thread 7fd64c428c00 time 2024-06-12T03:19:10.835518-0400
/builddir/build/BUILD/ceph-18.2.1/src/librbd/api/DiffIterate.cc: 341: FAILED ceph_assert(object_diff_state.size() == end_object_no - start_object_no)
 ceph version 18.2.1-194.el9cp (04a992766839cd3207877e518a1238cdbac3787e) reef (stable)
 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x12e) [0x7fd64d763076]
 2: /usr/lib64/ceph/libceph-common.so.2(+0x163234) [0x7fd64d763234]
 3: /lib64/librbd.so.1(+0x195b44) [0x7fd64e395b44]
 4: /lib64/librbd.so.1(+0x5524d7) [0x7fd64e7524d7]
 5: (librbd::Image::diff_iterate2(char const*, unsigned long, unsigned long, bool, bool, int (*)(unsigned long, unsigned long, int, void*), void*)+0x94) [0x7fd64e308d24]
 6: rbd(+0x2de947) [0x55e28b304947]
 7: (rbd::action::disk_usage::execute(boost::program_options::variables_map const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)+0x1027) [0x55e28b172aa7]
 8: (rbd::Shell::execute(int, char const**)+0xc17) [0x55e28b1571e7]
 9: main()
 10: /lib64/libc.so.6(+0x29590) [0x7fd64ce29590]
 11: __libc_start_main()
 12: _start()
*** Caught signal (Aborted) **
 in thread 7fd64c428c00 thread_name:rbd
2024-06-12T03:19:10.835-0400 7fd64c428c00 -1 /builddir/build/BUILD/ceph-18.2.1/src/librbd/api/DiffIterate.cc: In function 'int librbd::api::DiffIterate<ImageCtxT>::execute() [with ImageCtxT = librbd::ImageCtx]' thread 7fd64c428c00 time 2024-06-12T03:19:10.835518-0400
/builddir/build/BUILD/ceph-18.2.1/src/librbd/api/DiffIterate.cc: 341: FAILED ceph_assert(object_diff_state.size() == end_object_no - start_object_no)

 ceph version 18.2.1-194.el9cp (04a992766839cd3207877e518a1238cdbac3787e) reef (stable)

Version-Release number of selected component (if applicable):
ceph version 18.2.1-194.el9cp (04a992766839cd3207877e518a1238cdbac3787e) reef (stable)

How reproducible:
Always

Steps to Reproduce:
1.Deploy ceph and create pool
2.create images with 0 size
3.check rbd du output for 0 sized image

Actual results:
/mnt/data/workspace/ceph_linux/src/librbd/api/DiffIterate.cc: In function 'int librbd::api::DiffIterate<ImageCtxT>::execute() [with ImageCtxT = librbd::ImageCtx]' thread 7fa28543f740 time 2024-06-11T07:51:39.470207+0000
/mnt/data/workspace/ceph_linux/src/librbd/api/DiffIterate.cc: 341: FAILED ceph_assert(object_diff_state.size() == end_object_no - start_object_no)

Expected results:
command should not error out

Additional info:
https://tracker.ceph.com/issues/66418

Comment 12 errata-xmlrpc 2024-08-07 11:20:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Ceph Storage 7.1 security and bug fix update.), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2024:5080