@@ -1746,22 +1746,11 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1746
1746
mutex_init (& REISERFS_SB (s )-> lock );
1747
1747
REISERFS_SB (s )-> lock_depth = -1 ;
1748
1748
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
1749
jdev_name = NULL ;
1761
1750
if (reiserfs_parse_options
1762
1751
(s , (char * )data , & (sbi -> s_mount_opt ), & blocks , & jdev_name ,
1763
1752
& commit_max_age , qf_names , & qfmt ) == 0 ) {
1764
- goto error ;
1753
+ goto error_unlocked ;
1765
1754
}
1766
1755
if (jdev_name && jdev_name [0 ]) {
1767
1756
REISERFS_SB (s )-> s_jdev = kstrdup (jdev_name , GFP_KERNEL );
@@ -1777,7 +1766,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1777
1766
1778
1767
if (blocks ) {
1779
1768
SWARN (silent , s , "jmacd-7" , "resize option for remount only" );
1780
- goto error ;
1769
+ goto error_unlocked ;
1781
1770
}
1782
1771
1783
1772
/* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
@@ -1787,7 +1776,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1787
1776
else if (read_super_block (s , REISERFS_DISK_OFFSET_IN_BYTES )) {
1788
1777
SWARN (silent , s , "sh-2021" , "can not find reiserfs on %s" ,
1789
1778
reiserfs_bdevname (s ));
1790
- goto error ;
1779
+ goto error_unlocked ;
1791
1780
}
1792
1781
1793
1782
rs = SB_DISK_SUPER_BLOCK (s );
@@ -1803,16 +1792,17 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1803
1792
"or increase size of your LVM partition" );
1804
1793
SWARN (silent , s , "" , "Or may be you forgot to "
1805
1794
"reboot after fdisk when it told you to" );
1806
- goto error ;
1795
+ goto error_unlocked ;
1807
1796
}
1808
1797
1809
1798
sbi -> s_mount_state = SB_REISERFS_STATE (s );
1810
1799
sbi -> s_mount_state = REISERFS_VALID_FS ;
1811
1800
1812
1801
if ((errval = reiserfs_init_bitmap_cache (s ))) {
1813
1802
SWARN (silent , s , "jmacd-8" , "unable to read bitmap" );
1814
- goto error ;
1803
+ goto error_unlocked ;
1815
1804
}
1805
+
1816
1806
errval = - EINVAL ;
1817
1807
#ifdef CONFIG_REISERFS_CHECK
1818
1808
SWARN (silent , s , "" , "CONFIG_REISERFS_CHECK is set ON" );
@@ -1835,6 +1825,17 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1835
1825
if (reiserfs_barrier_flush (s )) {
1836
1826
printk ("reiserfs: using flush barriers\n" );
1837
1827
}
1828
+
1829
+ /*
1830
+ * This path assumed to be called with the BKL in the old times.
1831
+ * Now we have inherited the big reiserfs lock from it and many
1832
+ * reiserfs helpers called in the mount path and elsewhere require
1833
+ * this lock to be held even if it's not always necessary. Let's be
1834
+ * conservative and hold it early. The window can be reduced after
1835
+ * careful review of the code.
1836
+ */
1837
+ reiserfs_write_lock (s );
1838
+
1838
1839
// set_device_ro(s->s_dev, 1) ;
1839
1840
if (journal_init (s , jdev_name , old_format , commit_max_age )) {
1840
1841
SWARN (silent , s , "sh-2022" ,
@@ -1995,12 +1996,16 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1995
1996
return (0 );
1996
1997
1997
1998
error :
1998
- if (jinit_done ) { /* kill the commit thread, free journal ram */
1999
+ reiserfs_write_unlock (s );
2000
+
2001
+ error_unlocked :
2002
+ /* kill the commit thread, free journal ram */
2003
+ if (jinit_done ) {
2004
+ reiserfs_write_lock (s );
1999
2005
journal_release_error (NULL , s );
2006
+ reiserfs_write_unlock (s );
2000
2007
}
2001
2008
2002
- reiserfs_write_unlock (s );
2003
-
2004
2009
reiserfs_free_bitmap_cache (s );
2005
2010
if (SB_BUFFER_WITH_SB (s ))
2006
2011
brelse (SB_BUFFER_WITH_SB (s ));
0 commit comments