diff options
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r-- | fs/reiserfs/journal.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 076c8b194682..b488136f5ace 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2552,8 +2552,6 @@ static int release_journal_dev(struct super_block *super, | |||
2552 | result = 0; | 2552 | result = 0; |
2553 | 2553 | ||
2554 | if (journal->j_dev_bd != NULL) { | 2554 | if (journal->j_dev_bd != NULL) { |
2555 | if (journal->j_dev_bd->bd_dev != super->s_dev) | ||
2556 | bd_release(journal->j_dev_bd); | ||
2557 | result = blkdev_put(journal->j_dev_bd, journal->j_dev_mode); | 2555 | result = blkdev_put(journal->j_dev_bd, journal->j_dev_mode); |
2558 | journal->j_dev_bd = NULL; | 2556 | journal->j_dev_bd = NULL; |
2559 | } | 2557 | } |
@@ -2571,7 +2569,7 @@ static int journal_init_dev(struct super_block *super, | |||
2571 | { | 2569 | { |
2572 | int result; | 2570 | int result; |
2573 | dev_t jdev; | 2571 | dev_t jdev; |
2574 | fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE; | 2572 | fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; |
2575 | char b[BDEVNAME_SIZE]; | 2573 | char b[BDEVNAME_SIZE]; |
2576 | 2574 | ||
2577 | result = 0; | 2575 | result = 0; |
@@ -2585,7 +2583,9 @@ static int journal_init_dev(struct super_block *super, | |||
2585 | 2583 | ||
2586 | /* there is no "jdev" option and journal is on separate device */ | 2584 | /* there is no "jdev" option and journal is on separate device */ |
2587 | if ((!jdev_name || !jdev_name[0])) { | 2585 | if ((!jdev_name || !jdev_name[0])) { |
2588 | journal->j_dev_bd = open_by_devnum(jdev, blkdev_mode); | 2586 | if (jdev == super->s_dev) |
2587 | blkdev_mode &= ~FMODE_EXCL; | ||
2588 | journal->j_dev_bd = open_by_devnum(jdev, blkdev_mode, journal); | ||
2589 | journal->j_dev_mode = blkdev_mode; | 2589 | journal->j_dev_mode = blkdev_mode; |
2590 | if (IS_ERR(journal->j_dev_bd)) { | 2590 | if (IS_ERR(journal->j_dev_bd)) { |
2591 | result = PTR_ERR(journal->j_dev_bd); | 2591 | result = PTR_ERR(journal->j_dev_bd); |
@@ -2594,15 +2594,8 @@ static int journal_init_dev(struct super_block *super, | |||
2594 | "cannot init journal device '%s': %i", | 2594 | "cannot init journal device '%s': %i", |
2595 | __bdevname(jdev, b), result); | 2595 | __bdevname(jdev, b), result); |
2596 | return result; | 2596 | return result; |
2597 | } else if (jdev != super->s_dev) { | 2597 | } else if (jdev != super->s_dev) |
2598 | result = bd_claim(journal->j_dev_bd, journal); | ||
2599 | if (result) { | ||
2600 | blkdev_put(journal->j_dev_bd, blkdev_mode); | ||
2601 | return result; | ||
2602 | } | ||
2603 | |||
2604 | set_blocksize(journal->j_dev_bd, super->s_blocksize); | 2598 | set_blocksize(journal->j_dev_bd, super->s_blocksize); |
2605 | } | ||
2606 | 2599 | ||
2607 | return 0; | 2600 | return 0; |
2608 | } | 2601 | } |