aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r--fs/ocfs2/super.c55
1 files changed, 17 insertions, 38 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 49d84f80f36c..a7cdd56f4c79 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -561,6 +561,9 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
561 if (!oi) 561 if (!oi)
562 return NULL; 562 return NULL;
563 563
564 oi->i_sync_tid = 0;
565 oi->i_datasync_tid = 0;
566
564 jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode); 567 jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
565 return &oi->vfs_inode; 568 return &oi->vfs_inode;
566} 569}
@@ -631,6 +634,8 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
631 struct ocfs2_super *osb = OCFS2_SB(sb); 634 struct ocfs2_super *osb = OCFS2_SB(sb);
632 u32 tmp; 635 u32 tmp;
633 636
637 sync_filesystem(sb);
638
634 if (!ocfs2_parse_options(sb, data, &parsed_options, 1) || 639 if (!ocfs2_parse_options(sb, data, &parsed_options, 1) ||
635 !ocfs2_check_set_options(sb, &parsed_options)) { 640 !ocfs2_check_set_options(sb, &parsed_options)) {
636 ret = -EINVAL; 641 ret = -EINVAL;
@@ -1238,30 +1243,11 @@ static struct dentry *ocfs2_mount(struct file_system_type *fs_type,
1238 return mount_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super); 1243 return mount_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super);
1239} 1244}
1240 1245
1241static void ocfs2_kill_sb(struct super_block *sb)
1242{
1243 struct ocfs2_super *osb = OCFS2_SB(sb);
1244
1245 /* Failed mount? */
1246 if (!osb || atomic_read(&osb->vol_state) == VOLUME_DISABLED)
1247 goto out;
1248
1249 /* Prevent further queueing of inode drop events */
1250 spin_lock(&dentry_list_lock);
1251 ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED);
1252 spin_unlock(&dentry_list_lock);
1253 /* Wait for work to finish and/or remove it */
1254 cancel_work_sync(&osb->dentry_lock_work);
1255out:
1256 kill_block_super(sb);
1257}
1258
1259static struct file_system_type ocfs2_fs_type = { 1246static struct file_system_type ocfs2_fs_type = {
1260 .owner = THIS_MODULE, 1247 .owner = THIS_MODULE,
1261 .name = "ocfs2", 1248 .name = "ocfs2",
1262 .mount = ocfs2_mount, 1249 .mount = ocfs2_mount,
1263 .kill_sb = ocfs2_kill_sb, 1250 .kill_sb = kill_block_super,
1264
1265 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, 1251 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
1266 .next = NULL 1252 .next = NULL
1267}; 1253};
@@ -1612,14 +1598,9 @@ static int ocfs2_show_options(struct seq_file *s, struct dentry *root)
1612 return 0; 1598 return 0;
1613} 1599}
1614 1600
1615wait_queue_head_t ocfs2__ioend_wq[OCFS2_IOEND_WQ_HASH_SZ];
1616
1617static int __init ocfs2_init(void) 1601static int __init ocfs2_init(void)
1618{ 1602{
1619 int status, i; 1603 int status;
1620
1621 for (i = 0; i < OCFS2_IOEND_WQ_HASH_SZ; i++)
1622 init_waitqueue_head(&ocfs2__ioend_wq[i]);
1623 1604
1624 status = init_ocfs2_uptodate_cache(); 1605 status = init_ocfs2_uptodate_cache();
1625 if (status < 0) 1606 if (status < 0)
@@ -1761,7 +1742,7 @@ static void ocfs2_inode_init_once(void *data)
1761 ocfs2_extent_map_init(&oi->vfs_inode); 1742 ocfs2_extent_map_init(&oi->vfs_inode);
1762 INIT_LIST_HEAD(&oi->ip_io_markers); 1743 INIT_LIST_HEAD(&oi->ip_io_markers);
1763 oi->ip_dir_start_lookup = 0; 1744 oi->ip_dir_start_lookup = 0;
1764 atomic_set(&oi->ip_unaligned_aio, 0); 1745 mutex_init(&oi->ip_unaligned_aio);
1765 init_rwsem(&oi->ip_alloc_sem); 1746 init_rwsem(&oi->ip_alloc_sem);
1766 init_rwsem(&oi->ip_xattr_sem); 1747 init_rwsem(&oi->ip_xattr_sem);
1767 mutex_init(&oi->ip_io_mutex); 1748 mutex_init(&oi->ip_io_mutex);
@@ -1932,17 +1913,16 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
1932 1913
1933 debugfs_remove(osb->osb_ctxt); 1914 debugfs_remove(osb->osb_ctxt);
1934 1915
1935 /*
1936 * Flush inode dropping work queue so that deletes are
1937 * performed while the filesystem is still working
1938 */
1939 ocfs2_drop_all_dl_inodes(osb);
1940
1941 /* Orphan scan should be stopped as early as possible */ 1916 /* Orphan scan should be stopped as early as possible */
1942 ocfs2_orphan_scan_stop(osb); 1917 ocfs2_orphan_scan_stop(osb);
1943 1918
1944 ocfs2_disable_quotas(osb); 1919 ocfs2_disable_quotas(osb);
1945 1920
1921 /* All dquots should be freed by now */
1922 WARN_ON(!llist_empty(&osb->dquot_drop_list));
1923 /* Wait for worker to be done with the work structure in osb */
1924 cancel_work_sync(&osb->dquot_drop_work);
1925
1946 ocfs2_shutdown_local_alloc(osb); 1926 ocfs2_shutdown_local_alloc(osb);
1947 1927
1948 /* This will disable recovery and flush any recovery work. */ 1928 /* This will disable recovery and flush any recovery work. */
@@ -2077,7 +2057,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
2077 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; 2057 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
2078 struct inode *inode = NULL; 2058 struct inode *inode = NULL;
2079 struct ocfs2_journal *journal; 2059 struct ocfs2_journal *journal;
2080 __le32 uuid_net_key;
2081 struct ocfs2_super *osb; 2060 struct ocfs2_super *osb;
2082 u64 total_blocks; 2061 u64 total_blocks;
2083 2062
@@ -2123,6 +2102,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
2123 spin_lock_init(&osb->osb_xattr_lock); 2102 spin_lock_init(&osb->osb_xattr_lock);
2124 ocfs2_init_steal_slots(osb); 2103 ocfs2_init_steal_slots(osb);
2125 2104
2105 mutex_init(&osb->system_file_mutex);
2106
2126 atomic_set(&osb->alloc_stats.moves, 0); 2107 atomic_set(&osb->alloc_stats.moves, 0);
2127 atomic_set(&osb->alloc_stats.local_data, 0); 2108 atomic_set(&osb->alloc_stats.local_data, 0);
2128 atomic_set(&osb->alloc_stats.bitmap_data, 0); 2109 atomic_set(&osb->alloc_stats.bitmap_data, 0);
@@ -2276,8 +2257,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
2276 INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); 2257 INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
2277 journal->j_state = OCFS2_JOURNAL_FREE; 2258 journal->j_state = OCFS2_JOURNAL_FREE;
2278 2259
2279 INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes); 2260 INIT_WORK(&osb->dquot_drop_work, ocfs2_drop_dquot_refs);
2280 osb->dentry_lock_list = NULL; 2261 init_llist_head(&osb->dquot_drop_list);
2281 2262
2282 /* get some pseudo constants for clustersize bits */ 2263 /* get some pseudo constants for clustersize bits */
2283 osb->s_clustersize_bits = 2264 osb->s_clustersize_bits =
@@ -2311,8 +2292,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
2311 goto bail; 2292 goto bail;
2312 } 2293 }
2313 2294
2314 memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key));
2315
2316 strncpy(osb->vol_label, di->id2.i_super.s_label, 63); 2295 strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
2317 osb->vol_label[63] = '\0'; 2296 osb->vol_label[63] = '\0';
2318 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno); 2297 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);