]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
rgw_sal_motr: fix possible memleak on put
authorAndriy Tkachuk <andriy.tkachuk@seagate.com>
Wed, 2 Feb 2022 11:25:59 +0000 (11:25 +0000)
committerAndriy Tkachuk <andriy.tkachuk@seagate.com>
Thu, 3 Feb 2022 20:44:04 +0000 (20:44 +0000)
commit9d1488f2b3e64b32cfb366d5394b654797fcaa22
tree61988bc0a90618e4029010e6647a7bc15d8f0ade
parenta9a2955297861358535c60bd6761a0ab5fb723c2
rgw_sal_motr: fix possible memleak on put

Currently, the MotrAtomicWriter::cleanup() is called from
MotrAtomicWriter::commit(), which may not be called at all
by rgw in case of md5 checksum failure.

Solution: call cleanup() from process() when data is zero.
rgw calls Writer::process(data, off) with zero data at the
end of the loop to allow writes to flush the data. From:
src/rgw/rgw_op.cc:RGWPutObj::execute():

      op_ret = filter->process(std::move(data), ofs);
      ...
      ofs += len;
    } while (len > 0);

    // flush any data in filters
    op_ret = filter->process({}, ofs);

Signed-off-by: Andriy Tkachuk <andriy.tkachuk@seagate.com>
Reviewed-by: Sining Wu <sining.wu@seagate.com>
src/rgw/rgw_sal.h
src/rgw/rgw_sal_motr.cc