From: Danny Al-Gaaf Date: Tue, 28 May 2013 12:26:29 +0000 (+0200) Subject: bench/dumb_backend.cc: check return value of posix_fadvise() X-Git-Tag: v0.65~168^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7a0425de7b1933fc53f1f5f3f3309adebd892bb;p=ceph.git bench/dumb_backend.cc: check return value of posix_fadvise() CID 743396 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) check_return: Calling function "posix_fadvise(fd, offset, bl->length(), 4)" without checking return value. This library function may fail and return an error code. unchecked_value: No check of the return value of "posix_fadvise(fd, offset, bl->length(), 4)". Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/bench/dumb_backend.cc b/src/test/bench/dumb_backend.cc index a763c45f0c89..170fee7fab6a 100644 --- a/src/test/bench/dumb_backend.cc +++ b/src/test/bench/dumb_backend.cc @@ -30,9 +30,12 @@ void DumbBackend::_write( if (do_sync_file_range) ::sync_file_range(fd, offset, bl.length(), SYNC_FILE_RANGE_WAIT_AFTER); - if (do_fadvise) - ::posix_fadvise(fd, offset, bl.length(), - POSIX_FADV_DONTNEED); + if (do_fadvise) { + int fa_r = posix_fadvise(fd, offset, bl.length(), POSIX_FADV_DONTNEED); + if (fa_r) { + std::cout << "posix_fadvise failed, errno is: " << fa_r << std::endl; + } + } ::close(fd); { Mutex::Locker l(pending_commit_mutex);