Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212769
b: refs/heads/master
c: 3bdb8ef
h: refs/heads/master
i:
  212767: 620f27b
v: v3
  • Loading branch information
Patrick J. LoPresti authored and Joel Becker committed Sep 10, 2010
1 parent 916cd0c commit ae9d566
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1113e1b504f6e8d4364c0b73c9097828067d4617
refs/heads/master: 3bdb8efd94a73bb137e3315cd831cbc874052b4b
51 changes: 46 additions & 5 deletions trunk/fs/ocfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,36 @@ static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uu
return 0;
}

/* Make sure entire volume is addressable by our journal. Requires
osb_clusters_at_boot to be valid and for the journal to have been
initialized by ocfs2_journal_init(). */
static int ocfs2_journal_addressable(struct ocfs2_super *osb)
{
int status = 0;
u64 max_block =
ocfs2_clusters_to_blocks(osb->sb,
osb->osb_clusters_at_boot) - 1;

/* 32-bit block number is always OK. */
if (max_block <= (u32)~0ULL)
goto out;

/* Volume is "huge", so see if our journal is new enough to
support it. */
if (!(OCFS2_HAS_COMPAT_FEATURE(osb->sb,
OCFS2_FEATURE_COMPAT_JBD2_SB) &&
jbd2_journal_check_used_features(osb->journal->j_journal, 0, 0,
JBD2_FEATURE_INCOMPAT_64BIT))) {
mlog(ML_ERROR, "The journal cannot address the entire volume. "
"Enable the 'block64' journal option with tunefs.ocfs2");
status = -EFBIG;
goto out;
}

out:
return status;
}

static int ocfs2_initialize_super(struct super_block *sb,
struct buffer_head *bh,
int sector_size,
Expand All @@ -2002,6 +2032,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
struct ocfs2_journal *journal;
__le32 uuid_net_key;
struct ocfs2_super *osb;
u64 total_blocks;

mlog_entry_void();

Expand Down Expand Up @@ -2214,11 +2245,15 @@ static int ocfs2_initialize_super(struct super_block *sb,
goto bail;
}

if (ocfs2_clusters_to_blocks(osb->sb, le32_to_cpu(di->i_clusters) - 1)
> (u32)~0UL) {
mlog(ML_ERROR, "Volume might try to write to blocks beyond "
"what jbd can address in 32 bits.\n");
status = -EINVAL;
total_blocks = ocfs2_clusters_to_blocks(osb->sb,
le32_to_cpu(di->i_clusters));

status = generic_check_addressable(osb->sb->s_blocksize_bits,
total_blocks);
if (status) {
mlog(ML_ERROR, "Volume too large "
"to mount safely on this system");
status = -EFBIG;
goto bail;
}

Expand Down Expand Up @@ -2380,6 +2415,12 @@ static int ocfs2_check_volume(struct ocfs2_super *osb)
goto finally;
}

/* Now that journal has been initialized, check to make sure
entire volume is addressable. */
status = ocfs2_journal_addressable(osb);
if (status)
goto finally;

/* If the journal was unmounted cleanly then we don't want to
* recover anything. Otherwise, journal_load will do that
* dirty work for us :) */
Expand Down

0 comments on commit ae9d566

Please sign in to comment.