mirror of
https://github.com/ceph/ceph
synced 2025-02-21 09:57:26 +00:00
os/LFNIndex: use FDCloser for fsync_dir
This prevents an fd leak when maybe_inject_failure() throws an exception. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
6fb3260d59
commit
3ec9a42b47
@ -171,9 +171,9 @@ int LFNIndex::fsync_dir(const vector<string> &path)
|
||||
int fd = ::open(get_full_path_subdir(path).c_str(), O_RDONLY);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
FDCloser f(fd);
|
||||
maybe_inject_failure();
|
||||
int r = ::fsync(fd);
|
||||
VOID_TEMP_FAILURE_RETRY(::close(fd));
|
||||
maybe_inject_failure();
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
Loading…
Reference in New Issue
Block a user