Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283101
b: refs/heads/master
c: f32485b
h: refs/heads/master
i:
  283099: e65823e
v: v3
  • Loading branch information
Frederic Weisbecker authored and Linus Torvalds committed Jan 11, 2012
1 parent bc68f44 commit bd3368b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 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: b18c1c6e0c90cbcd38ba879bd63a44c94e4f7301
refs/heads/master: f32485be8397ad811312bc055d2e2a5906bc7576
3 changes: 0 additions & 3 deletions trunk/fs/reiserfs/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,7 @@ int reiserfs_init_bitmap_cache(struct super_block *sb)
struct reiserfs_bitmap_info *bitmap;
unsigned int bmap_nr = reiserfs_bmap_count(sb);

/* Avoid lock recursion in fault case */
reiserfs_write_unlock(sb);
bitmap = vmalloc(sizeof(*bitmap) * bmap_nr);
reiserfs_write_lock(sb);
if (bitmap == NULL)
return -ENOMEM;

Expand Down
43 changes: 24 additions & 19 deletions trunk/fs/reiserfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,22 +1746,11 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
mutex_init(&REISERFS_SB(s)->lock);
REISERFS_SB(s)->lock_depth = -1;

/*
* This function is called with the bkl, which also was the old
* locking used here.
* do_journal_begin() will soon check if we hold the lock (ie: was the
* bkl). This is likely because do_journal_begin() has several another
* callers because at this time, it doesn't seem to be necessary to
* protect against anything.
* Anyway, let's be conservative and lock for now.
*/
reiserfs_write_lock(s);

jdev_name = NULL;
if (reiserfs_parse_options
(s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
&commit_max_age, qf_names, &qfmt) == 0) {
goto error;
goto error_unlocked;
}
if (jdev_name && jdev_name[0]) {
REISERFS_SB(s)->s_jdev = kstrdup(jdev_name, GFP_KERNEL);
Expand All @@ -1777,7 +1766,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)

if (blocks) {
SWARN(silent, s, "jmacd-7", "resize option for remount only");
goto error;
goto error_unlocked;
}

/* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
Expand All @@ -1787,7 +1776,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) {
SWARN(silent, s, "sh-2021", "can not find reiserfs on %s",
reiserfs_bdevname(s));
goto error;
goto error_unlocked;
}

rs = SB_DISK_SUPER_BLOCK(s);
Expand All @@ -1803,16 +1792,17 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
"or increase size of your LVM partition");
SWARN(silent, s, "", "Or may be you forgot to "
"reboot after fdisk when it told you to");
goto error;
goto error_unlocked;
}

sbi->s_mount_state = SB_REISERFS_STATE(s);
sbi->s_mount_state = REISERFS_VALID_FS;

if ((errval = reiserfs_init_bitmap_cache(s))) {
SWARN(silent, s, "jmacd-8", "unable to read bitmap");
goto error;
goto error_unlocked;
}

errval = -EINVAL;
#ifdef CONFIG_REISERFS_CHECK
SWARN(silent, s, "", "CONFIG_REISERFS_CHECK is set ON");
Expand All @@ -1835,6 +1825,17 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
if (reiserfs_barrier_flush(s)) {
printk("reiserfs: using flush barriers\n");
}

/*
* This path assumed to be called with the BKL in the old times.
* Now we have inherited the big reiserfs lock from it and many
* reiserfs helpers called in the mount path and elsewhere require
* this lock to be held even if it's not always necessary. Let's be
* conservative and hold it early. The window can be reduced after
* careful review of the code.
*/
reiserfs_write_lock(s);

// set_device_ro(s->s_dev, 1) ;
if (journal_init(s, jdev_name, old_format, commit_max_age)) {
SWARN(silent, s, "sh-2022",
Expand Down Expand Up @@ -1995,12 +1996,16 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
return (0);

error:
if (jinit_done) { /* kill the commit thread, free journal ram */
reiserfs_write_unlock(s);

error_unlocked:
/* kill the commit thread, free journal ram */
if (jinit_done) {
reiserfs_write_lock(s);
journal_release_error(NULL, s);
reiserfs_write_unlock(s);
}

reiserfs_write_unlock(s);

reiserfs_free_bitmap_cache(s);
if (SB_BUFFER_WITH_SB(s))
brelse(SB_BUFFER_WITH_SB(s));
Expand Down

0 comments on commit bd3368b

Please sign in to comment.