aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r--fs/reiserfs/super.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 1d42e707d5fa..e12d8b97cd4d 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1519,9 +1519,7 @@ static int read_super_block(struct super_block *s, int offset)
1519static int reread_meta_blocks(struct super_block *s) 1519static int reread_meta_blocks(struct super_block *s)
1520{ 1520{
1521 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))); 1521 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s)));
1522 reiserfs_write_unlock(s);
1523 wait_on_buffer(SB_BUFFER_WITH_SB(s)); 1522 wait_on_buffer(SB_BUFFER_WITH_SB(s));
1524 reiserfs_write_lock(s);
1525 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) { 1523 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
1526 reiserfs_warning(s, "reiserfs-2504", "error reading the super"); 1524 reiserfs_warning(s, "reiserfs-2504", "error reading the super");
1527 return 1; 1525 return 1;
@@ -1746,22 +1744,11 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1746 mutex_init(&REISERFS_SB(s)->lock); 1744 mutex_init(&REISERFS_SB(s)->lock);
1747 REISERFS_SB(s)->lock_depth = -1; 1745 REISERFS_SB(s)->lock_depth = -1;
1748 1746
1749 /*
1750 * This function is called with the bkl, which also was the old
1751 * locking used here.
1752 * do_journal_begin() will soon check if we hold the lock (ie: was the
1753 * bkl). This is likely because do_journal_begin() has several another
1754 * callers because at this time, it doesn't seem to be necessary to
1755 * protect against anything.
1756 * Anyway, let's be conservative and lock for now.
1757 */
1758 reiserfs_write_lock(s);
1759
1760 jdev_name = NULL; 1747 jdev_name = NULL;
1761 if (reiserfs_parse_options 1748 if (reiserfs_parse_options
1762 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name, 1749 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
1763 &commit_max_age, qf_names, &qfmt) == 0) { 1750 &commit_max_age, qf_names, &qfmt) == 0) {
1764 goto error; 1751 goto error_unlocked;
1765 } 1752 }
1766 if (jdev_name && jdev_name[0]) { 1753 if (jdev_name && jdev_name[0]) {
1767 REISERFS_SB(s)->s_jdev = kstrdup(jdev_name, GFP_KERNEL); 1754 REISERFS_SB(s)->s_jdev = kstrdup(jdev_name, GFP_KERNEL);
@@ -1777,7 +1764,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1777 1764
1778 if (blocks) { 1765 if (blocks) {
1779 SWARN(silent, s, "jmacd-7", "resize option for remount only"); 1766 SWARN(silent, s, "jmacd-7", "resize option for remount only");
1780 goto error; 1767 goto error_unlocked;
1781 } 1768 }
1782 1769
1783 /* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */ 1770 /* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
@@ -1787,7 +1774,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1787 else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) { 1774 else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) {
1788 SWARN(silent, s, "sh-2021", "can not find reiserfs on %s", 1775 SWARN(silent, s, "sh-2021", "can not find reiserfs on %s",
1789 reiserfs_bdevname(s)); 1776 reiserfs_bdevname(s));
1790 goto error; 1777 goto error_unlocked;
1791 } 1778 }
1792 1779
1793 rs = SB_DISK_SUPER_BLOCK(s); 1780 rs = SB_DISK_SUPER_BLOCK(s);
@@ -1803,7 +1790,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1803 "or increase size of your LVM partition"); 1790 "or increase size of your LVM partition");
1804 SWARN(silent, s, "", "Or may be you forgot to " 1791 SWARN(silent, s, "", "Or may be you forgot to "
1805 "reboot after fdisk when it told you to"); 1792 "reboot after fdisk when it told you to");
1806 goto error; 1793 goto error_unlocked;
1807 } 1794 }
1808 1795
1809 sbi->s_mount_state = SB_REISERFS_STATE(s); 1796 sbi->s_mount_state = SB_REISERFS_STATE(s);
@@ -1811,8 +1798,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1811 1798
1812 if ((errval = reiserfs_init_bitmap_cache(s))) { 1799 if ((errval = reiserfs_init_bitmap_cache(s))) {
1813 SWARN(silent, s, "jmacd-8", "unable to read bitmap"); 1800 SWARN(silent, s, "jmacd-8", "unable to read bitmap");
1814 goto error; 1801 goto error_unlocked;
1815 } 1802 }
1803
1816 errval = -EINVAL; 1804 errval = -EINVAL;
1817#ifdef CONFIG_REISERFS_CHECK 1805#ifdef CONFIG_REISERFS_CHECK
1818 SWARN(silent, s, "", "CONFIG_REISERFS_CHECK is set ON"); 1806 SWARN(silent, s, "", "CONFIG_REISERFS_CHECK is set ON");
@@ -1835,24 +1823,26 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1835 if (reiserfs_barrier_flush(s)) { 1823 if (reiserfs_barrier_flush(s)) {
1836 printk("reiserfs: using flush barriers\n"); 1824 printk("reiserfs: using flush barriers\n");
1837 } 1825 }
1826
1838 // set_device_ro(s->s_dev, 1) ; 1827 // set_device_ro(s->s_dev, 1) ;
1839 if (journal_init(s, jdev_name, old_format, commit_max_age)) { 1828 if (journal_init(s, jdev_name, old_format, commit_max_age)) {
1840 SWARN(silent, s, "sh-2022", 1829 SWARN(silent, s, "sh-2022",
1841 "unable to initialize journal space"); 1830 "unable to initialize journal space");
1842 goto error; 1831 goto error_unlocked;
1843 } else { 1832 } else {
1844 jinit_done = 1; /* once this is set, journal_release must be called 1833 jinit_done = 1; /* once this is set, journal_release must be called
1845 ** if we error out of the mount 1834 ** if we error out of the mount
1846 */ 1835 */
1847 } 1836 }
1837
1848 if (reread_meta_blocks(s)) { 1838 if (reread_meta_blocks(s)) {
1849 SWARN(silent, s, "jmacd-9", 1839 SWARN(silent, s, "jmacd-9",
1850 "unable to reread meta blocks after journal init"); 1840 "unable to reread meta blocks after journal init");
1851 goto error; 1841 goto error_unlocked;
1852 } 1842 }
1853 1843
1854 if (replay_only(s)) 1844 if (replay_only(s))
1855 goto error; 1845 goto error_unlocked;
1856 1846
1857 if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { 1847 if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
1858 SWARN(silent, s, "clm-7000", 1848 SWARN(silent, s, "clm-7000",
@@ -1866,9 +1856,19 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1866 reiserfs_init_locked_inode, (void *)(&args)); 1856 reiserfs_init_locked_inode, (void *)(&args));
1867 if (!root_inode) { 1857 if (!root_inode) {
1868 SWARN(silent, s, "jmacd-10", "get root inode failed"); 1858 SWARN(silent, s, "jmacd-10", "get root inode failed");
1869 goto error; 1859 goto error_unlocked;
1870 } 1860 }
1871 1861
1862 /*
1863 * This path assumed to be called with the BKL in the old times.
1864 * Now we have inherited the big reiserfs lock from it and many
1865 * reiserfs helpers called in the mount path and elsewhere require
1866 * this lock to be held even if it's not always necessary. Let's be
1867 * conservative and hold it early. The window can be reduced after
1868 * careful review of the code.
1869 */
1870 reiserfs_write_lock(s);
1871
1872 if (root_inode->i_state & I_NEW) { 1872 if (root_inode->i_state & I_NEW) {
1873 reiserfs_read_locked_inode(root_inode, &args); 1873 reiserfs_read_locked_inode(root_inode, &args);
1874 unlock_new_inode(root_inode); 1874 unlock_new_inode(root_inode);
@@ -1995,12 +1995,16 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1995 return (0); 1995 return (0);
1996 1996
1997error: 1997error:
1998 if (jinit_done) { /* kill the commit thread, free journal ram */ 1998 reiserfs_write_unlock(s);
1999
2000error_unlocked:
2001 /* kill the commit thread, free journal ram */
2002 if (jinit_done) {
2003 reiserfs_write_lock(s);
1999 journal_release_error(NULL, s); 2004 journal_release_error(NULL, s);
2005 reiserfs_write_unlock(s);
2000 } 2006 }
2001 2007
2002 reiserfs_write_unlock(s);
2003
2004 reiserfs_free_bitmap_cache(s); 2008 reiserfs_free_bitmap_cache(s);
2005 if (SB_BUFFER_WITH_SB(s)) 2009 if (SB_BUFFER_WITH_SB(s))
2006 brelse(SB_BUFFER_WITH_SB(s)); 2010 brelse(SB_BUFFER_WITH_SB(s));