aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/journal.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 076c8b194682..e2fce519c0f2 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,10 @@ 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 = blkdev_get_by_dev(jdev, blkdev_mode,
2589 journal);
2589 journal->j_dev_mode = blkdev_mode; 2590 journal->j_dev_mode = blkdev_mode;
2590 if (IS_ERR(journal->j_dev_bd)) { 2591 if (IS_ERR(journal->j_dev_bd)) {
2591 result = PTR_ERR(journal->j_dev_bd); 2592 result = PTR_ERR(journal->j_dev_bd);
@@ -2594,22 +2595,14 @@ static int journal_init_dev(struct super_block *super,
2594 "cannot init journal device '%s': %i", 2595 "cannot init journal device '%s': %i",
2595 __bdevname(jdev, b), result); 2596 __bdevname(jdev, b), result);
2596 return result; 2597 return result;
2597 } else if (jdev != super->s_dev) { 2598 } 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); 2599 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2605 }
2606 2600
2607 return 0; 2601 return 0;
2608 } 2602 }
2609 2603
2610 journal->j_dev_mode = blkdev_mode; 2604 journal->j_dev_mode = blkdev_mode;
2611 journal->j_dev_bd = open_bdev_exclusive(jdev_name, 2605 journal->j_dev_bd = blkdev_get_by_path(jdev_name, blkdev_mode, journal);
2612 blkdev_mode, journal);
2613 if (IS_ERR(journal->j_dev_bd)) { 2606 if (IS_ERR(journal->j_dev_bd)) {
2614 result = PTR_ERR(journal->j_dev_bd); 2607 result = PTR_ERR(journal->j_dev_bd);
2615 journal->j_dev_bd = NULL; 2608 journal->j_dev_bd = NULL;