1 /* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
6 * load/unload driver, mount/dismount volumes
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 021110-1307, USA.
26 #include <linux/module.h>
28 #include <linux/types.h>
29 #include <linux/slab.h>
30 #include <linux/highmem.h>
31 #include <linux/utsname.h>
32 #include <linux/init.h>
33 #include <linux/random.h>
34 #include <linux/statfs.h>
35 #include <linux/moduleparam.h>
36 #include <linux/blkdev.h>
37 #include <linux/socket.h>
38 #include <linux/inet.h>
39 #include <linux/parser.h>
40 #include <linux/crc32.h>
41 #include <linux/debugfs.h>
42 #include <linux/mount.h>
43 #include <linux/seq_file.h>
44 #include <linux/quotaops.h>
45 #include <linux/smp_lock.h>
47 #define MLOG_MASK_PREFIX ML_SUPER
48 #include <cluster/masklog.h>
52 /* this should be the only file to include a version 1 header */
53 #include "ocfs1_fs_compat.h"
56 #include "blockcheck.h"
59 #include "extent_map.h"
60 #include "heartbeat.h"
63 #include "localalloc.h"
73 #include "buffer_head_io.h"
75 static struct kmem_cache *ocfs2_inode_cachep = NULL;
76 struct kmem_cache *ocfs2_dquot_cachep;
77 struct kmem_cache *ocfs2_qf_chunk_cachep;
79 /* OCFS2 needs to schedule several differnt types of work which
80 * require cluster locking, disk I/O, recovery waits, etc. Since these
81 * types of work tend to be heavy we avoid using the kernel events
82 * workqueue and schedule on our own. */
83 struct workqueue_struct *ocfs2_wq = NULL;
85 static struct dentry *ocfs2_debugfs_root = NULL;
87 MODULE_AUTHOR("Oracle");
88 MODULE_LICENSE("GPL");
92 unsigned long commit_interval;
93 unsigned long mount_opt;
94 unsigned int atime_quantum;
96 unsigned int localalloc_opt;
97 char cluster_stack[OCFS2_STACK_LABEL_LEN + 1];
100 static int ocfs2_parse_options(struct super_block *sb, char *options,
101 struct mount_options *mopt,
103 static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt);
104 static void ocfs2_put_super(struct super_block *sb);
105 static int ocfs2_mount_volume(struct super_block *sb);
106 static int ocfs2_remount(struct super_block *sb, int *flags, char *data);
107 static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err);
108 static int ocfs2_initialize_mem_caches(void);
109 static void ocfs2_free_mem_caches(void);
110 static void ocfs2_delete_osb(struct ocfs2_super *osb);
112 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf);
114 static int ocfs2_sync_fs(struct super_block *sb, int wait);
116 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb);
117 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb);
118 static void ocfs2_release_system_inodes(struct ocfs2_super *osb);
119 static int ocfs2_check_volume(struct ocfs2_super *osb);
120 static int ocfs2_verify_volume(struct ocfs2_dinode *di,
121 struct buffer_head *bh,
123 struct ocfs2_blockcheck_stats *stats);
124 static int ocfs2_initialize_super(struct super_block *sb,
125 struct buffer_head *bh,
127 struct ocfs2_blockcheck_stats *stats);
128 static int ocfs2_get_sector(struct super_block *sb,
129 struct buffer_head **bh,
132 static struct inode *ocfs2_alloc_inode(struct super_block *sb);
133 static void ocfs2_destroy_inode(struct inode *inode);
134 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
135 static int ocfs2_enable_quotas(struct ocfs2_super *osb);
136 static void ocfs2_disable_quotas(struct ocfs2_super *osb);
138 static const struct super_operations ocfs2_sops = {
139 .statfs = ocfs2_statfs,
140 .alloc_inode = ocfs2_alloc_inode,
141 .destroy_inode = ocfs2_destroy_inode,
142 .drop_inode = ocfs2_drop_inode,
143 .clear_inode = ocfs2_clear_inode,
144 .delete_inode = ocfs2_delete_inode,
145 .sync_fs = ocfs2_sync_fs,
146 .put_super = ocfs2_put_super,
147 .remount_fs = ocfs2_remount,
148 .show_options = ocfs2_show_options,
149 .quota_read = ocfs2_quota_read,
150 .quota_write = ocfs2_quota_write,
179 static const match_table_t tokens = {
180 {Opt_barrier, "barrier=%u"},
181 {Opt_err_panic, "errors=panic"},
182 {Opt_err_ro, "errors=remount-ro"},
184 {Opt_nointr, "nointr"},
185 {Opt_hb_none, OCFS2_HB_NONE},
186 {Opt_hb_local, OCFS2_HB_LOCAL},
187 {Opt_data_ordered, "data=ordered"},
188 {Opt_data_writeback, "data=writeback"},
189 {Opt_atime_quantum, "atime_quantum=%u"},
190 {Opt_slot, "preferred_slot=%u"},
191 {Opt_commit, "commit=%u"},
192 {Opt_localalloc, "localalloc=%d"},
193 {Opt_localflocks, "localflocks"},
194 {Opt_stack, "cluster_stack=%s"},
195 {Opt_user_xattr, "user_xattr"},
196 {Opt_nouser_xattr, "nouser_xattr"},
197 {Opt_inode64, "inode64"},
199 {Opt_noacl, "noacl"},
200 {Opt_usrquota, "usrquota"},
201 {Opt_grpquota, "grpquota"},
205 #ifdef CONFIG_DEBUG_FS
206 static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
210 struct ocfs2_cluster_connection *cconn = osb->cconn;
211 struct ocfs2_recovery_map *rm = osb->recovery_map;
212 struct ocfs2_orphan_scan *os;
214 out += snprintf(buf + out, len - out,
215 "%10s => Id: %-s Uuid: %-s Gen: 0x%X Label: %-s\n",
216 "Device", osb->dev_str, osb->uuid_str,
217 osb->fs_generation, osb->vol_label);
219 out += snprintf(buf + out, len - out,
220 "%10s => State: %d Flags: 0x%lX\n", "Volume",
221 atomic_read(&osb->vol_state), osb->osb_flags);
223 out += snprintf(buf + out, len - out,
224 "%10s => Block: %lu Cluster: %d\n", "Sizes",
225 osb->sb->s_blocksize, osb->s_clustersize);
227 out += snprintf(buf + out, len - out,
228 "%10s => Compat: 0x%X Incompat: 0x%X "
230 "Features", osb->s_feature_compat,
231 osb->s_feature_incompat, osb->s_feature_ro_compat);
233 out += snprintf(buf + out, len - out,
234 "%10s => Opts: 0x%lX AtimeQuanta: %u\n", "Mount",
235 osb->s_mount_opt, osb->s_atime_quantum);
238 out += snprintf(buf + out, len - out,
239 "%10s => Stack: %s Name: %*s "
240 "Version: %d.%d\n", "Cluster",
241 (*osb->osb_cluster_stack == '\0' ?
242 "o2cb" : osb->osb_cluster_stack),
243 cconn->cc_namelen, cconn->cc_name,
244 cconn->cc_version.pv_major,
245 cconn->cc_version.pv_minor);
248 spin_lock(&osb->dc_task_lock);
249 out += snprintf(buf + out, len - out,
250 "%10s => Pid: %d Count: %lu WakeSeq: %lu "
251 "WorkSeq: %lu\n", "DownCnvt",
252 (osb->dc_task ? task_pid_nr(osb->dc_task) : -1),
253 osb->blocked_lock_count, osb->dc_wake_sequence,
254 osb->dc_work_sequence);
255 spin_unlock(&osb->dc_task_lock);
257 spin_lock(&osb->osb_lock);
258 out += snprintf(buf + out, len - out, "%10s => Pid: %d Nodes:",
260 (osb->recovery_thread_task ?
261 task_pid_nr(osb->recovery_thread_task) : -1));
262 if (rm->rm_used == 0)
263 out += snprintf(buf + out, len - out, " None\n");
265 for (i = 0; i < rm->rm_used; i++)
266 out += snprintf(buf + out, len - out, " %d",
268 out += snprintf(buf + out, len - out, "\n");
270 spin_unlock(&osb->osb_lock);
272 out += snprintf(buf + out, len - out,
273 "%10s => Pid: %d Interval: %lu Needs: %d\n", "Commit",
274 (osb->commit_task ? task_pid_nr(osb->commit_task) : -1),
275 osb->osb_commit_interval,
276 atomic_read(&osb->needs_checkpoint));
278 out += snprintf(buf + out, len - out,
279 "%10s => State: %d TxnId: %lu NumTxns: %d\n",
280 "Journal", osb->journal->j_state,
281 osb->journal->j_trans_id,
282 atomic_read(&osb->journal->j_num_trans));
284 out += snprintf(buf + out, len - out,
285 "%10s => GlobalAllocs: %d LocalAllocs: %d "
286 "SubAllocs: %d LAWinMoves: %d SAExtends: %d\n",
288 atomic_read(&osb->alloc_stats.bitmap_data),
289 atomic_read(&osb->alloc_stats.local_data),
290 atomic_read(&osb->alloc_stats.bg_allocs),
291 atomic_read(&osb->alloc_stats.moves),
292 atomic_read(&osb->alloc_stats.bg_extends));
294 out += snprintf(buf + out, len - out,
295 "%10s => State: %u Descriptor: %llu Size: %u bits "
296 "Default: %u bits\n",
297 "LocalAlloc", osb->local_alloc_state,
298 (unsigned long long)osb->la_last_gd,
299 osb->local_alloc_bits, osb->local_alloc_default_bits);
301 spin_lock(&osb->osb_lock);
302 out += snprintf(buf + out, len - out,
303 "%10s => Slot: %d NumStolen: %d\n", "Steal",
304 osb->s_inode_steal_slot,
305 atomic_read(&osb->s_num_inodes_stolen));
306 spin_unlock(&osb->osb_lock);
308 out += snprintf(buf + out, len - out, "%10s => %3s %10s\n",
309 "Slots", "Num", "RecoGen");
310 for (i = 0; i < osb->max_slots; ++i) {
311 out += snprintf(buf + out, len - out,
312 "%10s %c %3d %10d\n",
314 (i == osb->slot_num ? '*' : ' '),
315 i, osb->slot_recovery_generations[i]);
318 os = &osb->osb_orphan_scan;
319 out += snprintf(buf + out, len - out, "Orphan Scan=> ");
320 out += snprintf(buf + out, len - out, "Local: %u Global: %u ",
321 os->os_count, os->os_seqno);
322 out += snprintf(buf + out, len - out, " Last Scan: %lu seconds ago\n",
323 (get_seconds() - os->os_scantime.tv_sec));
328 static int ocfs2_osb_debug_open(struct inode *inode, struct file *file)
330 struct ocfs2_super *osb = inode->i_private;
333 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
337 i_size_write(inode, ocfs2_osb_dump(osb, buf, PAGE_SIZE));
339 file->private_data = buf;
346 static int ocfs2_debug_release(struct inode *inode, struct file *file)
348 kfree(file->private_data);
352 static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,
353 size_t nbytes, loff_t *ppos)
355 return simple_read_from_buffer(buf, nbytes, ppos, file->private_data,
356 i_size_read(file->f_mapping->host));
359 static int ocfs2_osb_debug_open(struct inode *inode, struct file *file)
363 static int ocfs2_debug_release(struct inode *inode, struct file *file)
367 static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,
368 size_t nbytes, loff_t *ppos)
372 #endif /* CONFIG_DEBUG_FS */
374 static struct file_operations ocfs2_osb_debug_fops = {
375 .open = ocfs2_osb_debug_open,
376 .release = ocfs2_debug_release,
377 .read = ocfs2_debug_read,
378 .llseek = generic_file_llseek,
381 static int ocfs2_sync_fs(struct super_block *sb, int wait)
385 struct ocfs2_super *osb = OCFS2_SB(sb);
387 if (ocfs2_is_hard_readonly(osb))
391 status = ocfs2_flush_truncate_log(osb);
395 ocfs2_schedule_truncate_log_flush(osb, 0);
398 if (jbd2_journal_start_commit(OCFS2_SB(sb)->journal->j_journal,
401 jbd2_log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
407 static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino)
409 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
410 && (ino == USER_QUOTA_SYSTEM_INODE
411 || ino == LOCAL_USER_QUOTA_SYSTEM_INODE))
413 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
414 && (ino == GROUP_QUOTA_SYSTEM_INODE
415 || ino == LOCAL_GROUP_QUOTA_SYSTEM_INODE))
420 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
422 struct inode *new = NULL;
428 new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
430 status = PTR_ERR(new);
434 osb->root_inode = new;
436 new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
438 status = PTR_ERR(new);
442 osb->sys_root_inode = new;
444 for (i = OCFS2_FIRST_ONLINE_SYSTEM_INODE;
445 i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) {
446 if (!ocfs2_need_system_inode(osb, i))
448 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
450 ocfs2_release_system_inodes(osb);
453 /* FIXME: Should ERROR_RO_FS */
454 mlog(ML_ERROR, "Unable to load system inode %d, "
455 "possibly corrupt fs?", i);
458 // the array now has one ref, so drop this one
467 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb)
469 struct inode *new = NULL;
475 for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1;
476 i < NUM_SYSTEM_INODES;
478 if (!ocfs2_need_system_inode(osb, i))
480 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
482 ocfs2_release_system_inodes(osb);
484 mlog(ML_ERROR, "status=%d, sysfile=%d, slot=%d\n",
485 status, i, osb->slot_num);
488 /* the array now has one ref, so drop this one */
497 static void ocfs2_release_system_inodes(struct ocfs2_super *osb)
504 for (i = 0; i < NUM_SYSTEM_INODES; i++) {
505 inode = osb->system_inodes[i];
508 osb->system_inodes[i] = NULL;
512 inode = osb->sys_root_inode;
515 osb->sys_root_inode = NULL;
518 inode = osb->root_inode;
521 osb->root_inode = NULL;
527 /* We're allocating fs objects, use GFP_NOFS */
528 static struct inode *ocfs2_alloc_inode(struct super_block *sb)
530 struct ocfs2_inode_info *oi;
532 oi = kmem_cache_alloc(ocfs2_inode_cachep, GFP_NOFS);
536 jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
537 return &oi->vfs_inode;
540 static void ocfs2_destroy_inode(struct inode *inode)
542 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
545 static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
548 unsigned int bytes = 1 << cbits;
549 unsigned int trim = bytes;
550 unsigned int bitshift = 32;
553 * i_size and all block offsets in ocfs2 are always 64 bits
554 * wide. i_clusters is 32 bits, in cluster-sized units. So on
555 * 64 bit platforms, cluster size will be the limiting factor.
558 #if BITS_PER_LONG == 32
559 # if defined(CONFIG_LBD)
560 BUILD_BUG_ON(sizeof(sector_t) != 8);
562 * We might be limited by page cache size.
564 if (bytes > PAGE_CACHE_SIZE) {
565 bytes = PAGE_CACHE_SIZE;
568 * Shift by 31 here so that we don't get larger than
575 * We are limited by the size of sector_t. Use block size, as
576 * that's what we expose to the VFS.
585 * Trim by a whole cluster when we can actually approach the
586 * on-disk limits. Otherwise we can overflow i_clusters when
587 * an extent start is at the max offset.
589 return (((unsigned long long)bytes) << bitshift) - trim;
592 static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
594 int incompat_features;
596 struct mount_options parsed_options;
597 struct ocfs2_super *osb = OCFS2_SB(sb);
601 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) {
606 if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
607 (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
609 mlog(ML_ERROR, "Cannot change heartbeat mode on remount\n");
613 if ((osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK) !=
614 (parsed_options.mount_opt & OCFS2_MOUNT_DATA_WRITEBACK)) {
616 mlog(ML_ERROR, "Cannot change data mode on remount\n");
620 /* Probably don't want this on remount; it might
621 * mess with other nodes */
622 if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64) &&
623 (parsed_options.mount_opt & OCFS2_MOUNT_INODE64)) {
625 mlog(ML_ERROR, "Cannot enable inode64 on remount\n");
629 /* We're going to/from readonly mode. */
630 if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
631 /* Disable quota accounting before remounting RO */
632 if (*flags & MS_RDONLY) {
633 ret = ocfs2_susp_quotas(osb, 0);
637 /* Lock here so the check of HARD_RO and the potential
638 * setting of SOFT_RO is atomic. */
639 spin_lock(&osb->osb_lock);
640 if (osb->osb_flags & OCFS2_OSB_HARD_RO) {
641 mlog(ML_ERROR, "Remount on readonly device is forbidden.\n");
646 if (*flags & MS_RDONLY) {
647 mlog(0, "Going to ro mode.\n");
648 sb->s_flags |= MS_RDONLY;
649 osb->osb_flags |= OCFS2_OSB_SOFT_RO;
651 mlog(0, "Making ro filesystem writeable.\n");
653 if (osb->osb_flags & OCFS2_OSB_ERROR_FS) {
654 mlog(ML_ERROR, "Cannot remount RDWR "
655 "filesystem due to previous errors.\n");
659 incompat_features = OCFS2_HAS_RO_COMPAT_FEATURE(sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP);
660 if (incompat_features) {
661 mlog(ML_ERROR, "Cannot remount RDWR because "
662 "of unsupported optional features "
663 "(%x).\n", incompat_features);
667 sb->s_flags &= ~MS_RDONLY;
668 osb->osb_flags &= ~OCFS2_OSB_SOFT_RO;
671 spin_unlock(&osb->osb_lock);
672 /* Enable quota accounting after remounting RW */
673 if (!ret && !(*flags & MS_RDONLY)) {
674 if (sb_any_quota_suspended(sb))
675 ret = ocfs2_susp_quotas(osb, 1);
677 ret = ocfs2_enable_quotas(osb);
679 /* Return back changes... */
680 spin_lock(&osb->osb_lock);
681 sb->s_flags |= MS_RDONLY;
682 osb->osb_flags |= OCFS2_OSB_SOFT_RO;
683 spin_unlock(&osb->osb_lock);
690 /* Only save off the new mount options in case of a successful
692 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
693 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
694 osb->s_mount_opt = parsed_options.mount_opt;
695 osb->s_atime_quantum = parsed_options.atime_quantum;
696 osb->preferred_slot = parsed_options.slot;
697 if (parsed_options.commit_interval)
698 osb->osb_commit_interval = parsed_options.commit_interval;
700 if (!ocfs2_is_hard_readonly(osb))
701 ocfs2_set_journal_params(osb);
708 static int ocfs2_sb_probe(struct super_block *sb,
709 struct buffer_head **bh,
711 struct ocfs2_blockcheck_stats *stats)
714 struct ocfs1_vol_disk_hdr *hdr;
715 struct ocfs2_dinode *di;
721 *sector_size = bdev_logical_block_size(sb->s_bdev);
722 if (*sector_size > OCFS2_MAX_BLOCKSIZE) {
723 mlog(ML_ERROR, "Hardware sector size too large: %d (max=%d)\n",
724 *sector_size, OCFS2_MAX_BLOCKSIZE);
729 /* Can this really happen? */
730 if (*sector_size < OCFS2_MIN_BLOCKSIZE)
731 *sector_size = OCFS2_MIN_BLOCKSIZE;
733 /* check block zero for old format */
734 status = ocfs2_get_sector(sb, bh, 0, *sector_size);
739 hdr = (struct ocfs1_vol_disk_hdr *) (*bh)->b_data;
740 if (hdr->major_version == OCFS1_MAJOR_VERSION) {
741 mlog(ML_ERROR, "incompatible version: %u.%u\n",
742 hdr->major_version, hdr->minor_version);
745 if (memcmp(hdr->signature, OCFS1_VOLUME_SIGNATURE,
746 strlen(OCFS1_VOLUME_SIGNATURE)) == 0) {
747 mlog(ML_ERROR, "incompatible volume signature: %8s\n",
754 mlog(ML_ERROR, "This is an ocfs v1 filesystem which must be "
755 "upgraded before mounting with ocfs v2\n");
760 * Now check at magic offset for 512, 1024, 2048, 4096
761 * blocksizes. 4096 is the maximum blocksize because it is
762 * the minimum clustersize.
765 for (blksize = *sector_size;
766 blksize <= OCFS2_MAX_BLOCKSIZE;
768 tmpstat = ocfs2_get_sector(sb, bh,
769 OCFS2_SUPER_BLOCK_BLKNO,
776 di = (struct ocfs2_dinode *) (*bh)->b_data;
777 memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats));
778 status = ocfs2_verify_volume(di, *bh, blksize, stats);
783 if (status != -EAGAIN)
791 static int ocfs2_verify_heartbeat(struct ocfs2_super *osb)
793 if (ocfs2_mount_local(osb)) {
794 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
795 mlog(ML_ERROR, "Cannot heartbeat on a locally "
796 "mounted device.\n");
801 if (ocfs2_userspace_stack(osb)) {
802 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
803 mlog(ML_ERROR, "Userspace stack expected, but "
804 "o2cb heartbeat arguments passed to mount\n");
809 if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
810 if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb) &&
811 !ocfs2_userspace_stack(osb)) {
812 mlog(ML_ERROR, "Heartbeat has to be started to mount "
813 "a read-write clustered device.\n");
822 * If we're using a userspace stack, mount should have passed
823 * a name that matches the disk. If not, mount should not
824 * have passed a stack.
826 static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb,
827 struct mount_options *mopt)
829 if (!ocfs2_userspace_stack(osb) && mopt->cluster_stack[0]) {
831 "cluster stack passed to mount, but this filesystem "
832 "does not support it\n");
836 if (ocfs2_userspace_stack(osb) &&
837 strncmp(osb->osb_cluster_stack, mopt->cluster_stack,
838 OCFS2_STACK_LABEL_LEN)) {
840 "cluster stack passed to mount (\"%s\") does not "
841 "match the filesystem (\"%s\")\n",
843 osb->osb_cluster_stack);
850 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
853 struct super_block *sb = osb->sb;
854 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
855 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
858 for (type = 0; type < MAXQUOTAS; type++) {
859 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
862 status = vfs_quota_enable(
863 sb_dqopt(sb)->files[type],
867 status = vfs_quota_disable(sb, type,
873 mlog(ML_ERROR, "Failed to suspend/unsuspend quotas on "
874 "remount (error = %d).\n", status);
878 static int ocfs2_enable_quotas(struct ocfs2_super *osb)
880 struct inode *inode[MAXQUOTAS] = { NULL, NULL };
881 struct super_block *sb = osb->sb;
882 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
883 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
884 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
885 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
889 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE;
890 for (type = 0; type < MAXQUOTAS; type++) {
891 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
893 inode[type] = ocfs2_get_system_file_inode(osb, ino[type],
899 status = vfs_quota_enable(inode[type], type, QFMT_OCFS2,
900 DQUOT_USAGE_ENABLED);
905 for (type = 0; type < MAXQUOTAS; type++)
909 ocfs2_disable_quotas(osb);
910 for (type = 0; type < MAXQUOTAS; type++)
916 static void ocfs2_disable_quotas(struct ocfs2_super *osb)
920 struct super_block *sb = osb->sb;
922 /* We mostly ignore errors in this function because there's not much
923 * we can do when we see them */
924 for (type = 0; type < MAXQUOTAS; type++) {
925 if (!sb_has_quota_loaded(sb, type))
927 inode = igrab(sb->s_dquot.files[type]);
928 /* Turn off quotas. This will remove all dquot structures from
929 * memory and so they will be automatically synced to global
931 vfs_quota_disable(sb, type, DQUOT_USAGE_ENABLED |
932 DQUOT_LIMITS_ENABLED);
939 /* Handle quota on quotactl */
940 static int ocfs2_quota_on(struct super_block *sb, int type, int format_id,
941 char *path, int remount)
943 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
944 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
946 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
950 return 0; /* Just ignore it has been handled in
952 return vfs_quota_enable(sb_dqopt(sb)->files[type], type,
953 format_id, DQUOT_LIMITS_ENABLED);
956 /* Handle quota off quotactl */
957 static int ocfs2_quota_off(struct super_block *sb, int type, int remount)
960 return 0; /* Ignore now and handle later in
962 return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED);
965 static struct quotactl_ops ocfs2_quotactl_ops = {
966 .quota_on = ocfs2_quota_on,
967 .quota_off = ocfs2_quota_off,
968 .quota_sync = vfs_quota_sync,
969 .get_info = vfs_get_dqinfo,
970 .set_info = vfs_set_dqinfo,
971 .get_dqblk = vfs_get_dqblk,
972 .set_dqblk = vfs_set_dqblk,
975 static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
978 int status, sector_size;
979 struct mount_options parsed_options;
980 struct inode *inode = NULL;
981 struct ocfs2_super *osb = NULL;
982 struct buffer_head *bh = NULL;
984 struct ocfs2_blockcheck_stats stats;
986 mlog_entry("%p, %p, %i", sb, data, silent);
988 if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) {
990 goto read_super_error;
993 /* probe for superblock */
994 status = ocfs2_sb_probe(sb, &bh, §or_size, &stats);
996 mlog(ML_ERROR, "superblock probe failed!\n");
997 goto read_super_error;
1000 status = ocfs2_initialize_super(sb, bh, sector_size, &stats);
1004 goto read_super_error;
1009 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
1010 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
1012 osb->s_mount_opt = parsed_options.mount_opt;
1013 osb->s_atime_quantum = parsed_options.atime_quantum;
1014 osb->preferred_slot = parsed_options.slot;
1015 osb->osb_commit_interval = parsed_options.commit_interval;
1016 osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt);
1017 osb->local_alloc_bits = osb->local_alloc_default_bits;
1018 if (osb->s_mount_opt & OCFS2_MOUNT_USRQUOTA &&
1019 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1020 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1022 mlog(ML_ERROR, "User quotas were requested, but this "
1023 "filesystem does not have the feature enabled.\n");
1024 goto read_super_error;
1026 if (osb->s_mount_opt & OCFS2_MOUNT_GRPQUOTA &&
1027 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1028 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1030 mlog(ML_ERROR, "Group quotas were requested, but this "
1031 "filesystem does not have the feature enabled.\n");
1032 goto read_super_error;
1035 status = ocfs2_verify_userspace_stack(osb, &parsed_options);
1037 goto read_super_error;
1039 sb->s_magic = OCFS2_SUPER_MAGIC;
1041 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
1042 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
1044 /* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
1046 if (bdev_read_only(sb->s_bdev)) {
1047 if (!(sb->s_flags & MS_RDONLY)) {
1049 mlog(ML_ERROR, "Readonly device detected but readonly "
1050 "mount was not specified.\n");
1051 goto read_super_error;
1054 /* You should not be able to start a local heartbeat
1055 * on a readonly device. */
1056 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
1058 mlog(ML_ERROR, "Local heartbeat specified on readonly "
1060 goto read_super_error;
1063 status = ocfs2_check_journals_nolocks(osb);
1065 if (status == -EROFS)
1066 mlog(ML_ERROR, "Recovery required on readonly "
1067 "file system, but write access is "
1071 goto read_super_error;
1074 ocfs2_set_ro_flag(osb, 1);
1076 printk(KERN_NOTICE "Readonly device detected. No cluster "
1077 "services will be utilized for this mount. Recovery "
1078 "will be skipped.\n");
1081 if (!ocfs2_is_hard_readonly(osb)) {
1082 if (sb->s_flags & MS_RDONLY)
1083 ocfs2_set_ro_flag(osb, 0);
1086 status = ocfs2_verify_heartbeat(osb);
1089 goto read_super_error;
1092 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str,
1093 ocfs2_debugfs_root);
1094 if (!osb->osb_debug_root) {
1096 mlog(ML_ERROR, "Unable to create per-mount debugfs root.\n");
1097 goto read_super_error;
1100 osb->osb_ctxt = debugfs_create_file("fs_state", S_IFREG|S_IRUSR,
1101 osb->osb_debug_root,
1103 &ocfs2_osb_debug_fops);
1104 if (!osb->osb_ctxt) {
1107 goto read_super_error;
1110 if (ocfs2_meta_ecc(osb)) {
1111 status = ocfs2_blockcheck_stats_debugfs_install(
1112 &osb->osb_ecc_stats,
1113 osb->osb_debug_root);
1116 "Unable to create blockcheck statistics "
1118 goto read_super_error;
1122 status = ocfs2_mount_volume(sb);
1123 if (osb->root_inode)
1124 inode = igrab(osb->root_inode);
1127 goto read_super_error;
1132 goto read_super_error;
1135 root = d_alloc_root(inode);
1139 goto read_super_error;
1144 ocfs2_complete_mount_recovery(osb);
1146 if (ocfs2_mount_local(osb))
1147 snprintf(nodestr, sizeof(nodestr), "local");
1149 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num);
1151 printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %s, slot %d) "
1152 "with %s data mode.\n",
1153 osb->dev_str, nodestr, osb->slot_num,
1154 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" :
1157 atomic_set(&osb->vol_state, VOLUME_MOUNTED);
1158 wake_up(&osb->osb_mount_event);
1160 /* Now we can initialize quotas because we can afford to wait
1161 * for cluster locks recovery now. That also means that truncation
1162 * log recovery can happen but that waits for proper quota setup */
1163 if (!(sb->s_flags & MS_RDONLY)) {
1164 status = ocfs2_enable_quotas(osb);
1166 /* We have to err-out specially here because
1167 * s_root is already set */
1169 atomic_set(&osb->vol_state, VOLUME_DISABLED);
1170 wake_up(&osb->osb_mount_event);
1176 ocfs2_complete_quota_recovery(osb);
1178 /* Now we wake up again for processes waiting for quotas */
1179 atomic_set(&osb->vol_state, VOLUME_MOUNTED_QUOTAS);
1180 wake_up(&osb->osb_mount_event);
1192 atomic_set(&osb->vol_state, VOLUME_DISABLED);
1193 wake_up(&osb->osb_mount_event);
1194 ocfs2_dismount_volume(sb, 1);
1201 static int ocfs2_get_sb(struct file_system_type *fs_type,
1203 const char *dev_name,
1205 struct vfsmount *mnt)
1207 return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super,
1211 static struct file_system_type ocfs2_fs_type = {
1212 .owner = THIS_MODULE,
1214 .get_sb = ocfs2_get_sb, /* is this called when we mount
1216 .kill_sb = kill_block_super, /* set to the generic one
1217 * right now, but do we
1218 * need to change that? */
1219 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
1223 static int ocfs2_parse_options(struct super_block *sb,
1225 struct mount_options *mopt,
1231 mlog_entry("remount: %d, options: \"%s\"\n", is_remount,
1232 options ? options : "(none)");
1234 mopt->commit_interval = 0;
1235 mopt->mount_opt = 0;
1236 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
1237 mopt->slot = OCFS2_INVALID_SLOT;
1238 mopt->localalloc_opt = OCFS2_DEFAULT_LOCAL_ALLOC_SIZE;
1239 mopt->cluster_stack[0] = '\0';
1246 while ((p = strsep(&options, ",")) != NULL) {
1248 substring_t args[MAX_OPT_ARGS];
1253 token = match_token(p, tokens, args);
1256 mopt->mount_opt |= OCFS2_MOUNT_HB_LOCAL;
1259 mopt->mount_opt &= ~OCFS2_MOUNT_HB_LOCAL;
1262 if (match_int(&args[0], &option)) {
1267 mopt->mount_opt |= OCFS2_MOUNT_BARRIER;
1269 mopt->mount_opt &= ~OCFS2_MOUNT_BARRIER;
1272 mopt->mount_opt &= ~OCFS2_MOUNT_NOINTR;
1275 mopt->mount_opt |= OCFS2_MOUNT_NOINTR;
1278 mopt->mount_opt |= OCFS2_MOUNT_ERRORS_PANIC;
1281 mopt->mount_opt &= ~OCFS2_MOUNT_ERRORS_PANIC;
1283 case Opt_data_ordered:
1284 mopt->mount_opt &= ~OCFS2_MOUNT_DATA_WRITEBACK;
1286 case Opt_data_writeback:
1287 mopt->mount_opt |= OCFS2_MOUNT_DATA_WRITEBACK;
1289 case Opt_user_xattr:
1290 mopt->mount_opt &= ~OCFS2_MOUNT_NOUSERXATTR;
1292 case Opt_nouser_xattr:
1293 mopt->mount_opt |= OCFS2_MOUNT_NOUSERXATTR;
1295 case Opt_atime_quantum:
1296 if (match_int(&args[0], &option)) {
1301 mopt->atime_quantum = option;
1305 if (match_int(&args[0], &option)) {
1310 mopt->slot = (s16)option;
1314 if (match_int(&args[0], &option)) {
1321 option = JBD2_DEFAULT_MAX_COMMIT_AGE;
1322 mopt->commit_interval = HZ * option;
1324 case Opt_localalloc:
1326 if (match_int(&args[0], &option)) {
1330 if (option >= 0 && (option <= ocfs2_local_alloc_size(sb) * 8))
1331 mopt->localalloc_opt = option;
1333 case Opt_localflocks:
1335 * Changing this during remount could race
1336 * flock() requests, or "unbalance" existing
1337 * ones (e.g., a lock is taken in one mode but
1338 * dropped in the other). If users care enough
1339 * to flip locking modes during remount, we
1340 * could add a "local" flag to individual
1341 * flock structures for proper tracking of
1345 mopt->mount_opt |= OCFS2_MOUNT_LOCALFLOCKS;
1348 /* Check both that the option we were passed
1349 * is of the right length and that it is a proper
1350 * string of the right length.
1352 if (((args[0].to - args[0].from) !=
1353 OCFS2_STACK_LABEL_LEN) ||
1354 (strnlen(args[0].from,
1355 OCFS2_STACK_LABEL_LEN) !=
1356 OCFS2_STACK_LABEL_LEN)) {
1358 "Invalid cluster_stack option\n");
1362 memcpy(mopt->cluster_stack, args[0].from,
1363 OCFS2_STACK_LABEL_LEN);
1364 mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
1367 mopt->mount_opt |= OCFS2_MOUNT_INODE64;
1370 /* We check only on remount, otherwise features
1371 * aren't yet initialized. */
1372 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1373 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1374 mlog(ML_ERROR, "User quota requested but "
1375 "filesystem feature is not set\n");
1379 mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA;
1382 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1383 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1384 mlog(ML_ERROR, "Group quota requested but "
1385 "filesystem feature is not set\n");
1389 mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA;
1391 #ifdef CONFIG_OCFS2_FS_POSIX_ACL
1393 mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL;
1396 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
1401 printk(KERN_INFO "ocfs2 (no)acl options not supported\n");
1406 "Unrecognized mount option \"%s\" "
1407 "or missing value\n", p);
1420 static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1422 struct ocfs2_super *osb = OCFS2_SB(mnt->mnt_sb);
1423 unsigned long opts = osb->s_mount_opt;
1424 unsigned int local_alloc_megs;
1426 if (opts & OCFS2_MOUNT_HB_LOCAL)
1427 seq_printf(s, ",_netdev,heartbeat=local");
1429 seq_printf(s, ",heartbeat=none");
1431 if (opts & OCFS2_MOUNT_NOINTR)
1432 seq_printf(s, ",nointr");
1434 if (opts & OCFS2_MOUNT_DATA_WRITEBACK)
1435 seq_printf(s, ",data=writeback");
1437 seq_printf(s, ",data=ordered");
1439 if (opts & OCFS2_MOUNT_BARRIER)
1440 seq_printf(s, ",barrier=1");
1442 if (opts & OCFS2_MOUNT_ERRORS_PANIC)
1443 seq_printf(s, ",errors=panic");
1445 seq_printf(s, ",errors=remount-ro");
1447 if (osb->preferred_slot != OCFS2_INVALID_SLOT)
1448 seq_printf(s, ",preferred_slot=%d", osb->preferred_slot);
1450 if (osb->s_atime_quantum != OCFS2_DEFAULT_ATIME_QUANTUM)
1451 seq_printf(s, ",atime_quantum=%u", osb->s_atime_quantum);
1453 if (osb->osb_commit_interval)
1454 seq_printf(s, ",commit=%u",
1455 (unsigned) (osb->osb_commit_interval / HZ));
1457 local_alloc_megs = osb->local_alloc_bits >> (20 - osb->s_clustersize_bits);
1458 if (local_alloc_megs != OCFS2_DEFAULT_LOCAL_ALLOC_SIZE)
1459 seq_printf(s, ",localalloc=%d", local_alloc_megs);
1461 if (opts & OCFS2_MOUNT_LOCALFLOCKS)
1462 seq_printf(s, ",localflocks,");
1464 if (osb->osb_cluster_stack[0])
1465 seq_printf(s, ",cluster_stack=%.*s", OCFS2_STACK_LABEL_LEN,
1466 osb->osb_cluster_stack);
1467 if (opts & OCFS2_MOUNT_USRQUOTA)
1468 seq_printf(s, ",usrquota");
1469 if (opts & OCFS2_MOUNT_GRPQUOTA)
1470 seq_printf(s, ",grpquota");
1472 if (opts & OCFS2_MOUNT_NOUSERXATTR)
1473 seq_printf(s, ",nouser_xattr");
1475 seq_printf(s, ",user_xattr");
1477 if (opts & OCFS2_MOUNT_INODE64)
1478 seq_printf(s, ",inode64");
1480 #ifdef CONFIG_OCFS2_FS_POSIX_ACL
1481 if (opts & OCFS2_MOUNT_POSIX_ACL)
1482 seq_printf(s, ",acl");
1484 seq_printf(s, ",noacl");
1490 static int __init ocfs2_init(void)
1496 ocfs2_print_version();
1498 status = init_ocfs2_uptodate_cache();
1504 status = ocfs2_initialize_mem_caches();
1510 ocfs2_wq = create_singlethread_workqueue("ocfs2_wq");
1516 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
1517 if (!ocfs2_debugfs_root) {
1519 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
1522 status = ocfs2_quota_setup();
1526 ocfs2_set_locking_protocol();
1528 status = register_quota_format(&ocfs2_quota_format);
1531 ocfs2_quota_shutdown();
1532 ocfs2_free_mem_caches();
1533 exit_ocfs2_uptodate_cache();
1539 return register_filesystem(&ocfs2_fs_type);
1544 static void __exit ocfs2_exit(void)
1548 ocfs2_quota_shutdown();
1551 flush_workqueue(ocfs2_wq);
1552 destroy_workqueue(ocfs2_wq);
1555 unregister_quota_format(&ocfs2_quota_format);
1557 debugfs_remove(ocfs2_debugfs_root);
1559 ocfs2_free_mem_caches();
1561 unregister_filesystem(&ocfs2_fs_type);
1563 exit_ocfs2_uptodate_cache();
1568 static void ocfs2_put_super(struct super_block *sb)
1570 mlog_entry("(0x%p)\n", sb);
1574 ocfs2_sync_blockdev(sb);
1575 ocfs2_dismount_volume(sb, 0);
1582 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
1584 struct ocfs2_super *osb;
1585 u32 numbits, freebits;
1587 struct ocfs2_dinode *bm_lock;
1588 struct buffer_head *bh = NULL;
1589 struct inode *inode = NULL;
1591 mlog_entry("(%p, %p)\n", dentry->d_sb, buf);
1593 osb = OCFS2_SB(dentry->d_sb);
1595 inode = ocfs2_get_system_file_inode(osb,
1596 GLOBAL_BITMAP_SYSTEM_INODE,
1597 OCFS2_INVALID_SLOT);
1599 mlog(ML_ERROR, "failed to get bitmap inode\n");
1604 status = ocfs2_inode_lock(inode, &bh, 0);
1610 bm_lock = (struct ocfs2_dinode *) bh->b_data;
1612 numbits = le32_to_cpu(bm_lock->id1.bitmap1.i_total);
1613 freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used);
1615 buf->f_type = OCFS2_SUPER_MAGIC;
1616 buf->f_bsize = dentry->d_sb->s_blocksize;
1617 buf->f_namelen = OCFS2_MAX_FILENAME_LEN;
1618 buf->f_blocks = ((sector_t) numbits) *
1619 (osb->s_clustersize >> osb->sb->s_blocksize_bits);
1620 buf->f_bfree = ((sector_t) freebits) *
1621 (osb->s_clustersize >> osb->sb->s_blocksize_bits);
1622 buf->f_bavail = buf->f_bfree;
1623 buf->f_files = numbits;
1624 buf->f_ffree = freebits;
1628 ocfs2_inode_unlock(inode, 0);
1639 static void ocfs2_inode_init_once(void *data)
1641 struct ocfs2_inode_info *oi = data;
1644 oi->ip_open_count = 0;
1645 spin_lock_init(&oi->ip_lock);
1646 ocfs2_extent_map_init(&oi->vfs_inode);
1647 INIT_LIST_HEAD(&oi->ip_io_markers);
1648 oi->ip_created_trans = 0;
1649 oi->ip_last_trans = 0;
1650 oi->ip_dir_start_lookup = 0;
1652 init_rwsem(&oi->ip_alloc_sem);
1653 init_rwsem(&oi->ip_xattr_sem);
1654 mutex_init(&oi->ip_io_mutex);
1656 oi->ip_blkno = 0ULL;
1657 oi->ip_clusters = 0;
1659 ocfs2_lock_res_init_once(&oi->ip_rw_lockres);
1660 ocfs2_lock_res_init_once(&oi->ip_inode_lockres);
1661 ocfs2_lock_res_init_once(&oi->ip_open_lockres);
1663 ocfs2_metadata_cache_init(&oi->vfs_inode);
1665 inode_init_once(&oi->vfs_inode);
1668 static int ocfs2_initialize_mem_caches(void)
1670 ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache",
1671 sizeof(struct ocfs2_inode_info),
1673 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
1675 ocfs2_inode_init_once);
1676 ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache",
1677 sizeof(struct ocfs2_dquot),
1679 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
1682 ocfs2_qf_chunk_cachep = kmem_cache_create("ocfs2_qf_chunk_cache",
1683 sizeof(struct ocfs2_quota_chunk),
1685 (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD),
1687 if (!ocfs2_inode_cachep || !ocfs2_dquot_cachep ||
1688 !ocfs2_qf_chunk_cachep) {
1689 if (ocfs2_inode_cachep)
1690 kmem_cache_destroy(ocfs2_inode_cachep);
1691 if (ocfs2_dquot_cachep)
1692 kmem_cache_destroy(ocfs2_dquot_cachep);
1693 if (ocfs2_qf_chunk_cachep)
1694 kmem_cache_destroy(ocfs2_qf_chunk_cachep);
1701 static void ocfs2_free_mem_caches(void)
1703 if (ocfs2_inode_cachep)
1704 kmem_cache_destroy(ocfs2_inode_cachep);
1705 ocfs2_inode_cachep = NULL;
1707 if (ocfs2_dquot_cachep)
1708 kmem_cache_destroy(ocfs2_dquot_cachep);
1709 ocfs2_dquot_cachep = NULL;
1711 if (ocfs2_qf_chunk_cachep)
1712 kmem_cache_destroy(ocfs2_qf_chunk_cachep);
1713 ocfs2_qf_chunk_cachep = NULL;
1716 static int ocfs2_get_sector(struct super_block *sb,
1717 struct buffer_head **bh,
1721 if (!sb_set_blocksize(sb, sect_size)) {
1722 mlog(ML_ERROR, "unable to set blocksize\n");
1726 *bh = sb_getblk(sb, block);
1732 if (!buffer_dirty(*bh))
1733 clear_buffer_uptodate(*bh);
1735 ll_rw_block(READ, 1, bh);
1736 wait_on_buffer(*bh);
1737 if (!buffer_uptodate(*bh)) {
1747 static int ocfs2_mount_volume(struct super_block *sb)
1750 int unlock_super = 0;
1751 struct ocfs2_super *osb = OCFS2_SB(sb);
1755 if (ocfs2_is_hard_readonly(osb))
1758 status = ocfs2_dlm_init(osb);
1764 status = ocfs2_super_lock(osb, 1);
1771 /* This will load up the node map and add ourselves to it. */
1772 status = ocfs2_find_slot(osb);
1778 /* load all node-local system inodes */
1779 status = ocfs2_init_local_system_inodes(osb);
1785 status = ocfs2_check_volume(osb);
1791 status = ocfs2_truncate_log_init(osb);
1797 ocfs2_super_unlock(osb, 1);
1803 static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
1805 int tmp, hangup_needed = 0;
1806 struct ocfs2_super *osb = NULL;
1809 mlog_entry("(0x%p)\n", sb);
1815 debugfs_remove(osb->osb_ctxt);
1817 /* Orphan scan should be stopped as early as possible */
1818 ocfs2_orphan_scan_stop(osb);
1820 ocfs2_disable_quotas(osb);
1822 ocfs2_shutdown_local_alloc(osb);
1824 ocfs2_truncate_log_shutdown(osb);
1826 /* This will disable recovery and flush any recovery work. */
1827 ocfs2_recovery_exit(osb);
1829 ocfs2_journal_shutdown(osb);
1831 ocfs2_sync_blockdev(sb);
1833 /* No cluster connection means we've failed during mount, so skip
1834 * all the steps which depended on that to complete. */
1836 tmp = ocfs2_super_lock(osb, 1);
1843 if (osb->slot_num != OCFS2_INVALID_SLOT)
1844 ocfs2_put_slot(osb);
1847 ocfs2_super_unlock(osb, 1);
1849 ocfs2_release_system_inodes(osb);
1852 * If we're dismounting due to mount error, mount.ocfs2 will clean
1853 * up heartbeat. If we're a local mount, there is no heartbeat.
1854 * If we failed before we got a uuid_str yet, we can't stop
1855 * heartbeat. Otherwise, do it.
1857 if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str)
1861 ocfs2_dlm_shutdown(osb, hangup_needed);
1863 ocfs2_blockcheck_stats_debugfs_remove(&osb->osb_ecc_stats);
1864 debugfs_remove(osb->osb_debug_root);
1867 ocfs2_cluster_hangup(osb->uuid_str, strlen(osb->uuid_str));
1869 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);
1871 if (ocfs2_mount_local(osb))
1872 snprintf(nodestr, sizeof(nodestr), "local");
1874 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num);
1876 printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %s)\n",
1877 osb->dev_str, nodestr);
1879 ocfs2_delete_osb(osb);
1882 sb->s_fs_info = NULL;
1885 static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uuid,
1886 unsigned uuid_bytes)
1891 BUG_ON(uuid_bytes != OCFS2_VOL_UUID_LEN);
1893 osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL);
1894 if (osb->uuid_str == NULL)
1897 for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) {
1898 /* print with null */
1899 ret = snprintf(ptr, 3, "%02X", uuid[i]);
1900 if (ret != 2) /* drop super cleans up */
1902 /* then only advance past the last char */
1909 static int ocfs2_initialize_super(struct super_block *sb,
1910 struct buffer_head *bh,
1912 struct ocfs2_blockcheck_stats *stats)
1915 int i, cbits, bbits;
1916 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
1917 struct inode *inode = NULL;
1918 struct ocfs2_journal *journal;
1919 __le32 uuid_net_key;
1920 struct ocfs2_super *osb;
1924 osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL);
1931 sb->s_fs_info = osb;
1932 sb->s_op = &ocfs2_sops;
1933 sb->s_export_op = &ocfs2_export_ops;
1934 sb->s_qcop = &ocfs2_quotactl_ops;
1935 sb->dq_op = &ocfs2_quota_operations;
1936 sb->s_xattr = ocfs2_xattr_handlers;
1937 sb->s_time_gran = 1;
1938 sb->s_flags |= MS_NOATIME;
1939 /* this is needed to support O_LARGEFILE */
1940 cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
1941 bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
1942 sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
1944 osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
1946 for (i = 0; i < 3; i++)
1947 osb->osb_dx_seed[i] = le32_to_cpu(di->id2.i_super.s_dx_seed[i]);
1948 osb->osb_dx_seed[3] = le32_to_cpu(di->id2.i_super.s_uuid_hash);
1951 /* Save off for ocfs2_rw_direct */
1952 osb->s_sectsize_bits = blksize_bits(sector_size);
1953 BUG_ON(!osb->s_sectsize_bits);
1955 spin_lock_init(&osb->dc_task_lock);
1956 init_waitqueue_head(&osb->dc_event);
1957 osb->dc_work_sequence = 0;
1958 osb->dc_wake_sequence = 0;
1959 INIT_LIST_HEAD(&osb->blocked_lock_list);
1960 osb->blocked_lock_count = 0;
1961 spin_lock_init(&osb->osb_lock);
1962 spin_lock_init(&osb->osb_xattr_lock);
1963 ocfs2_init_inode_steal_slot(osb);
1965 atomic_set(&osb->alloc_stats.moves, 0);
1966 atomic_set(&osb->alloc_stats.local_data, 0);
1967 atomic_set(&osb->alloc_stats.bitmap_data, 0);
1968 atomic_set(&osb->alloc_stats.bg_allocs, 0);
1969 atomic_set(&osb->alloc_stats.bg_extends, 0);
1971 /* Copy the blockcheck stats from the superblock probe */
1972 osb->osb_ecc_stats = *stats;
1974 ocfs2_init_node_maps(osb);
1976 snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
1977 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
1979 status = ocfs2_recovery_init(osb);
1981 mlog(ML_ERROR, "Unable to initialize recovery state\n");
1986 status = ocfs2_orphan_scan_init(osb);
1988 mlog(ML_ERROR, "Unable to initialize delayed orphan scan\n");
1993 init_waitqueue_head(&osb->checkpoint_event);
1994 atomic_set(&osb->needs_checkpoint, 0);
1996 osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
1998 osb->slot_num = OCFS2_INVALID_SLOT;
2000 osb->s_xattr_inline_size = le16_to_cpu(
2001 di->id2.i_super.s_xattr_inline_size);
2003 osb->local_alloc_state = OCFS2_LA_UNUSED;
2004 osb->local_alloc_bh = NULL;
2005 INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker);
2007 init_waitqueue_head(&osb->osb_mount_event);
2009 osb->vol_label = kmalloc(OCFS2_MAX_VOL_LABEL_LEN, GFP_KERNEL);
2010 if (!osb->vol_label) {
2011 mlog(ML_ERROR, "unable to alloc vol label\n");
2016 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
2017 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
2018 mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
2023 mlog(0, "max_slots for this device: %u\n", osb->max_slots);
2025 osb->slot_recovery_generations =
2026 kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
2028 if (!osb->slot_recovery_generations) {
2034 init_waitqueue_head(&osb->osb_wipe_event);
2035 osb->osb_orphan_wipes = kcalloc(osb->max_slots,
2036 sizeof(*osb->osb_orphan_wipes),
2038 if (!osb->osb_orphan_wipes) {
2044 osb->s_feature_compat =
2045 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat);
2046 osb->s_feature_ro_compat =
2047 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_ro_compat);
2048 osb->s_feature_incompat =
2049 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_incompat);
2051 if ((i = OCFS2_HAS_INCOMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_INCOMPAT_SUPP))) {
2052 mlog(ML_ERROR, "couldn't mount because of unsupported "
2053 "optional features (%x).\n", i);
2057 if (!(osb->sb->s_flags & MS_RDONLY) &&
2058 (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) {
2059 mlog(ML_ERROR, "couldn't mount RDWR because of "
2060 "unsupported optional features (%x).\n", i);
2065 if (ocfs2_userspace_stack(osb)) {
2066 memcpy(osb->osb_cluster_stack,
2067 OCFS2_RAW_SB(di)->s_cluster_info.ci_stack,
2068 OCFS2_STACK_LABEL_LEN);
2069 osb->osb_cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
2070 if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) {
2072 "couldn't mount because of an invalid "
2073 "cluster stack label (%s) \n",
2074 osb->osb_cluster_stack);
2079 /* The empty string is identical with classic tools that
2080 * don't know about s_cluster_info. */
2081 osb->osb_cluster_stack[0] = '\0';
2084 get_random_bytes(&osb->s_next_generation, sizeof(u32));
2087 * This should be done in ocfs2_journal_init(), but unknown
2088 * ordering issues will cause the filesystem to crash.
2089 * If anyone wants to figure out what part of the code
2090 * refers to osb->journal before ocfs2_journal_init() is run,
2093 /* initialize our journal structure */
2095 journal = kzalloc(sizeof(struct ocfs2_journal), GFP_KERNEL);
2097 mlog(ML_ERROR, "unable to alloc journal\n");
2101 osb->journal = journal;
2102 journal->j_osb = osb;
2104 atomic_set(&journal->j_num_trans, 0);
2105 init_rwsem(&journal->j_trans_barrier);
2106 init_waitqueue_head(&journal->j_checkpointed);
2107 spin_lock_init(&journal->j_lock);
2108 journal->j_trans_id = (unsigned long) 1;
2109 INIT_LIST_HEAD(&journal->j_la_cleanups);
2110 INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
2111 journal->j_state = OCFS2_JOURNAL_FREE;
2113 INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes);
2114 osb->dentry_lock_list = NULL;
2116 /* get some pseudo constants for clustersize bits */
2117 osb->s_clustersize_bits =
2118 le32_to_cpu(di->id2.i_super.s_clustersize_bits);
2119 osb->s_clustersize = 1 << osb->s_clustersize_bits;
2120 mlog(0, "clusterbits=%d\n", osb->s_clustersize_bits);
2122 if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE ||
2123 osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) {
2124 mlog(ML_ERROR, "Volume has invalid cluster size (%d)\n",
2125 osb->s_clustersize);
2130 if (ocfs2_clusters_to_blocks(osb->sb, le32_to_cpu(di->i_clusters) - 1)
2132 mlog(ML_ERROR, "Volume might try to write to blocks beyond "
2133 "what jbd can address in 32 bits.\n");
2138 if (ocfs2_setup_osb_uuid(osb, di->id2.i_super.s_uuid,
2139 sizeof(di->id2.i_super.s_uuid))) {
2140 mlog(ML_ERROR, "Out of memory trying to setup our uuid.\n");
2145 memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key));
2147 strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
2148 osb->vol_label[63] = '\0';
2149 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);
2150 osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);
2151 osb->first_cluster_group_blkno =
2152 le64_to_cpu(di->id2.i_super.s_first_cluster_group);
2153 osb->fs_generation = le32_to_cpu(di->i_fs_generation);
2154 osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash);
2155 mlog(0, "vol_label: %s\n", osb->vol_label);
2156 mlog(0, "uuid: %s\n", osb->uuid_str);
2157 mlog(0, "root_blkno=%llu, system_dir_blkno=%llu\n",
2158 (unsigned long long)osb->root_blkno,
2159 (unsigned long long)osb->system_dir_blkno);
2161 osb->osb_dlm_debug = ocfs2_new_dlm_debug();
2162 if (!osb->osb_dlm_debug) {
2168 atomic_set(&osb->vol_state, VOLUME_INIT);
2170 /* load root, system_dir, and all global system inodes */
2171 status = ocfs2_init_global_system_inodes(osb);
2180 inode = ocfs2_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE,
2181 OCFS2_INVALID_SLOT);
2188 osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno;
2191 osb->bitmap_cpg = ocfs2_group_bitmap_size(sb) * 8;
2193 status = ocfs2_init_slot_info(osb);
2205 * will return: -EAGAIN if it is ok to keep searching for superblocks
2206 * -EINVAL if there is a bad superblock
2209 static int ocfs2_verify_volume(struct ocfs2_dinode *di,
2210 struct buffer_head *bh,
2212 struct ocfs2_blockcheck_stats *stats)
2214 int status = -EAGAIN;
2218 if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
2219 strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
2220 /* We have to do a raw check of the feature here */
2221 if (le32_to_cpu(di->id2.i_super.s_feature_incompat) &
2222 OCFS2_FEATURE_INCOMPAT_META_ECC) {
2223 status = ocfs2_block_check_validate(bh->b_data,
2231 if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) {
2232 mlog(ML_ERROR, "found superblock with incorrect block "
2233 "size: found %u, should be %u\n",
2234 1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits),
2236 } else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
2237 OCFS2_MAJOR_REV_LEVEL ||
2238 le16_to_cpu(di->id2.i_super.s_minor_rev_level) !=
2239 OCFS2_MINOR_REV_LEVEL) {
2240 mlog(ML_ERROR, "found superblock with bad version: "
2241 "found %u.%u, should be %u.%u\n",
2242 le16_to_cpu(di->id2.i_super.s_major_rev_level),
2243 le16_to_cpu(di->id2.i_super.s_minor_rev_level),
2244 OCFS2_MAJOR_REV_LEVEL,
2245 OCFS2_MINOR_REV_LEVEL);
2246 } else if (bh->b_blocknr != le64_to_cpu(di->i_blkno)) {
2247 mlog(ML_ERROR, "bad block number on superblock: "
2248 "found %llu, should be %llu\n",
2249 (unsigned long long)le64_to_cpu(di->i_blkno),
2250 (unsigned long long)bh->b_blocknr);
2251 } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 ||
2252 le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) {
2253 mlog(ML_ERROR, "bad cluster size found: %u\n",
2254 1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits));
2255 } else if (!le64_to_cpu(di->id2.i_super.s_root_blkno)) {
2256 mlog(ML_ERROR, "bad root_blkno: 0\n");
2257 } else if (!le64_to_cpu(di->id2.i_super.s_system_dir_blkno)) {
2258 mlog(ML_ERROR, "bad system_dir_blkno: 0\n");
2259 } else if (le16_to_cpu(di->id2.i_super.s_max_slots) > OCFS2_MAX_SLOTS) {
2261 "Superblock slots found greater than file system "
2262 "maximum: found %u, max %u\n",
2263 le16_to_cpu(di->id2.i_super.s_max_slots),
2276 static int ocfs2_check_volume(struct ocfs2_super *osb)
2281 struct ocfs2_dinode *local_alloc = NULL; /* only used if we
2287 /* Init our journal object. */
2288 status = ocfs2_journal_init(osb->journal, &dirty);
2290 mlog(ML_ERROR, "Could not initialize journal!\n");
2294 /* If the journal was unmounted cleanly then we don't want to
2295 * recover anything. Otherwise, journal_load will do that
2296 * dirty work for us :) */
2298 status = ocfs2_journal_wipe(osb->journal, 0);
2304 mlog(ML_NOTICE, "File system was not unmounted cleanly, "
2305 "recovering volume.\n");
2308 local = ocfs2_mount_local(osb);
2310 /* will play back anything left in the journal. */
2311 status = ocfs2_journal_load(osb->journal, local, dirty);
2313 mlog(ML_ERROR, "ocfs2 journal load failed! %d\n", status);
2318 /* recover my local alloc if we didn't unmount cleanly. */
2319 status = ocfs2_begin_local_alloc_recovery(osb,
2326 /* we complete the recovery process after we've marked
2327 * ourselves as mounted. */
2330 mlog(0, "Journal loaded.\n");
2332 status = ocfs2_load_local_alloc(osb);
2339 /* Recovery will be completed after we've mounted the
2340 * rest of the volume. */
2342 osb->local_alloc_copy = local_alloc;
2346 /* go through each journal, trylock it and if you get the
2347 * lock, and it's marked as dirty, set the bit in the recover
2348 * map and launch a recovery thread for it. */
2349 status = ocfs2_mark_dead_nodes(osb);
2355 status = ocfs2_compute_replay_slots(osb);
2368 * The routine gets called from dismount or close whenever a dismount on
2369 * volume is requested and the osb open count becomes 1.
2370 * It will remove the osb from the global list and also free up all the
2371 * initialized resources and fileobject.
2373 static void ocfs2_delete_osb(struct ocfs2_super *osb)
2377 /* This function assumes that the caller has the main osb resource */
2379 ocfs2_free_slot_info(osb);
2381 kfree(osb->osb_orphan_wipes);
2382 kfree(osb->slot_recovery_generations);
2384 * This belongs in journal shutdown, but because we have to
2385 * allocate osb->journal at the start of ocfs2_initalize_osb(),
2388 kfree(osb->journal);
2389 if (osb->local_alloc_copy)
2390 kfree(osb->local_alloc_copy);
2391 kfree(osb->uuid_str);
2392 ocfs2_put_dlm_debug(osb->osb_dlm_debug);
2393 memset(osb, 0, sizeof(struct ocfs2_super));
2398 /* Put OCFS2 into a readonly state, or (if the user specifies it),
2399 * panic(). We do not support continue-on-error operation. */
2400 static void ocfs2_handle_error(struct super_block *sb)
2402 struct ocfs2_super *osb = OCFS2_SB(sb);
2404 if (osb->s_mount_opt & OCFS2_MOUNT_ERRORS_PANIC)
2405 panic("OCFS2: (device %s): panic forced after error\n",
2408 ocfs2_set_osb_flag(osb, OCFS2_OSB_ERROR_FS);
2410 if (sb->s_flags & MS_RDONLY &&
2411 (ocfs2_is_soft_readonly(osb) ||
2412 ocfs2_is_hard_readonly(osb)))
2415 printk(KERN_CRIT "File system is now read-only due to the potential "
2416 "of on-disk corruption. Please run fsck.ocfs2 once the file "
2417 "system is unmounted.\n");
2418 sb->s_flags |= MS_RDONLY;
2419 ocfs2_set_ro_flag(osb, 0);
2422 static char error_buf[1024];
2424 void __ocfs2_error(struct super_block *sb,
2425 const char *function,
2426 const char *fmt, ...)
2430 va_start(args, fmt);
2431 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
2434 /* Not using mlog here because we want to show the actual
2435 * function the error came from. */
2436 printk(KERN_CRIT "OCFS2: ERROR (device %s): %s: %s\n",
2437 sb->s_id, function, error_buf);
2439 ocfs2_handle_error(sb);
2442 /* Handle critical errors. This is intentionally more drastic than
2443 * ocfs2_handle_error, so we only use for things like journal errors,
2445 void __ocfs2_abort(struct super_block* sb,
2446 const char *function,
2447 const char *fmt, ...)
2451 va_start(args, fmt);
2452 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
2455 printk(KERN_CRIT "OCFS2: abort (device %s): %s: %s\n",
2456 sb->s_id, function, error_buf);
2458 /* We don't have the cluster support yet to go straight to
2459 * hard readonly in here. Until then, we want to keep
2460 * ocfs2_abort() so that we can at least mark critical
2463 * TODO: This should abort the journal and alert other nodes
2464 * that our slot needs recovery. */
2466 /* Force a panic(). This stinks, but it's better than letting
2467 * things continue without having a proper hard readonly
2469 OCFS2_SB(sb)->s_mount_opt |= OCFS2_MOUNT_ERRORS_PANIC;
2470 ocfs2_handle_error(sb);
2473 module_init(ocfs2_init);
2474 module_exit(ocfs2_exit);