]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore/bluestore_tool: compare retval stat() with -1
authorKefu Chai <kchai@redhat.com>
Thu, 20 May 2021 05:55:13 +0000 (13:55 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 21 May 2021 03:58:40 +0000 (11:58 +0800)
commitd4c65a368c9cf35e01604fc3321f867cbe3e4109
tree7d7d9646c04e372e4042f36507fcfd9f51a4b35e
parent5de915c2e7706ce37881de8a7ea3ca6476b30fbe
os/bluestore/bluestore_tool: compare retval stat() with -1

before this change, stat() is always called to check if the
file specified by --dev-target exists even if this option is not
specified. also, we compare the retval of stat() with ENOENT, while
state() returns -1 on error.

after this change, stat() is called only if --dev-target is specified,
and we compare the retval of stat() with -1 and 0 only, so if
--dev-target option is not specified, the tool still hehaves.

this change addresses a regression introduced by
94a91f54fe30a4dd113fbc1b02bc3f3d52c82a92

Fixes: https://tracker.ceph.com/issues/50891
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/bluestore/bluestore_tool.cc