diff options
author | Noah Watkins <noahwatkins@gmail.com> | 2013-07-21 10:54:00 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-22 11:43:01 -0700 |
commit | 58c78dbaf357def4c7bf6fb95a0248a1ccf6c3c6 (patch) | |
tree | 57fedc53ead43df972be9d9e13eb38cf11e07eab | |
parent | 0897d3a820ec182ebd74100a370dbadab50de84f (diff) | |
download | ceph-58c78dbaf357def4c7bf6fb95a0248a1ccf6c3c6.tar.gz |
FileJournal: fix posix_fallocate error handling
From the man page for posix_fallocate:
posix_fallocate() returns zero on success, or an error
number on failure. Note that errno is not set.
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/os/FileJournal.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 3acadf09582..4a2af08dd4c 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -299,11 +299,10 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize, return -err; } ret = ::posix_fallocate(fd, 0, newsize); - if (ret < 0) { - int err = errno; + if (ret) { derr << "FileJournal::_open_file : unable to preallocation journal to " - << newsize << " bytes: " << cpp_strerror(err) << dendl; - return -err; + << newsize << " bytes: " << cpp_strerror(ret) << dendl; + return -ret; } max_size = newsize; } |