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.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 7adea74d6a8a..e1cfb80d0bf3 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -465,7 +465,7 @@ static void reiserfs_put_super(struct super_block *s)
465 struct reiserfs_transaction_handle th; 465 struct reiserfs_transaction_handle th;
466 th.t_trans_id = 0; 466 th.t_trans_id = 0;
467 467
468 lock_kernel(); 468 reiserfs_write_lock(s);
469 469
470 if (s->s_dirt) 470 if (s->s_dirt)
471 reiserfs_write_super(s); 471 reiserfs_write_super(s);
@@ -499,10 +499,10 @@ static void reiserfs_put_super(struct super_block *s)
499 499
500 reiserfs_proc_info_done(s); 500 reiserfs_proc_info_done(s);
501 501
502 reiserfs_write_unlock(s);
503 mutex_destroy(&REISERFS_SB(s)->lock);
502 kfree(s->s_fs_info); 504 kfree(s->s_fs_info);
503 s->s_fs_info = NULL; 505 s->s_fs_info = NULL;
504
505 unlock_kernel();
506} 506}
507 507
508static struct kmem_cache *reiserfs_inode_cachep; 508static struct kmem_cache *reiserfs_inode_cachep;
@@ -1168,11 +1168,14 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1168 unsigned int qfmt = 0; 1168 unsigned int qfmt = 0;
1169#ifdef CONFIG_QUOTA 1169#ifdef CONFIG_QUOTA
1170 int i; 1170 int i;
1171#endif
1172
1173 reiserfs_write_lock(s);
1171 1174
1175#ifdef CONFIG_QUOTA
1172 memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names)); 1176 memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names));
1173#endif 1177#endif
1174 1178
1175 lock_kernel();
1176 rs = SB_DISK_SUPER_BLOCK(s); 1179 rs = SB_DISK_SUPER_BLOCK(s);
1177 1180
1178 if (!reiserfs_parse_options 1181 if (!reiserfs_parse_options
@@ -1295,12 +1298,12 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1295 1298
1296out_ok: 1299out_ok:
1297 replace_mount_options(s, new_opts); 1300 replace_mount_options(s, new_opts);
1298 unlock_kernel(); 1301 reiserfs_write_unlock(s);
1299 return 0; 1302 return 0;
1300 1303
1301out_err: 1304out_err:
1302 kfree(new_opts); 1305 kfree(new_opts);
1303 unlock_kernel(); 1306 reiserfs_write_unlock(s);
1304 return err; 1307 return err;
1305} 1308}
1306 1309
@@ -1404,7 +1407,9 @@ static int read_super_block(struct super_block *s, int offset)
1404static int reread_meta_blocks(struct super_block *s) 1407static int reread_meta_blocks(struct super_block *s)
1405{ 1408{
1406 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))); 1409 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s)));
1410 reiserfs_write_unlock(s);
1407 wait_on_buffer(SB_BUFFER_WITH_SB(s)); 1411 wait_on_buffer(SB_BUFFER_WITH_SB(s));
1412 reiserfs_write_lock(s);
1408 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) { 1413 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
1409 reiserfs_warning(s, "reiserfs-2504", "error reading the super"); 1414 reiserfs_warning(s, "reiserfs-2504", "error reading the super");
1410 return 1; 1415 return 1;
@@ -1613,7 +1618,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1613 sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); 1618 sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
1614 if (!sbi) { 1619 if (!sbi) {
1615 errval = -ENOMEM; 1620 errval = -ENOMEM;
1616 goto error; 1621 goto error_alloc;
1617 } 1622 }
1618 s->s_fs_info = sbi; 1623 s->s_fs_info = sbi;
1619 /* Set default values for options: non-aggressive tails, RO on errors */ 1624 /* Set default values for options: non-aggressive tails, RO on errors */
@@ -1627,6 +1632,20 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1627 /* setup default block allocator options */ 1632 /* setup default block allocator options */
1628 reiserfs_init_alloc_options(s); 1633 reiserfs_init_alloc_options(s);
1629 1634
1635 mutex_init(&REISERFS_SB(s)->lock);
1636 REISERFS_SB(s)->lock_depth = -1;
1637
1638 /*
1639 * This function is called with the bkl, which also was the old
1640 * locking used here.
1641 * do_journal_begin() will soon check if we hold the lock (ie: was the
1642 * bkl). This is likely because do_journal_begin() has several another
1643 * callers because at this time, it doesn't seem to be necessary to
1644 * protect against anything.
1645 * Anyway, let's be conservative and lock for now.
1646 */
1647 reiserfs_write_lock(s);
1648
1630 jdev_name = NULL; 1649 jdev_name = NULL;
1631 if (reiserfs_parse_options 1650 if (reiserfs_parse_options
1632 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name, 1651 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
@@ -1852,9 +1871,13 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1852 init_waitqueue_head(&(sbi->s_wait)); 1871 init_waitqueue_head(&(sbi->s_wait));
1853 spin_lock_init(&sbi->bitmap_lock); 1872 spin_lock_init(&sbi->bitmap_lock);
1854 1873
1874 reiserfs_write_unlock(s);
1875
1855 return (0); 1876 return (0);
1856 1877
1857error: 1878error:
1879 reiserfs_write_unlock(s);
1880error_alloc:
1858 if (jinit_done) { /* kill the commit thread, free journal ram */ 1881 if (jinit_done) { /* kill the commit thread, free journal ram */
1859 journal_release_error(NULL, s); 1882 journal_release_error(NULL, s);
1860 } 1883 }