CEPH-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Phil Carns <carns@mcs.anl.gov>
To: ceph-devel@vger.kernel.org
Subject: minor file journal size bug
Date: Mon, 14 Jun 2010 10:19:42 -0400
Message-ID: <4C163A7E.6060701@mcs.anl.gov> (raw)


[-- Attachment #1: Type: text/plain, Size: 540 bytes --]

Hi,

I ran into a minor problem when configuring the ObjectStore to use a 
file journal that was 10 gigabytes in size (osd_journal_size = 10240).  
The osd_journal_size configuration parameter is an integer.  This would 
normally be fine since the units are in megabytes, but it can overflow 
when bit shifted in FileJournal.cc.  This causes the journal to fall 
back to trying to detect a raw block device journal.

I've attached a small patch that fixes the problem for me, but there is 
probably a cleaner way to do it.

thanks,
-Phil



[-- Attachment #2: ceph-0.20.2-journal-size-overflow.patch --]
[-- Type: text/x-patch, Size: 746 bytes --]

diff -Naupr ceph-0.20.2/src/os/FileJournal.cc ceph-0.20.2-patched/src/os/FileJournal.cc
--- ceph-0.20.2/src/os/FileJournal.cc	2010-05-26 18:52:59.000000000 -0500
+++ ceph-0.20.2-patched/src/os/FileJournal.cc	2010-06-14 08:54:22.416230668 -0500
@@ -58,8 +58,8 @@ int FileJournal::_open(bool forwrite, bo
   max_size = st.st_size;
   block_size = st.st_blksize;
 
-  if (create && max_size < (g_conf.osd_journal_size << 20)) {
-    uint64_t newsize = g_conf.osd_journal_size << 20;
+  if (create && max_size < (((uint64_t)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;
     r = ::ftruncate(fd, newsize);
     if (r == 0)

             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14 14:19 Phil Carns [this message]
2010-06-14 17:37 ` Yehuda Sadeh Weinraub
2010-06-15 18:29   ` Phil Carns

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C163A7E.6060701@mcs.anl.gov \
    --to=carns@mcs.anl.gov \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

CEPH-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/ceph-devel/0 ceph-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ceph-devel ceph-devel/ https://lore.kernel.org/ceph-devel \
		ceph-devel@vger.kernel.org
	public-inbox-index ceph-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.ceph-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git