]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix overflow in FileJournal::_open_file()
authorVangelis Koukis <vkoukis@cslab.ece.ntua.gr>
Thu, 9 Dec 2010 18:53:22 +0000 (20:53 +0200)
committerSage Weil <sage@newdream.net>
Thu, 9 Dec 2010 21:45:30 +0000 (13:45 -0800)
[ The following text is in the "iso-8859-7" character set. ]
    [ Your display is set for the "iso-8859-1" character set.  ]
    [ Some special characters may be displayed incorrectly. ]

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().

Signed-off-by: Vangelis Koukis <vkoukis@cslab.ece.ntua.gr>
Signed-off-by: Sage Weil <sage@newdream.net>
src/os/FileJournal.cc

index 67342b4305a9e7408e7c1b595f64f5dbd143732f..7f33c84fa395a7068ef0f3a219ded1d50308ee70 100644 (file)
@@ -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) {