Skip to contentSkip to conversation

Fix overflow in FileJournal::_open_file()

PATCH Applied Vangelis Koukis 2 participants 2 messages Dec 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix overflow in FileJournal::_open_file()

Running the unstable branch, mkcephfs fails when trying to create a 3GB journal file on the OSDs.

Relevant messages from the osd logfile:

2010-12-09 19:03:54.419737 7fdde4d51720 journal _open_file: unable to extend journal to 18446744072560312320 bytes
2010-12-09 19:03:54.419789 7fdde4d51720 filestore(/osd) mkjournal error creating journal on /osd/journal

The problem is that the calculation of the journal size in bytes overflows, in FileJournal::_open_file().

---
 src/os/FileJournal.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/os/FileJournal.cc +1 -1
index 3bb38a8..cd0808f 100644
@@ -223,7 +223,7 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize,
   }
 
   if (create && (oldsize < conf_journal_sz)) {
-    uint64_t newsize = g_conf.osd_journal_size << 20;
+    uint64_t newsize = (uint64_t)g_conf.osd_journal_size << 20;
     dout(10) << "_open extending to " << newsize << " bytes" << dendl;
     ret = ::ftruncate(fd, newsize);
     if (ret < 0) {

--
1.7.2.3

Signature · 9 lines
Vangelis Koukis
[email protected]
OpenPGP public key ID:
pub  1024D/1D038E97 2003-07-13 Vangelis Koukis <[email protected]>
     Key fingerprint = C5CD E02E 2C78 7C10 8A00  53D8 FBFC 3799 1D03 8E97

Our greatest glory is not in never failing,
but in rising up every time we fail.
        -- Ralph Waldo Emerson
Applied
#1 lore raw

Applied, thanks!

sage

Quoted 49 lines · Vangelis Koukis

Running the unstable branch, mkcephfs fails when trying to create a 3GB journal file on the OSDs.

Relevant messages from the osd logfile:

2010-12-09 19:03:54.419737 7fdde4d51720 journal _open_file: unable to extend journal to 18446744072560312320 bytes
2010-12-09 19:03:54.419789 7fdde4d51720 filestore(/osd) mkjournal error creating journal on /osd/journal

The problem is that the calculation of the journal size in bytes overflows, in FileJournal::_open_file().

---
 src/os/FileJournal.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/os/FileJournal.cc +1 -2
index 3bb38a8..cd0808f 100644
@@ -223,7 +223,7 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize,
   }
 
   if (create && (oldsize < conf_journal_sz)) {
-    uint64_t newsize = g_conf.osd_journal_size << 20;
+    uint64_t newsize = (uint64_t)g_conf.osd_journal_size << 20;
     dout(10) << "_open extending to " << newsize << " bytes" << dendl;
     ret = ::ftruncate(fd, newsize);
     if (ret < 0) {
--

1.7.2.3

Signature · 13 lines
Vangelis Koukis
[email protected]
OpenPGP public key ID:
pub  1024D/1D038E97 2003-07-13 Vangelis Koukis <[email protected]>
     Key fingerprint = C5CD E02E 2C78 7C10 8A00  53D8 FBFC 3799 1D03 8E97

Our greatest glory is not in never failing,
but in rising up every time we fail.
        -- Ralph Waldo Emerson
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html