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>
46 #define MLOG_MASK_PREFIX ML_SUPER
47 #include <cluster/masklog.h>
51 /* this should be the only file to include a version 1 header */
52 #include "ocfs1_fs_compat.h"
55 #include "blockcheck.h"
58 #include "extent_map.h"
59 #include "heartbeat.h"
62 #include "localalloc.h"
72 #include "buffer_head_io.h"
74 static struct kmem_cache *ocfs2_inode_cachep = NULL;
75 struct kmem_cache *ocfs2_dquot_cachep;
76 struct kmem_cache *ocfs2_qf_chunk_cachep;
78 /* OCFS2 needs to schedule several differnt types of work which
79 * require cluster locking, disk I/O, recovery waits, etc. Since these
80 * types of work tend to be heavy we avoid using the kernel events
81 * workqueue and schedule on our own. */
82 struct workqueue_struct *ocfs2_wq = NULL;
84 static struct dentry *ocfs2_debugfs_root = NULL;
86 MODULE_AUTHOR("Oracle");
87 MODULE_LICENSE("GPL");
91 unsigned long commit_interval;
92 unsigned long mount_opt;
93 unsigned int atime_quantum;
95 unsigned int localalloc_opt;
96 char cluster_stack[OCFS2_STACK_LABEL_LEN + 1];
99 static int ocfs2_parse_options(struct super_block *sb, char *options,
100 struct mount_options *mopt,
102 static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt);
103 static void ocfs2_put_super(struct super_block *sb);
104 static int ocfs2_mount_volume(struct super_block *sb);
105 static int ocfs2_remount(struct super_block *sb, int *flags, char *data);
106 static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err);
107 static int ocfs2_initialize_mem_caches(void);
108 static void ocfs2_free_mem_caches(void);
109 static void ocfs2_delete_osb(struct ocfs2_super *osb);
111 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf);
113 static int ocfs2_sync_fs(struct super_block *sb, int wait);
115 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb);
116 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb);
117 static void ocfs2_release_system_inodes(struct ocfs2_super *osb);
118 static int ocfs2_check_volume(struct ocfs2_super *osb);
119 static int ocfs2_verify_volume(struct ocfs2_dinode *di,
120 struct buffer_head *bh,
122 struct ocfs2_blockcheck_stats *stats);
123 static int ocfs2_initialize_super(struct super_block *sb,
124 struct buffer_head *bh,
126 struct ocfs2_blockcheck_stats *stats);
127 static int ocfs2_get_sector(struct super_block *sb,
128 struct buffer_head **bh,
131 static void ocfs2_write_super(struct super_block *sb);
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 .write_super = ocfs2_write_super,
147 .put_super = ocfs2_put_super,
148 .remount_fs = ocfs2_remount,
149 .show_options = ocfs2_show_options,
150 .quota_read = ocfs2_quota_read,
151 .quota_write = ocfs2_quota_write,
180 static const match_table_t tokens = {
181 {Opt_barrier, "barrier=%u"},
182 {Opt_err_panic, "errors=panic"},
183 {Opt_err_ro, "errors=remount-ro"},
185 {Opt_nointr, "nointr"},
186 {Opt_hb_none, OCFS2_HB_NONE},
187 {Opt_hb_local, OCFS2_HB_LOCAL},
188 {Opt_data_ordered, "data=ordered"},
189 {Opt_data_writeback, "data=writeback"},
190 {Opt_atime_quantum, "atime_quantum=%u"},
191 {Opt_slot, "preferred_slot=%u"},
192 {Opt_commit, "commit=%u"},
193 {Opt_localalloc, "localalloc=%d"},
194 {Opt_localflocks, "localflocks"},
195 {Opt_stack, "cluster_stack=%s"},
196 {Opt_user_xattr, "user_xattr"},
197 {Opt_nouser_xattr, "nouser_xattr"},
198 {Opt_inode64, "inode64"},
200 {Opt_noacl, "noacl"},
201 {Opt_usrquota, "usrquota"},
202 {Opt_grpquota, "grpquota"},
206 #ifdef CONFIG_DEBUG_FS
207 static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
211 struct ocfs2_cluster_connection *cconn = osb->cconn;
212 struct ocfs2_recovery_map *rm = osb->recovery_map;
213 struct ocfs2_orphan_scan *os;
215 out += snprintf(buf + out, len - out,
216 "%10s => Id: %-s Uuid: %-s Gen: 0x%X Label: %-s\n",
217 "Device", osb->dev_str, osb->uuid_str,
218 osb->fs_generation, osb->vol_label);
220 out += snprintf(buf + out, len - out,
221 "%10s => State: %d Flags: 0x%lX\n", "Volume",
222 atomic_read(&osb->vol_state), osb->osb_flags);
224 out += snprintf(buf + out, len - out,
225 "%10s => Block: %lu Cluster: %d\n", "Sizes",
226 osb->sb->s_blocksize, osb->s_clustersize);
228 out += snprintf(buf + out, len - out,
229 "%10s => Compat: 0x%X Incompat: 0x%X "
231 "Features", osb->s_feature_compat,
232 osb->s_feature_incompat, osb->s_feature_ro_compat);
234 out += snprintf(buf + out, len - out,
235 "%10s => Opts: 0x%lX AtimeQuanta: %u\n", "Mount",
236 osb->s_mount_opt, osb->s_atime_quantum);
238 out += snprintf(buf + out, len - out,
239 "%10s => Stack: %s Name: %*s Version: %d.%d\n",
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, cconn->cc_version.pv_minor);
246 spin_lock(&osb->dc_task_lock);
247 out += snprintf(buf + out, len - out,
248 "%10s => Pid: %d Count: %lu WakeSeq: %lu "
249 "WorkSeq: %lu\n", "DownCnvt",
250 task_pid_nr(osb->dc_task), osb->blocked_lock_count,
251 osb->dc_wake_sequence, osb->dc_work_sequence);
252 spin_unlock(&osb->dc_task_lock);
254 spin_lock(&osb->osb_lock);
255 out += snprintf(buf + out, len - out, "%10s => Pid: %d Nodes:",
257 (osb->recovery_thread_task ?
258 task_pid_nr(osb->recovery_thread_task) : -1));
259 if (rm->rm_used == 0)
260 out += snprintf(buf + out, len - out, " None\n");
262 for (i = 0; i < rm->rm_used; i++)
263 out += snprintf(buf + out, len - out, " %d",
265 out += snprintf(buf + out, len - out, "\n");
267 spin_unlock(&osb->osb_lock);
269 out += snprintf(buf + out, len - out,
270 "%10s => Pid: %d Interval: %lu Needs: %d\n", "Commit",
271 task_pid_nr(osb->commit_task), osb->osb_commit_interval,
272 atomic_read(&osb->needs_checkpoint));
274 out += snprintf(buf + out, len - out,
275 "%10s => State: %d NumTxns: %d TxnId: %lu\n",
276 "Journal", osb->journal->j_state,
277 atomic_read(&osb->journal->j_num_trans),
278 osb->journal->j_trans_id);
280 out += snprintf(buf + out, len - out,
281 "%10s => GlobalAllocs: %d LocalAllocs: %d "
282 "SubAllocs: %d LAWinMoves: %d SAExtends: %d\n",
284 atomic_read(&osb->alloc_stats.bitmap_data),
285 atomic_read(&osb->alloc_stats.local_data),
286 atomic_read(&osb->alloc_stats.bg_allocs),
287 atomic_read(&osb->alloc_stats.moves),
288 atomic_read(&osb->alloc_stats.bg_extends));
290 out += snprintf(buf + out, len - out,
291 "%10s => State: %u Descriptor: %llu Size: %u bits "
292 "Default: %u bits\n",
293 "LocalAlloc", osb->local_alloc_state,
294 (unsigned long long)osb->la_last_gd,
295 osb->local_alloc_bits, osb->local_alloc_default_bits);
297 spin_lock(&osb->osb_lock);
298 out += snprintf(buf + out, len - out,
299 "%10s => Slot: %d NumStolen: %d\n", "Steal",
300 osb->s_inode_steal_slot,
301 atomic_read(&osb->s_num_inodes_stolen));
302 spin_unlock(&osb->osb_lock);
304 out += snprintf(buf + out, len - out, "%10s => %3s %10s\n",
305 "Slots", "Num", "RecoGen");
307 for (i = 0; i < osb->max_slots; ++i) {
308 out += snprintf(buf + out, len - out,
309 "%10s %c %3d %10d\n",
311 (i == osb->slot_num ? '*' : ' '),
312 i, osb->slot_recovery_generations[i]);
315 os = &osb->osb_orphan_scan;
316 out += snprintf(buf + out, len - out, "Orphan Scan=> ");
317 out += snprintf(buf + out, len - out, "Local: %u Global: %u ",
318 os->os_count, os->os_seqno);
319 out += snprintf(buf + out, len - out, " Last Scan: %lu seconds ago\n",
320 (get_seconds() - os->os_scantime.tv_sec));
325 static int ocfs2_osb_debug_open(struct inode *inode, struct file *file)
327 struct ocfs2_super *osb = inode->i_private;
330 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
334 i_size_write(inode, ocfs2_osb_dump(osb, buf, PAGE_SIZE));
336 file->private_data = buf;
343 static int ocfs2_debug_release(struct inode *inode, struct file *file)
345 kfree(file->private_data);
349 static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,
350 size_t nbytes, loff_t *ppos)
352 return simple_read_from_buffer(buf, nbytes, ppos, file->private_data,
353 i_size_read(file->f_mapping->host));
356 static int ocfs2_osb_debug_open(struct inode *inode, struct file *file)
360 static int ocfs2_debug_release(struct inode *inode, struct file *file)
364 static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,
365 size_t nbytes, loff_t *ppos)
369 #endif /* CONFIG_DEBUG_FS */
371 static struct file_operations ocfs2_osb_debug_fops = {
372 .open = ocfs2_osb_debug_open,
373 .release = ocfs2_debug_release,
374 .read = ocfs2_debug_read,
375 .llseek = generic_file_llseek,
379 * write_super and sync_fs ripped right out of ext3.
381 static void ocfs2_write_super(struct super_block *sb)
383 if (mutex_trylock(&sb->s_lock) != 0)
388 static int ocfs2_sync_fs(struct super_block *sb, int wait)
392 struct ocfs2_super *osb = OCFS2_SB(sb);
396 if (ocfs2_is_hard_readonly(osb))
400 status = ocfs2_flush_truncate_log(osb);
404 ocfs2_schedule_truncate_log_flush(osb, 0);
407 if (jbd2_journal_start_commit(OCFS2_SB(sb)->journal->j_journal,
410 jbd2_log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
416 static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino)
418 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
419 && (ino == USER_QUOTA_SYSTEM_INODE
420 || ino == LOCAL_USER_QUOTA_SYSTEM_INODE))
422 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
423 && (ino == GROUP_QUOTA_SYSTEM_INODE
424 || ino == LOCAL_GROUP_QUOTA_SYSTEM_INODE))
429 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
431 struct inode *new = NULL;
437 new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
439 status = PTR_ERR(new);
443 osb->root_inode = new;
445 new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
447 status = PTR_ERR(new);
451 osb->sys_root_inode = new;
453 for (i = OCFS2_FIRST_ONLINE_SYSTEM_INODE;
454 i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) {
455 if (!ocfs2_need_system_inode(osb, i))
457 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
459 ocfs2_release_system_inodes(osb);
462 /* FIXME: Should ERROR_RO_FS */
463 mlog(ML_ERROR, "Unable to load system inode %d, "
464 "possibly corrupt fs?", i);
467 // the array now has one ref, so drop this one
476 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb)
478 struct inode *new = NULL;
484 for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1;
485 i < NUM_SYSTEM_INODES;
487 if (!ocfs2_need_system_inode(osb, i))
489 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
491 ocfs2_release_system_inodes(osb);
493 mlog(ML_ERROR, "status=%d, sysfile=%d, slot=%d\n",
494 status, i, osb->slot_num);
497 /* the array now has one ref, so drop this one */
506 static void ocfs2_release_system_inodes(struct ocfs2_super *osb)
513 for (i = 0; i < NUM_SYSTEM_INODES; i++) {
514 inode = osb->system_inodes[i];
517 osb->system_inodes[i] = NULL;
521 inode = osb->sys_root_inode;
524 osb->sys_root_inode = NULL;
527 inode = osb->root_inode;
530 osb->root_inode = NULL;
536 /* We're allocating fs objects, use GFP_NOFS */
537 static struct inode *ocfs2_alloc_inode(struct super_block *sb)
539 struct ocfs2_inode_info *oi;
541 oi = kmem_cache_alloc(ocfs2_inode_cachep, GFP_NOFS);
545 jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
546 return &oi->vfs_inode;
549 static void ocfs2_destroy_inode(struct inode *inode)
551 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
554 static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
557 unsigned int bytes = 1 << cbits;
558 unsigned int trim = bytes;
559 unsigned int bitshift = 32;
562 * i_size and all block offsets in ocfs2 are always 64 bits
563 * wide. i_clusters is 32 bits, in cluster-sized units. So on
564 * 64 bit platforms, cluster size will be the limiting factor.
567 #if BITS_PER_LONG == 32
568 # if defined(CONFIG_LBD)
569 BUILD_BUG_ON(sizeof(sector_t) != 8);
571 * We might be limited by page cache size.
573 if (bytes > PAGE_CACHE_SIZE) {
574 bytes = PAGE_CACHE_SIZE;
577 * Shift by 31 here so that we don't get larger than
584 * We are limited by the size of sector_t. Use block size, as
585 * that's what we expose to the VFS.
594 * Trim by a whole cluster when we can actually approach the
595 * on-disk limits. Otherwise we can overflow i_clusters when
596 * an extent start is at the max offset.
598 return (((unsigned long long)bytes) << bitshift) - trim;
601 static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
603 int incompat_features;
605 struct mount_options parsed_options;
606 struct ocfs2_super *osb = OCFS2_SB(sb);
608 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) {
613 if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
614 (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
616 mlog(ML_ERROR, "Cannot change heartbeat mode on remount\n");
620 if ((osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK) !=
621 (parsed_options.mount_opt & OCFS2_MOUNT_DATA_WRITEBACK)) {
623 mlog(ML_ERROR, "Cannot change data mode on remount\n");
627 /* Probably don't want this on remount; it might
628 * mess with other nodes */
629 if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64) &&
630 (parsed_options.mount_opt & OCFS2_MOUNT_INODE64)) {
632 mlog(ML_ERROR, "Cannot enable inode64 on remount\n");
636 /* We're going to/from readonly mode. */
637 if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
638 /* Disable quota accounting before remounting RO */
639 if (*flags & MS_RDONLY) {
640 ret = ocfs2_susp_quotas(osb, 0);
644 /* Lock here so the check of HARD_RO and the potential
645 * setting of SOFT_RO is atomic. */
646 spin_lock(&osb->osb_lock);
647 if (osb->osb_flags & OCFS2_OSB_HARD_RO) {
648 mlog(ML_ERROR, "Remount on readonly device is forbidden.\n");
653 if (*flags & MS_RDONLY) {
654 mlog(0, "Going to ro mode.\n");
655 sb->s_flags |= MS_RDONLY;
656 osb->osb_flags |= OCFS2_OSB_SOFT_RO;
658 mlog(0, "Making ro filesystem writeable.\n");
660 if (osb->osb_flags & OCFS2_OSB_ERROR_FS) {
661 mlog(ML_ERROR, "Cannot remount RDWR "
662 "filesystem due to previous errors.\n");
666 incompat_features = OCFS2_HAS_RO_COMPAT_FEATURE(sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP);
667 if (incompat_features) {
668 mlog(ML_ERROR, "Cannot remount RDWR because "
669 "of unsupported optional features "
670 "(%x).\n", incompat_features);
674 sb->s_flags &= ~MS_RDONLY;
675 osb->osb_flags &= ~OCFS2_OSB_SOFT_RO;
678 spin_unlock(&osb->osb_lock);
679 /* Enable quota accounting after remounting RW */
680 if (!ret && !(*flags & MS_RDONLY)) {
681 if (sb_any_quota_suspended(sb))
682 ret = ocfs2_susp_quotas(osb, 1);
684 ret = ocfs2_enable_quotas(osb);
686 /* Return back changes... */
687 spin_lock(&osb->osb_lock);
688 sb->s_flags |= MS_RDONLY;
689 osb->osb_flags |= OCFS2_OSB_SOFT_RO;
690 spin_unlock(&osb->osb_lock);
697 /* Only save off the new mount options in case of a successful
699 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
700 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
701 osb->s_mount_opt = parsed_options.mount_opt;
702 osb->s_atime_quantum = parsed_options.atime_quantum;
703 osb->preferred_slot = parsed_options.slot;
704 if (parsed_options.commit_interval)
705 osb->osb_commit_interval = parsed_options.commit_interval;
707 if (!ocfs2_is_hard_readonly(osb))
708 ocfs2_set_journal_params(osb);
714 static int ocfs2_sb_probe(struct super_block *sb,
715 struct buffer_head **bh,
717 struct ocfs2_blockcheck_stats *stats)
720 struct ocfs1_vol_disk_hdr *hdr;
721 struct ocfs2_dinode *di;
727 *sector_size = bdev_hardsect_size(sb->s_bdev);
728 if (*sector_size > OCFS2_MAX_BLOCKSIZE) {
729 mlog(ML_ERROR, "Hardware sector size too large: %d (max=%d)\n",
730 *sector_size, OCFS2_MAX_BLOCKSIZE);
735 /* Can this really happen? */
736 if (*sector_size < OCFS2_MIN_BLOCKSIZE)
737 *sector_size = OCFS2_MIN_BLOCKSIZE;
739 /* check block zero for old format */
740 status = ocfs2_get_sector(sb, bh, 0, *sector_size);
745 hdr = (struct ocfs1_vol_disk_hdr *) (*bh)->b_data;
746 if (hdr->major_version == OCFS1_MAJOR_VERSION) {
747 mlog(ML_ERROR, "incompatible version: %u.%u\n",
748 hdr->major_version, hdr->minor_version);
751 if (memcmp(hdr->signature, OCFS1_VOLUME_SIGNATURE,
752 strlen(OCFS1_VOLUME_SIGNATURE)) == 0) {
753 mlog(ML_ERROR, "incompatible volume signature: %8s\n",
760 mlog(ML_ERROR, "This is an ocfs v1 filesystem which must be "
761 "upgraded before mounting with ocfs v2\n");
766 * Now check at magic offset for 512, 1024, 2048, 4096
767 * blocksizes. 4096 is the maximum blocksize because it is
768 * the minimum clustersize.
771 for (blksize = *sector_size;
772 blksize <= OCFS2_MAX_BLOCKSIZE;
774 tmpstat = ocfs2_get_sector(sb, bh,
775 OCFS2_SUPER_BLOCK_BLKNO,
782 di = (struct ocfs2_dinode *) (*bh)->b_data;
783 memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats));
784 status = ocfs2_verify_volume(di, *bh, blksize, stats);
789 if (status != -EAGAIN)
797 static int ocfs2_verify_heartbeat(struct ocfs2_super *osb)
799 if (ocfs2_mount_local(osb)) {
800 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
801 mlog(ML_ERROR, "Cannot heartbeat on a locally "
802 "mounted device.\n");
807 if (ocfs2_userspace_stack(osb)) {
808 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
809 mlog(ML_ERROR, "Userspace stack expected, but "
810 "o2cb heartbeat arguments passed to mount\n");
815 if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
816 if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb) &&
817 !ocfs2_userspace_stack(osb)) {
818 mlog(ML_ERROR, "Heartbeat has to be started to mount "
819 "a read-write clustered device.\n");
828 * If we're using a userspace stack, mount should have passed
829 * a name that matches the disk. If not, mount should not
830 * have passed a stack.
832 static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb,
833 struct mount_options *mopt)
835 if (!ocfs2_userspace_stack(osb) && mopt->cluster_stack[0]) {
837 "cluster stack passed to mount, but this filesystem "
838 "does not support it\n");
842 if (ocfs2_userspace_stack(osb) &&
843 strncmp(osb->osb_cluster_stack, mopt->cluster_stack,
844 OCFS2_STACK_LABEL_LEN)) {
846 "cluster stack passed to mount (\"%s\") does not "
847 "match the filesystem (\"%s\")\n",
849 osb->osb_cluster_stack);
856 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
859 struct super_block *sb = osb->sb;
860 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
861 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
864 for (type = 0; type < MAXQUOTAS; type++) {
865 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
868 status = vfs_quota_enable(
869 sb_dqopt(sb)->files[type],
873 status = vfs_quota_disable(sb, type,
879 mlog(ML_ERROR, "Failed to suspend/unsuspend quotas on "
880 "remount (error = %d).\n", status);
884 static int ocfs2_enable_quotas(struct ocfs2_super *osb)
886 struct inode *inode[MAXQUOTAS] = { NULL, NULL };
887 struct super_block *sb = osb->sb;
888 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
889 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
890 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
891 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
895 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE;
896 for (type = 0; type < MAXQUOTAS; type++) {
897 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
899 inode[type] = ocfs2_get_system_file_inode(osb, ino[type],
905 status = vfs_quota_enable(inode[type], type, QFMT_OCFS2,
906 DQUOT_USAGE_ENABLED);
911 for (type = 0; type < MAXQUOTAS; type++)
915 ocfs2_disable_quotas(osb);
916 for (type = 0; type < MAXQUOTAS; type++)
922 static void ocfs2_disable_quotas(struct ocfs2_super *osb)
926 struct super_block *sb = osb->sb;
928 /* We mostly ignore errors in this function because there's not much
929 * we can do when we see them */
930 for (type = 0; type < MAXQUOTAS; type++) {
931 if (!sb_has_quota_loaded(sb, type))
933 inode = igrab(sb->s_dquot.files[type]);
934 /* Turn off quotas. This will remove all dquot structures from
935 * memory and so they will be automatically synced to global
937 vfs_quota_disable(sb, type, DQUOT_USAGE_ENABLED |
938 DQUOT_LIMITS_ENABLED);
945 /* Handle quota on quotactl */
946 static int ocfs2_quota_on(struct super_block *sb, int type, int format_id,
947 char *path, int remount)
949 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
950 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
952 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
956 return 0; /* Just ignore it has been handled in
958 return vfs_quota_enable(sb_dqopt(sb)->files[type], type,
959 format_id, DQUOT_LIMITS_ENABLED);
962 /* Handle quota off quotactl */
963 static int ocfs2_quota_off(struct super_block *sb, int type, int remount)
966 return 0; /* Ignore now and handle later in
968 return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED);
971 static struct quotactl_ops ocfs2_quotactl_ops = {
972 .quota_on = ocfs2_quota_on,
973 .quota_off = ocfs2_quota_off,
974 .quota_sync = vfs_quota_sync,
975 .get_info = vfs_get_dqinfo,
976 .set_info = vfs_set_dqinfo,
977 .get_dqblk = vfs_get_dqblk,
978 .set_dqblk = vfs_set_dqblk,
981 static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
984 int status, sector_size;
985 struct mount_options parsed_options;
986 struct inode *inode = NULL;
987 struct ocfs2_super *osb = NULL;
988 struct buffer_head *bh = NULL;
990 struct ocfs2_blockcheck_stats stats;
992 mlog_entry("%p, %p, %i", sb, data, silent);
994 if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) {
996 goto read_super_error;
999 /* probe for superblock */
1000 status = ocfs2_sb_probe(sb, &bh, §or_size, &stats);
1002 mlog(ML_ERROR, "superblock probe failed!\n");
1003 goto read_super_error;
1006 status = ocfs2_initialize_super(sb, bh, sector_size, &stats);
1010 goto read_super_error;
1015 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
1016 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
1018 osb->s_mount_opt = parsed_options.mount_opt;
1019 osb->s_atime_quantum = parsed_options.atime_quantum;
1020 osb->preferred_slot = parsed_options.slot;
1021 osb->osb_commit_interval = parsed_options.commit_interval;
1022 osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt);
1023 osb->local_alloc_bits = osb->local_alloc_default_bits;
1024 if (osb->s_mount_opt & OCFS2_MOUNT_USRQUOTA &&
1025 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1026 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1028 mlog(ML_ERROR, "User quotas were requested, but this "
1029 "filesystem does not have the feature enabled.\n");
1030 goto read_super_error;
1032 if (osb->s_mount_opt & OCFS2_MOUNT_GRPQUOTA &&
1033 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1034 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1036 mlog(ML_ERROR, "Group quotas were requested, but this "
1037 "filesystem does not have the feature enabled.\n");
1038 goto read_super_error;
1041 status = ocfs2_verify_userspace_stack(osb, &parsed_options);
1043 goto read_super_error;
1045 sb->s_magic = OCFS2_SUPER_MAGIC;
1047 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
1048 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
1050 /* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
1052 if (bdev_read_only(sb->s_bdev)) {
1053 if (!(sb->s_flags & MS_RDONLY)) {
1055 mlog(ML_ERROR, "Readonly device detected but readonly "
1056 "mount was not specified.\n");
1057 goto read_super_error;
1060 /* You should not be able to start a local heartbeat
1061 * on a readonly device. */
1062 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
1064 mlog(ML_ERROR, "Local heartbeat specified on readonly "
1066 goto read_super_error;
1069 status = ocfs2_check_journals_nolocks(osb);
1071 if (status == -EROFS)
1072 mlog(ML_ERROR, "Recovery required on readonly "
1073 "file system, but write access is "
1077 goto read_super_error;
1080 ocfs2_set_ro_flag(osb, 1);
1082 printk(KERN_NOTICE "Readonly device detected. No cluster "
1083 "services will be utilized for this mount. Recovery "
1084 "will be skipped.\n");
1087 if (!ocfs2_is_hard_readonly(osb)) {
1088 if (sb->s_flags & MS_RDONLY)
1089 ocfs2_set_ro_flag(osb, 0);
1092 status = ocfs2_verify_heartbeat(osb);
1095 goto read_super_error;
1098 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str,
1099 ocfs2_debugfs_root);
1100 if (!osb->osb_debug_root) {
1102 mlog(ML_ERROR, "Unable to create per-mount debugfs root.\n");
1103 goto read_super_error;
1106 osb->osb_ctxt = debugfs_create_file("fs_state", S_IFREG|S_IRUSR,
1107 osb->osb_debug_root,
1109 &ocfs2_osb_debug_fops);
1110 if (!osb->osb_ctxt) {
1113 goto read_super_error;
1116 if (ocfs2_meta_ecc(osb)) {
1117 status = ocfs2_blockcheck_stats_debugfs_install(
1118 &osb->osb_ecc_stats,
1119 osb->osb_debug_root);
1122 "Unable to create blockcheck statistics "
1124 goto read_super_error;
1128 status = ocfs2_mount_volume(sb);
1129 if (osb->root_inode)
1130 inode = igrab(osb->root_inode);
1133 goto read_super_error;
1138 goto read_super_error;
1141 root = d_alloc_root(inode);
1145 goto read_super_error;
1150 ocfs2_complete_mount_recovery(osb);
1152 if (ocfs2_mount_local(osb))
1153 snprintf(nodestr, sizeof(nodestr), "local");
1155 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num);
1157 printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %s, slot %d) "
1158 "with %s data mode.\n",
1159 osb->dev_str, nodestr, osb->slot_num,
1160 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" :
1163 atomic_set(&osb->vol_state, VOLUME_MOUNTED);
1164 wake_up(&osb->osb_mount_event);
1166 /* Now we can initialize quotas because we can afford to wait
1167 * for cluster locks recovery now. That also means that truncation
1168 * log recovery can happen but that waits for proper quota setup */
1169 if (!(sb->s_flags & MS_RDONLY)) {
1170 status = ocfs2_enable_quotas(osb);
1172 /* We have to err-out specially here because
1173 * s_root is already set */
1175 atomic_set(&osb->vol_state, VOLUME_DISABLED);
1176 wake_up(&osb->osb_mount_event);
1182 ocfs2_complete_quota_recovery(osb);
1184 /* Now we wake up again for processes waiting for quotas */
1185 atomic_set(&osb->vol_state, VOLUME_MOUNTED_QUOTAS);
1186 wake_up(&osb->osb_mount_event);
1198 atomic_set(&osb->vol_state, VOLUME_DISABLED);
1199 wake_up(&osb->osb_mount_event);
1200 ocfs2_dismount_volume(sb, 1);
1207 static int ocfs2_get_sb(struct file_system_type *fs_type,
1209 const char *dev_name,
1211 struct vfsmount *mnt)
1213 return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super,
1217 static struct file_system_type ocfs2_fs_type = {
1218 .owner = THIS_MODULE,
1220 .get_sb = ocfs2_get_sb, /* is this called when we mount
1222 .kill_sb = kill_block_super, /* set to the generic one
1223 * right now, but do we
1224 * need to change that? */
1225 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
1229 static int ocfs2_parse_options(struct super_block *sb,
1231 struct mount_options *mopt,
1237 mlog_entry("remount: %d, options: \"%s\"\n", is_remount,
1238 options ? options : "(none)");
1240 mopt->commit_interval = 0;
1241 mopt->mount_opt = 0;
1242 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
1243 mopt->slot = OCFS2_INVALID_SLOT;
1244 mopt->localalloc_opt = OCFS2_DEFAULT_LOCAL_ALLOC_SIZE;
1245 mopt->cluster_stack[0] = '\0';
1252 while ((p = strsep(&options, ",")) != NULL) {
1254 substring_t args[MAX_OPT_ARGS];
1259 token = match_token(p, tokens, args);
1262 mopt->mount_opt |= OCFS2_MOUNT_HB_LOCAL;
1265 mopt->mount_opt &= ~OCFS2_MOUNT_HB_LOCAL;
1268 if (match_int(&args[0], &option)) {
1273 mopt->mount_opt |= OCFS2_MOUNT_BARRIER;
1275 mopt->mount_opt &= ~OCFS2_MOUNT_BARRIER;
1278 mopt->mount_opt &= ~OCFS2_MOUNT_NOINTR;
1281 mopt->mount_opt |= OCFS2_MOUNT_NOINTR;
1284 mopt->mount_opt |= OCFS2_MOUNT_ERRORS_PANIC;
1287 mopt->mount_opt &= ~OCFS2_MOUNT_ERRORS_PANIC;
1289 case Opt_data_ordered:
1290 mopt->mount_opt &= ~OCFS2_MOUNT_DATA_WRITEBACK;
1292 case Opt_data_writeback:
1293 mopt->mount_opt |= OCFS2_MOUNT_DATA_WRITEBACK;
1295 case Opt_user_xattr:
1296 mopt->mount_opt &= ~OCFS2_MOUNT_NOUSERXATTR;
1298 case Opt_nouser_xattr:
1299 mopt->mount_opt |= OCFS2_MOUNT_NOUSERXATTR;
1301 case Opt_atime_quantum:
1302 if (match_int(&args[0], &option)) {
1307 mopt->atime_quantum = option;
1311 if (match_int(&args[0], &option)) {
1316 mopt->slot = (s16)option;
1320 if (match_int(&args[0], &option)) {
1327 option = JBD2_DEFAULT_MAX_COMMIT_AGE;
1328 mopt->commit_interval = HZ * option;
1330 case Opt_localalloc:
1332 if (match_int(&args[0], &option)) {
1336 if (option >= 0 && (option <= ocfs2_local_alloc_size(sb) * 8))
1337 mopt->localalloc_opt = option;
1339 case Opt_localflocks:
1341 * Changing this during remount could race
1342 * flock() requests, or "unbalance" existing
1343 * ones (e.g., a lock is taken in one mode but
1344 * dropped in the other). If users care enough
1345 * to flip locking modes during remount, we
1346 * could add a "local" flag to individual
1347 * flock structures for proper tracking of
1351 mopt->mount_opt |= OCFS2_MOUNT_LOCALFLOCKS;
1354 /* Check both that the option we were passed
1355 * is of the right length and that it is a proper
1356 * string of the right length.
1358 if (((args[0].to - args[0].from) !=
1359 OCFS2_STACK_LABEL_LEN) ||
1360 (strnlen(args[0].from,
1361 OCFS2_STACK_LABEL_LEN) !=
1362 OCFS2_STACK_LABEL_LEN)) {
1364 "Invalid cluster_stack option\n");
1368 memcpy(mopt->cluster_stack, args[0].from,
1369 OCFS2_STACK_LABEL_LEN);
1370 mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
1373 mopt->mount_opt |= OCFS2_MOUNT_INODE64;
1376 /* We check only on remount, otherwise features
1377 * aren't yet initialized. */
1378 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1379 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1380 mlog(ML_ERROR, "User quota requested but "
1381 "filesystem feature is not set\n");
1385 mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA;
1388 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1389 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1390 mlog(ML_ERROR, "Group quota requested but "
1391 "filesystem feature is not set\n");
1395 mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA;
1397 #ifdef CONFIG_OCFS2_FS_POSIX_ACL
1399 mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL;
1402 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
1407 printk(KERN_INFO "ocfs2 (no)acl options not supported\n");
1412 "Unrecognized mount option \"%s\" "
1413 "or missing value\n", p);
1426 static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1428 struct ocfs2_super *osb = OCFS2_SB(mnt->mnt_sb);
1429 unsigned long opts = osb->s_mount_opt;
1430 unsigned int local_alloc_megs;
1432 if (opts & OCFS2_MOUNT_HB_LOCAL)
1433 seq_printf(s, ",_netdev,heartbeat=local");
1435 seq_printf(s, ",heartbeat=none");
1437 if (opts & OCFS2_MOUNT_NOINTR)
1438 seq_printf(s, ",nointr");
1440 if (opts & OCFS2_MOUNT_DATA_WRITEBACK)
1441 seq_printf(s, ",data=writeback");
1443 seq_printf(s, ",data=ordered");
1445 if (opts & OCFS2_MOUNT_BARRIER)
1446 seq_printf(s, ",barrier=1");
1448 if (opts & OCFS2_MOUNT_ERRORS_PANIC)
1449 seq_printf(s, ",errors=panic");
1451 seq_printf(s, ",errors=remount-ro");
1453 if (osb->preferred_slot != OCFS2_INVALID_SLOT)
1454 seq_printf(s, ",preferred_slot=%d", osb->preferred_slot);
1456 if (osb->s_atime_quantum != OCFS2_DEFAULT_ATIME_QUANTUM)
1457 seq_printf(s, ",atime_quantum=%u", osb->s_atime_quantum);
1459 if (osb->osb_commit_interval)
1460 seq_printf(s, ",commit=%u",
1461 (unsigned) (osb->osb_commit_interval / HZ));
1463 local_alloc_megs = osb->local_alloc_bits >> (20 - osb->s_clustersize_bits);
1464 if (local_alloc_megs != OCFS2_DEFAULT_LOCAL_ALLOC_SIZE)
1465 seq_printf(s, ",localalloc=%d", local_alloc_megs);
1467 if (opts & OCFS2_MOUNT_LOCALFLOCKS)
1468 seq_printf(s, ",localflocks,");
1470 if (osb->osb_cluster_stack[0])
1471 seq_printf(s, ",cluster_stack=%.*s", OCFS2_STACK_LABEL_LEN,
1472 osb->osb_cluster_stack);
1473 if (opts & OCFS2_MOUNT_USRQUOTA)
1474 seq_printf(s, ",usrquota");
1475 if (opts & OCFS2_MOUNT_GRPQUOTA)
1476 seq_printf(s, ",grpquota");
1478 if (opts & OCFS2_MOUNT_NOUSERXATTR)
1479 seq_printf(s, ",nouser_xattr");
1481 seq_printf(s, ",user_xattr");
1483 if (opts & OCFS2_MOUNT_INODE64)
1484 seq_printf(s, ",inode64");
1486 #ifdef CONFIG_OCFS2_FS_POSIX_ACL
1487 if (opts & OCFS2_MOUNT_POSIX_ACL)
1488 seq_printf(s, ",acl");
1490 seq_printf(s, ",noacl");
1496 static int __init ocfs2_init(void)
1502 ocfs2_print_version();
1504 status = init_ocfs2_uptodate_cache();
1510 status = ocfs2_initialize_mem_caches();
1516 ocfs2_wq = create_singlethread_workqueue("ocfs2_wq");
1522 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
1523 if (!ocfs2_debugfs_root) {
1525 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
1528 status = ocfs2_quota_setup();
1532 ocfs2_set_locking_protocol();
1534 status = register_quota_format(&ocfs2_quota_format);
1537 ocfs2_quota_shutdown();
1538 ocfs2_free_mem_caches();
1539 exit_ocfs2_uptodate_cache();
1545 return register_filesystem(&ocfs2_fs_type);
1550 static void __exit ocfs2_exit(void)
1554 ocfs2_quota_shutdown();
1557 flush_workqueue(ocfs2_wq);
1558 destroy_workqueue(ocfs2_wq);
1561 unregister_quota_format(&ocfs2_quota_format);
1563 debugfs_remove(ocfs2_debugfs_root);
1565 ocfs2_free_mem_caches();
1567 unregister_filesystem(&ocfs2_fs_type);
1569 exit_ocfs2_uptodate_cache();
1574 static void ocfs2_put_super(struct super_block *sb)
1576 mlog_entry("(0x%p)\n", sb);
1578 ocfs2_sync_blockdev(sb);
1579 ocfs2_dismount_volume(sb, 0);
1584 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
1586 struct ocfs2_super *osb;
1587 u32 numbits, freebits;
1589 struct ocfs2_dinode *bm_lock;
1590 struct buffer_head *bh = NULL;
1591 struct inode *inode = NULL;
1593 mlog_entry("(%p, %p)\n", dentry->d_sb, buf);
1595 osb = OCFS2_SB(dentry->d_sb);
1597 inode = ocfs2_get_system_file_inode(osb,
1598 GLOBAL_BITMAP_SYSTEM_INODE,
1599 OCFS2_INVALID_SLOT);
1601 mlog(ML_ERROR, "failed to get bitmap inode\n");
1606 status = ocfs2_inode_lock(inode, &bh, 0);
1612 bm_lock = (struct ocfs2_dinode *) bh->b_data;
1614 numbits = le32_to_cpu(bm_lock->id1.bitmap1.i_total);
1615 freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used);
1617 buf->f_type = OCFS2_SUPER_MAGIC;
1618 buf->f_bsize = dentry->d_sb->s_blocksize;
1619 buf->f_namelen = OCFS2_MAX_FILENAME_LEN;
1620 buf->f_blocks = ((sector_t) numbits) *
1621 (osb->s_clustersize >> osb->sb->s_blocksize_bits);
1622 buf->f_bfree = ((sector_t) freebits) *
1623 (osb->s_clustersize >> osb->sb->s_blocksize_bits);
1624 buf->f_bavail = buf->f_bfree;
1625 buf->f_files = numbits;
1626 buf->f_ffree = freebits;
1630 ocfs2_inode_unlock(inode, 0);
1641 static void ocfs2_inode_init_once(void *data)
1643 struct ocfs2_inode_info *oi = data;
1646 oi->ip_open_count = 0;
1647 spin_lock_init(&oi->ip_lock);
1648 ocfs2_extent_map_init(&oi->vfs_inode);
1649 INIT_LIST_HEAD(&oi->ip_io_markers);
1650 oi->ip_created_trans = 0;
1651 oi->ip_last_trans = 0;
1652 oi->ip_dir_start_lookup = 0;
1654 init_rwsem(&oi->ip_alloc_sem);
1655 init_rwsem(&oi->ip_xattr_sem);
1656 mutex_init(&oi->ip_io_mutex);
1658 oi->ip_blkno = 0ULL;
1659 oi->ip_clusters = 0;
1661 ocfs2_lock_res_init_once(&oi->ip_rw_lockres);
1662 ocfs2_lock_res_init_once(&oi->ip_inode_lockres);
1663 ocfs2_lock_res_init_once(&oi->ip_open_lockres);
1665 ocfs2_metadata_cache_init(&oi->vfs_inode);
1667 inode_init_once(&oi->vfs_inode);
1670 static int ocfs2_initialize_mem_caches(void)
1672 ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache",
1673 sizeof(struct ocfs2_inode_info),
1675 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
1677 ocfs2_inode_init_once);
1678 ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache",
1679 sizeof(struct ocfs2_dquot),
1681 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
1684 ocfs2_qf_chunk_cachep = kmem_cache_create("ocfs2_qf_chunk_cache",
1685 sizeof(struct ocfs2_quota_chunk),
1687 (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD),
1689 if (!ocfs2_inode_cachep || !ocfs2_dquot_cachep ||
1690 !ocfs2_qf_chunk_cachep) {
1691 if (ocfs2_inode_cachep)
1692 kmem_cache_destroy(ocfs2_inode_cachep);
1693 if (ocfs2_dquot_cachep)
1694 kmem_cache_destroy(ocfs2_dquot_cachep);
1695 if (ocfs2_qf_chunk_cachep)
1696 kmem_cache_destroy(ocfs2_qf_chunk_cachep);
1703 static void ocfs2_free_mem_caches(void)
1705 if (ocfs2_inode_cachep)
1706 kmem_cache_destroy(ocfs2_inode_cachep);
1707 ocfs2_inode_cachep = NULL;
1709 if (ocfs2_dquot_cachep)
1710 kmem_cache_destroy(ocfs2_dquot_cachep);
1711 ocfs2_dquot_cachep = NULL;
1713 if (ocfs2_qf_chunk_cachep)
1714 kmem_cache_destroy(ocfs2_qf_chunk_cachep);
1715 ocfs2_qf_chunk_cachep = NULL;
1718 static int ocfs2_get_sector(struct super_block *sb,
1719 struct buffer_head **bh,
1723 if (!sb_set_blocksize(sb, sect_size)) {
1724 mlog(ML_ERROR, "unable to set blocksize\n");
1728 *bh = sb_getblk(sb, block);
1734 if (!buffer_dirty(*bh))
1735 clear_buffer_uptodate(*bh);
1737 ll_rw_block(READ, 1, bh);
1738 wait_on_buffer(*bh);
1739 if (!buffer_uptodate(*bh)) {
1749 static int ocfs2_mount_volume(struct super_block *sb)
1752 int unlock_super = 0;
1753 struct ocfs2_super *osb = OCFS2_SB(sb);
1757 if (ocfs2_is_hard_readonly(osb))
1760 status = ocfs2_dlm_init(osb);
1766 status = ocfs2_super_lock(osb, 1);
1773 /* This will load up the node map and add ourselves to it. */
1774 status = ocfs2_find_slot(osb);
1780 /* load all node-local system inodes */
1781 status = ocfs2_init_local_system_inodes(osb);
1787 status = ocfs2_check_volume(osb);
1793 status = ocfs2_truncate_log_init(osb);
1799 if (ocfs2_mount_local(osb))
1804 ocfs2_super_unlock(osb, 1);
1810 static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
1812 int tmp, hangup_needed = 0;
1813 struct ocfs2_super *osb = NULL;
1816 mlog_entry("(0x%p)\n", sb);
1822 debugfs_remove(osb->osb_ctxt);
1824 ocfs2_disable_quotas(osb);
1826 ocfs2_shutdown_local_alloc(osb);
1828 ocfs2_truncate_log_shutdown(osb);
1830 ocfs2_orphan_scan_stop(osb);
1832 /* This will disable recovery and flush any recovery work. */
1833 ocfs2_recovery_exit(osb);
1835 ocfs2_journal_shutdown(osb);
1837 ocfs2_sync_blockdev(sb);
1839 /* No cluster connection means we've failed during mount, so skip
1840 * all the steps which depended on that to complete. */
1842 tmp = ocfs2_super_lock(osb, 1);
1849 if (osb->slot_num != OCFS2_INVALID_SLOT)
1850 ocfs2_put_slot(osb);
1853 ocfs2_super_unlock(osb, 1);
1855 ocfs2_release_system_inodes(osb);
1858 * If we're dismounting due to mount error, mount.ocfs2 will clean
1859 * up heartbeat. If we're a local mount, there is no heartbeat.
1860 * If we failed before we got a uuid_str yet, we can't stop
1861 * heartbeat. Otherwise, do it.
1863 if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str)
1867 ocfs2_dlm_shutdown(osb, hangup_needed);
1869 ocfs2_blockcheck_stats_debugfs_remove(&osb->osb_ecc_stats);
1870 debugfs_remove(osb->osb_debug_root);
1873 ocfs2_cluster_hangup(osb->uuid_str, strlen(osb->uuid_str));
1875 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);
1877 if (ocfs2_mount_local(osb))
1878 snprintf(nodestr, sizeof(nodestr), "local");
1880 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num);
1882 printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %s)\n",
1883 osb->dev_str, nodestr);
1885 ocfs2_delete_osb(osb);
1888 sb->s_fs_info = NULL;
1891 static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uuid,
1892 unsigned uuid_bytes)
1897 BUG_ON(uuid_bytes != OCFS2_VOL_UUID_LEN);
1899 osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL);
1900 if (osb->uuid_str == NULL)
1903 for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) {
1904 /* print with null */
1905 ret = snprintf(ptr, 3, "%02X", uuid[i]);
1906 if (ret != 2) /* drop super cleans up */
1908 /* then only advance past the last char */
1915 static int ocfs2_initialize_super(struct super_block *sb,
1916 struct buffer_head *bh,
1918 struct ocfs2_blockcheck_stats *stats)
1921 int i, cbits, bbits;
1922 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
1923 struct inode *inode = NULL;
1924 struct ocfs2_journal *journal;
1925 __le32 uuid_net_key;
1926 struct ocfs2_super *osb;
1930 osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL);
1937 sb->s_fs_info = osb;
1938 sb->s_op = &ocfs2_sops;
1939 sb->s_export_op = &ocfs2_export_ops;
1940 sb->s_qcop = &ocfs2_quotactl_ops;
1941 sb->dq_op = &ocfs2_quota_operations;
1942 sb->s_xattr = ocfs2_xattr_handlers;
1943 sb->s_time_gran = 1;
1944 sb->s_flags |= MS_NOATIME;
1945 /* this is needed to support O_LARGEFILE */
1946 cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
1947 bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
1948 sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
1950 osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
1952 for (i = 0; i < 3; i++)
1953 osb->osb_dx_seed[i] = le32_to_cpu(di->id2.i_super.s_dx_seed[i]);
1954 osb->osb_dx_seed[3] = le32_to_cpu(di->id2.i_super.s_uuid_hash);
1957 /* Save off for ocfs2_rw_direct */
1958 osb->s_sectsize_bits = blksize_bits(sector_size);
1959 BUG_ON(!osb->s_sectsize_bits);
1961 spin_lock_init(&osb->dc_task_lock);
1962 init_waitqueue_head(&osb->dc_event);
1963 osb->dc_work_sequence = 0;
1964 osb->dc_wake_sequence = 0;
1965 INIT_LIST_HEAD(&osb->blocked_lock_list);
1966 osb->blocked_lock_count = 0;
1967 spin_lock_init(&osb->osb_lock);
1968 spin_lock_init(&osb->osb_xattr_lock);
1969 ocfs2_init_inode_steal_slot(osb);
1971 atomic_set(&osb->alloc_stats.moves, 0);
1972 atomic_set(&osb->alloc_stats.local_data, 0);
1973 atomic_set(&osb->alloc_stats.bitmap_data, 0);
1974 atomic_set(&osb->alloc_stats.bg_allocs, 0);
1975 atomic_set(&osb->alloc_stats.bg_extends, 0);
1977 /* Copy the blockcheck stats from the superblock probe */
1978 osb->osb_ecc_stats = *stats;
1980 ocfs2_init_node_maps(osb);
1982 snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
1983 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
1985 status = ocfs2_recovery_init(osb);
1987 mlog(ML_ERROR, "Unable to initialize recovery state\n");
1992 status = ocfs2_orphan_scan_init(osb);
1994 mlog(ML_ERROR, "Unable to initialize delayed orphan scan\n");
1999 init_waitqueue_head(&osb->checkpoint_event);
2000 atomic_set(&osb->needs_checkpoint, 0);
2002 osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
2004 osb->slot_num = OCFS2_INVALID_SLOT;
2006 osb->s_xattr_inline_size = le16_to_cpu(
2007 di->id2.i_super.s_xattr_inline_size);
2009 osb->local_alloc_state = OCFS2_LA_UNUSED;
2010 osb->local_alloc_bh = NULL;
2011 INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker);
2013 init_waitqueue_head(&osb->osb_mount_event);
2015 osb->vol_label = kmalloc(OCFS2_MAX_VOL_LABEL_LEN, GFP_KERNEL);
2016 if (!osb->vol_label) {
2017 mlog(ML_ERROR, "unable to alloc vol label\n");
2022 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
2023 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
2024 mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
2029 mlog(0, "max_slots for this device: %u\n", osb->max_slots);
2031 osb->slot_recovery_generations =
2032 kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
2034 if (!osb->slot_recovery_generations) {
2040 init_waitqueue_head(&osb->osb_wipe_event);
2041 osb->osb_orphan_wipes = kcalloc(osb->max_slots,
2042 sizeof(*osb->osb_orphan_wipes),
2044 if (!osb->osb_orphan_wipes) {
2050 osb->s_feature_compat =
2051 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat);
2052 osb->s_feature_ro_compat =
2053 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_ro_compat);
2054 osb->s_feature_incompat =
2055 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_incompat);
2057 if ((i = OCFS2_HAS_INCOMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_INCOMPAT_SUPP))) {
2058 mlog(ML_ERROR, "couldn't mount because of unsupported "
2059 "optional features (%x).\n", i);
2063 if (!(osb->sb->s_flags & MS_RDONLY) &&
2064 (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) {
2065 mlog(ML_ERROR, "couldn't mount RDWR because of "
2066 "unsupported optional features (%x).\n", i);
2071 if (ocfs2_userspace_stack(osb)) {
2072 memcpy(osb->osb_cluster_stack,
2073 OCFS2_RAW_SB(di)->s_cluster_info.ci_stack,
2074 OCFS2_STACK_LABEL_LEN);
2075 osb->osb_cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
2076 if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) {
2078 "couldn't mount because of an invalid "
2079 "cluster stack label (%s) \n",
2080 osb->osb_cluster_stack);
2085 /* The empty string is identical with classic tools that
2086 * don't know about s_cluster_info. */
2087 osb->osb_cluster_stack[0] = '\0';
2090 get_random_bytes(&osb->s_next_generation, sizeof(u32));
2093 * This should be done in ocfs2_journal_init(), but unknown
2094 * ordering issues will cause the filesystem to crash.
2095 * If anyone wants to figure out what part of the code
2096 * refers to osb->journal before ocfs2_journal_init() is run,
2099 /* initialize our journal structure */
2101 journal = kzalloc(sizeof(struct ocfs2_journal), GFP_KERNEL);
2103 mlog(ML_ERROR, "unable to alloc journal\n");
2107 osb->journal = journal;
2108 journal->j_osb = osb;
2110 atomic_set(&journal->j_num_trans, 0);
2111 init_rwsem(&journal->j_trans_barrier);
2112 init_waitqueue_head(&journal->j_checkpointed);
2113 spin_lock_init(&journal->j_lock);
2114 journal->j_trans_id = (unsigned long) 1;
2115 INIT_LIST_HEAD(&journal->j_la_cleanups);
2116 INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
2117 journal->j_state = OCFS2_JOURNAL_FREE;
2119 INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes);
2120 osb->dentry_lock_list = NULL;
2122 /* get some pseudo constants for clustersize bits */
2123 osb->s_clustersize_bits =
2124 le32_to_cpu(di->id2.i_super.s_clustersize_bits);
2125 osb->s_clustersize = 1 << osb->s_clustersize_bits;
2126 mlog(0, "clusterbits=%d\n", osb->s_clustersize_bits);
2128 if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE ||
2129 osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) {
2130 mlog(ML_ERROR, "Volume has invalid cluster size (%d)\n",
2131 osb->s_clustersize);
2136 if (ocfs2_clusters_to_blocks(osb->sb, le32_to_cpu(di->i_clusters) - 1)
2138 mlog(ML_ERROR, "Volume might try to write to blocks beyond "
2139 "what jbd can address in 32 bits.\n");
2144 if (ocfs2_setup_osb_uuid(osb, di->id2.i_super.s_uuid,
2145 sizeof(di->id2.i_super.s_uuid))) {
2146 mlog(ML_ERROR, "Out of memory trying to setup our uuid.\n");
2151 memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key));
2153 strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
2154 osb->vol_label[63] = '\0';
2155 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);
2156 osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);
2157 osb->first_cluster_group_blkno =
2158 le64_to_cpu(di->id2.i_super.s_first_cluster_group);
2159 osb->fs_generation = le32_to_cpu(di->i_fs_generation);
2160 osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash);
2161 mlog(0, "vol_label: %s\n", osb->vol_label);
2162 mlog(0, "uuid: %s\n", osb->uuid_str);
2163 mlog(0, "root_blkno=%llu, system_dir_blkno=%llu\n",
2164 (unsigned long long)osb->root_blkno,
2165 (unsigned long long)osb->system_dir_blkno);
2167 osb->osb_dlm_debug = ocfs2_new_dlm_debug();
2168 if (!osb->osb_dlm_debug) {
2174 atomic_set(&osb->vol_state, VOLUME_INIT);
2176 /* load root, system_dir, and all global system inodes */
2177 status = ocfs2_init_global_system_inodes(osb);
2186 inode = ocfs2_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE,
2187 OCFS2_INVALID_SLOT);
2194 osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno;
2197 osb->bitmap_cpg = ocfs2_group_bitmap_size(sb) * 8;
2199 status = ocfs2_init_slot_info(osb);
2211 * will return: -EAGAIN if it is ok to keep searching for superblocks
2212 * -EINVAL if there is a bad superblock
2215 static int ocfs2_verify_volume(struct ocfs2_dinode *di,
2216 struct buffer_head *bh,
2218 struct ocfs2_blockcheck_stats *stats)
2220 int status = -EAGAIN;
2224 if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
2225 strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
2226 /* We have to do a raw check of the feature here */
2227 if (le32_to_cpu(di->id2.i_super.s_feature_incompat) &
2228 OCFS2_FEATURE_INCOMPAT_META_ECC) {
2229 status = ocfs2_block_check_validate(bh->b_data,
2237 if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) {
2238 mlog(ML_ERROR, "found superblock with incorrect block "
2239 "size: found %u, should be %u\n",
2240 1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits),
2242 } else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
2243 OCFS2_MAJOR_REV_LEVEL ||
2244 le16_to_cpu(di->id2.i_super.s_minor_rev_level) !=
2245 OCFS2_MINOR_REV_LEVEL) {
2246 mlog(ML_ERROR, "found superblock with bad version: "
2247 "found %u.%u, should be %u.%u\n",
2248 le16_to_cpu(di->id2.i_super.s_major_rev_level),
2249 le16_to_cpu(di->id2.i_super.s_minor_rev_level),
2250 OCFS2_MAJOR_REV_LEVEL,
2251 OCFS2_MINOR_REV_LEVEL);
2252 } else if (bh->b_blocknr != le64_to_cpu(di->i_blkno)) {
2253 mlog(ML_ERROR, "bad block number on superblock: "
2254 "found %llu, should be %llu\n",
2255 (unsigned long long)le64_to_cpu(di->i_blkno),
2256 (unsigned long long)bh->b_blocknr);
2257 } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 ||
2258 le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) {
2259 mlog(ML_ERROR, "bad cluster size found: %u\n",
2260 1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits));
2261 } else if (!le64_to_cpu(di->id2.i_super.s_root_blkno)) {
2262 mlog(ML_ERROR, "bad root_blkno: 0\n");
2263 } else if (!le64_to_cpu(di->id2.i_super.s_system_dir_blkno)) {
2264 mlog(ML_ERROR, "bad system_dir_blkno: 0\n");
2265 } else if (le16_to_cpu(di->id2.i_super.s_max_slots) > OCFS2_MAX_SLOTS) {
2267 "Superblock slots found greater than file system "
2268 "maximum: found %u, max %u\n",
2269 le16_to_cpu(di->id2.i_super.s_max_slots),
2282 static int ocfs2_check_volume(struct ocfs2_super *osb)
2287 struct ocfs2_dinode *local_alloc = NULL; /* only used if we
2293 /* Init our journal object. */
2294 status = ocfs2_journal_init(osb->journal, &dirty);
2296 mlog(ML_ERROR, "Could not initialize journal!\n");
2300 /* If the journal was unmounted cleanly then we don't want to
2301 * recover anything. Otherwise, journal_load will do that
2302 * dirty work for us :) */
2304 status = ocfs2_journal_wipe(osb->journal, 0);
2310 mlog(ML_NOTICE, "File system was not unmounted cleanly, "
2311 "recovering volume.\n");
2314 local = ocfs2_mount_local(osb);
2316 /* will play back anything left in the journal. */
2317 status = ocfs2_journal_load(osb->journal, local, dirty);
2319 mlog(ML_ERROR, "ocfs2 journal load failed! %d\n", status);
2324 /* recover my local alloc if we didn't unmount cleanly. */
2325 status = ocfs2_begin_local_alloc_recovery(osb,
2332 /* we complete the recovery process after we've marked
2333 * ourselves as mounted. */
2336 mlog(0, "Journal loaded.\n");
2338 status = ocfs2_load_local_alloc(osb);
2345 /* Recovery will be completed after we've mounted the
2346 * rest of the volume. */
2348 osb->local_alloc_copy = local_alloc;
2352 /* go through each journal, trylock it and if you get the
2353 * lock, and it's marked as dirty, set the bit in the recover
2354 * map and launch a recovery thread for it. */
2355 status = ocfs2_mark_dead_nodes(osb);
2361 status = ocfs2_compute_replay_slots(osb);
2374 * The routine gets called from dismount or close whenever a dismount on
2375 * volume is requested and the osb open count becomes 1.
2376 * It will remove the osb from the global list and also free up all the
2377 * initialized resources and fileobject.
2379 static void ocfs2_delete_osb(struct ocfs2_super *osb)
2383 /* This function assumes that the caller has the main osb resource */
2385 ocfs2_free_slot_info(osb);
2387 kfree(osb->osb_orphan_wipes);
2388 kfree(osb->slot_recovery_generations);
2390 * This belongs in journal shutdown, but because we have to
2391 * allocate osb->journal at the start of ocfs2_initalize_osb(),
2394 kfree(osb->journal);
2395 if (osb->local_alloc_copy)
2396 kfree(osb->local_alloc_copy);
2397 kfree(osb->uuid_str);
2398 ocfs2_put_dlm_debug(osb->osb_dlm_debug);
2399 memset(osb, 0, sizeof(struct ocfs2_super));
2404 /* Put OCFS2 into a readonly state, or (if the user specifies it),
2405 * panic(). We do not support continue-on-error operation. */
2406 static void ocfs2_handle_error(struct super_block *sb)
2408 struct ocfs2_super *osb = OCFS2_SB(sb);
2410 if (osb->s_mount_opt & OCFS2_MOUNT_ERRORS_PANIC)
2411 panic("OCFS2: (device %s): panic forced after error\n",
2414 ocfs2_set_osb_flag(osb, OCFS2_OSB_ERROR_FS);
2416 if (sb->s_flags & MS_RDONLY &&
2417 (ocfs2_is_soft_readonly(osb) ||
2418 ocfs2_is_hard_readonly(osb)))
2421 printk(KERN_CRIT "File system is now read-only due to the potential "
2422 "of on-disk corruption. Please run fsck.ocfs2 once the file "
2423 "system is unmounted.\n");
2424 sb->s_flags |= MS_RDONLY;
2425 ocfs2_set_ro_flag(osb, 0);
2428 static char error_buf[1024];
2430 void __ocfs2_error(struct super_block *sb,
2431 const char *function,
2432 const char *fmt, ...)
2436 va_start(args, fmt);
2437 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
2440 /* Not using mlog here because we want to show the actual
2441 * function the error came from. */
2442 printk(KERN_CRIT "OCFS2: ERROR (device %s): %s: %s\n",
2443 sb->s_id, function, error_buf);
2445 ocfs2_handle_error(sb);
2448 /* Handle critical errors. This is intentionally more drastic than
2449 * ocfs2_handle_error, so we only use for things like journal errors,
2451 void __ocfs2_abort(struct super_block* sb,
2452 const char *function,
2453 const char *fmt, ...)
2457 va_start(args, fmt);
2458 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
2461 printk(KERN_CRIT "OCFS2: abort (device %s): %s: %s\n",
2462 sb->s_id, function, error_buf);
2464 /* We don't have the cluster support yet to go straight to
2465 * hard readonly in here. Until then, we want to keep
2466 * ocfs2_abort() so that we can at least mark critical
2469 * TODO: This should abort the journal and alert other nodes
2470 * that our slot needs recovery. */
2472 /* Force a panic(). This stinks, but it's better than letting
2473 * things continue without having a proper hard readonly
2475 OCFS2_SB(sb)->s_mount_opt |= OCFS2_MOUNT_ERRORS_PANIC;
2476 ocfs2_handle_error(sb);
2479 module_init(ocfs2_init);
2480 module_exit(ocfs2_exit);