diff options
author | Noah Watkins <noahwatkins@gmail.com> | 2013-07-21 10:54:00 -0700 |
---|---|---|
committer | Noah Watkins <noahwatkins@gmail.com> | 2013-07-21 12:01:01 -0700 |
commit | 577a142cc91fb09da10804d3e1503e1cf6eb51f6 (patch) | |
tree | 5d55395243b47cb66b0a27c4ae8d45a2a1f80969 | |
parent | 3378f1088f25dc3f59cb6d68f879d66de0bef7f3 (diff) | |
download | ceph-577a142cc91fb09da10804d3e1503e1cf6eb51f6.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>
-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; } |