aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/Kconfig12
-rw-r--r--fs/configfs/dir.c6
-rw-r--r--fs/configfs/symlink.c2
-rw-r--r--fs/ocfs2/aops.c9
-rw-r--r--fs/ocfs2/cluster/heartbeat.c20
-rw-r--r--fs/ocfs2/cluster/masklog.h22
-rw-r--r--fs/ocfs2/cluster/ocfs2_heartbeat.h1
-rw-r--r--fs/ocfs2/cluster/tcp.c14
-rw-r--r--fs/ocfs2/dir.c6
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h2
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c9
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c8
-rw-r--r--fs/ocfs2/dlmglue.c3
-rw-r--r--fs/ocfs2/extent_map.c29
-rw-r--r--fs/ocfs2/journal.c5
-rw-r--r--fs/ocfs2/mmap.c4
-rw-r--r--fs/ocfs2/ocfs2.h4
-rw-r--r--fs/ocfs2/slot_map.c2
-rw-r--r--fs/ocfs2/super.c49
-rw-r--r--fs/ocfs2/symlink.c2
20 files changed, 116 insertions, 93 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index 6dc8cfd6d80c..53f5c6d61121 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -326,7 +326,7 @@ source "fs/xfs/Kconfig"
326 326
327config OCFS2_FS 327config OCFS2_FS
328 tristate "OCFS2 file system support (EXPERIMENTAL)" 328 tristate "OCFS2 file system support (EXPERIMENTAL)"
329 depends on NET && EXPERIMENTAL 329 depends on NET && SYSFS && EXPERIMENTAL
330 select CONFIGFS_FS 330 select CONFIGFS_FS
331 select JBD 331 select JBD
332 select CRC32 332 select CRC32
@@ -356,6 +356,16 @@ config OCFS2_FS
356 - POSIX ACLs 356 - POSIX ACLs
357 - readpages / writepages (not user visible) 357 - readpages / writepages (not user visible)
358 358
359config OCFS2_DEBUG_MASKLOG
360 bool "OCFS2 logging support"
361 depends on OCFS2_FS
362 default y
363 help
364 The ocfs2 filesystem has an extensive logging system. The system
365 allows selection of events to log via files in /sys/o2cb/logmask/.
366 This option will enlarge your kernel, but it allows debugging of
367 ocfs2 filesystem issues.
368
359config MINIX_FS 369config MINIX_FS
360 tristate "Minix fs support" 370 tristate "Minix fs support"
361 help 371 help
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 207f8006fd6c..df025453dd97 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -211,7 +211,7 @@ static void remove_dir(struct dentry * d)
211 struct configfs_dirent * sd; 211 struct configfs_dirent * sd;
212 212
213 sd = d->d_fsdata; 213 sd = d->d_fsdata;
214 list_del_init(&sd->s_sibling); 214 list_del_init(&sd->s_sibling);
215 configfs_put(sd); 215 configfs_put(sd);
216 if (d->d_inode) 216 if (d->d_inode)
217 simple_rmdir(parent->d_inode,d); 217 simple_rmdir(parent->d_inode,d);
@@ -330,7 +330,7 @@ static int configfs_detach_prep(struct dentry *dentry)
330 330
331 ret = configfs_detach_prep(sd->s_dentry); 331 ret = configfs_detach_prep(sd->s_dentry);
332 if (!ret) 332 if (!ret)
333 continue; 333 continue;
334 } else 334 } else
335 ret = -ENOTEMPTY; 335 ret = -ENOTEMPTY;
336 336
@@ -931,7 +931,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
931 931
932 new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); 932 new_dentry = lookup_one_len(new_name, parent, strlen(new_name));
933 if (!IS_ERR(new_dentry)) { 933 if (!IS_ERR(new_dentry)) {
934 if (!new_dentry->d_inode) { 934 if (!new_dentry->d_inode) {
935 error = config_item_set_name(item, "%s", new_name); 935 error = config_item_set_name(item, "%s", new_name);
936 if (!error) { 936 if (!error) {
937 d_add(new_dentry, NULL); 937 d_add(new_dentry, NULL);
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index e5512e295cf2..fb65e0800a86 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -66,7 +66,7 @@ static void fill_item_path(struct config_item * item, char * buffer, int length)
66} 66}
67 67
68static int create_link(struct config_item *parent_item, 68static int create_link(struct config_item *parent_item,
69 struct config_item *item, 69 struct config_item *item,
70 struct dentry *dentry) 70 struct dentry *dentry)
71{ 71{
72 struct configfs_dirent *target_sd = item->ci_dentry->d_fsdata; 72 struct configfs_dirent *target_sd = item->ci_dentry->d_fsdata;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index cca71317b6d6..f1d1c342ce01 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -558,16 +558,9 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
558 u64 vbo_max; /* file offset, max_blocks from iblock */ 558 u64 vbo_max; /* file offset, max_blocks from iblock */
559 u64 p_blkno; 559 u64 p_blkno;
560 int contig_blocks; 560 int contig_blocks;
561 unsigned char blocksize_bits; 561 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
562 unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits; 562 unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
563 563
564 if (!inode || !bh_result) {
565 mlog(ML_ERROR, "inode or bh_result is null\n");
566 return -EIO;
567 }
568
569 blocksize_bits = inode->i_sb->s_blocksize_bits;
570
571 /* This function won't even be called if the request isn't all 564 /* This function won't even be called if the request isn't all
572 * nicely aligned and of the right size, so there's no need 565 * nicely aligned and of the right size, so there's no need
573 * for us to check any of that. */ 566 * for us to check any of that. */
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 1d26cfcd9f84..504595d6cf65 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -517,6 +517,7 @@ static inline void o2hb_prepare_block(struct o2hb_region *reg,
517 hb_block->hb_seq = cpu_to_le64(cputime); 517 hb_block->hb_seq = cpu_to_le64(cputime);
518 hb_block->hb_node = node_num; 518 hb_block->hb_node = node_num;
519 hb_block->hb_generation = cpu_to_le64(generation); 519 hb_block->hb_generation = cpu_to_le64(generation);
520 hb_block->hb_dead_ms = cpu_to_le32(o2hb_dead_threshold * O2HB_REGION_TIMEOUT_MS);
520 521
521 /* This step must always happen last! */ 522 /* This step must always happen last! */
522 hb_block->hb_cksum = cpu_to_le32(o2hb_compute_block_crc_le(reg, 523 hb_block->hb_cksum = cpu_to_le32(o2hb_compute_block_crc_le(reg,
@@ -645,6 +646,8 @@ static int o2hb_check_slot(struct o2hb_region *reg,
645 struct o2nm_node *node; 646 struct o2nm_node *node;
646 struct o2hb_disk_heartbeat_block *hb_block = reg->hr_tmp_block; 647 struct o2hb_disk_heartbeat_block *hb_block = reg->hr_tmp_block;
647 u64 cputime; 648 u64 cputime;
649 unsigned int dead_ms = o2hb_dead_threshold * O2HB_REGION_TIMEOUT_MS;
650 unsigned int slot_dead_ms;
648 651
649 memcpy(hb_block, slot->ds_raw_block, reg->hr_block_bytes); 652 memcpy(hb_block, slot->ds_raw_block, reg->hr_block_bytes);
650 653
@@ -733,6 +736,23 @@ fire_callbacks:
733 &o2hb_live_slots[slot->ds_node_num]); 736 &o2hb_live_slots[slot->ds_node_num]);
734 737
735 slot->ds_equal_samples = 0; 738 slot->ds_equal_samples = 0;
739
740 /* We want to be sure that all nodes agree on the
741 * number of milliseconds before a node will be
742 * considered dead. The self-fencing timeout is
743 * computed from this value, and a discrepancy might
744 * result in heartbeat calling a node dead when it
745 * hasn't self-fenced yet. */
746 slot_dead_ms = le32_to_cpu(hb_block->hb_dead_ms);
747 if (slot_dead_ms && slot_dead_ms != dead_ms) {
748 /* TODO: Perhaps we can fail the region here. */
749 mlog(ML_ERROR, "Node %d on device %s has a dead count "
750 "of %u ms, but our count is %u ms.\n"
751 "Please double check your configuration values "
752 "for 'O2CB_HEARTBEAT_THRESHOLD'\n",
753 slot->ds_node_num, reg->hr_dev_name, slot_dead_ms,
754 dead_ms);
755 }
736 goto out; 756 goto out;
737 } 757 }
738 758
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index 73edad782537..a42628ba9ddf 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -123,6 +123,17 @@
123#define MLOG_MASK_PREFIX 0 123#define MLOG_MASK_PREFIX 0
124#endif 124#endif
125 125
126/*
127 * When logging is disabled, force the bit test to 0 for anything other
128 * than errors and notices, allowing gcc to remove the code completely.
129 * When enabled, allow all masks.
130 */
131#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
132#define ML_ALLOWED_BITS ~0
133#else
134#define ML_ALLOWED_BITS (ML_ERROR|ML_NOTICE)
135#endif
136
126#define MLOG_MAX_BITS 64 137#define MLOG_MAX_BITS 64
127 138
128struct mlog_bits { 139struct mlog_bits {
@@ -187,7 +198,8 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
187 198
188#define mlog(mask, fmt, args...) do { \ 199#define mlog(mask, fmt, args...) do { \
189 u64 __m = MLOG_MASK_PREFIX | (mask); \ 200 u64 __m = MLOG_MASK_PREFIX | (mask); \
190 if (__mlog_test_u64(__m, mlog_and_bits) && \ 201 if ((__m & ML_ALLOWED_BITS) && \
202 __mlog_test_u64(__m, mlog_and_bits) && \
191 !__mlog_test_u64(__m, mlog_not_bits)) { \ 203 !__mlog_test_u64(__m, mlog_not_bits)) { \
192 if (__m & ML_ERROR) \ 204 if (__m & ML_ERROR) \
193 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ 205 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \
@@ -204,6 +216,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
204 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
205} while (0) 217} while (0)
206 218
219#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
207#define mlog_entry(fmt, args...) do { \ 220#define mlog_entry(fmt, args...) do { \
208 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ 221 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \
209} while (0) 222} while (0)
@@ -247,6 +260,13 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
247#define mlog_exit_void() do { \ 260#define mlog_exit_void() do { \
248 mlog(ML_EXIT, "EXIT\n"); \ 261 mlog(ML_EXIT, "EXIT\n"); \
249} while (0) 262} while (0)
263#else
264#define mlog_entry(...) do { } while (0)
265#define mlog_entry_void(...) do { } while (0)
266#define mlog_exit(...) do { } while (0)
267#define mlog_exit_ptr(...) do { } while (0)
268#define mlog_exit_void(...) do { } while (0)
269#endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */
250 270
251#define mlog_bug_on_msg(cond, fmt, args...) do { \ 271#define mlog_bug_on_msg(cond, fmt, args...) do { \
252 if (cond) { \ 272 if (cond) { \
diff --git a/fs/ocfs2/cluster/ocfs2_heartbeat.h b/fs/ocfs2/cluster/ocfs2_heartbeat.h
index 94096069cb43..3f4151da9709 100644
--- a/fs/ocfs2/cluster/ocfs2_heartbeat.h
+++ b/fs/ocfs2/cluster/ocfs2_heartbeat.h
@@ -32,6 +32,7 @@ struct o2hb_disk_heartbeat_block {
32 __u8 hb_pad1[3]; 32 __u8 hb_pad1[3];
33 __le32 hb_cksum; 33 __le32 hb_cksum;
34 __le64 hb_generation; 34 __le64 hb_generation;
35 __le32 hb_dead_ms;
35}; 36};
36 37
37#endif /* _OCFS2_HEARTBEAT_H */ 38#endif /* _OCFS2_HEARTBEAT_H */
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 1591eb37a723..b650efa8c8be 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -396,8 +396,8 @@ static void o2net_set_nn_state(struct o2net_node *nn,
396 } 396 }
397 397
398 if (was_valid && !valid) { 398 if (was_valid && !valid) {
399 mlog(ML_NOTICE, "no longer connected to " SC_NODEF_FMT "\n", 399 printk(KERN_INFO "o2net: no longer connected to "
400 SC_NODEF_ARGS(old_sc)); 400 SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc));
401 o2net_complete_nodes_nsw(nn); 401 o2net_complete_nodes_nsw(nn);
402 } 402 }
403 403
@@ -409,10 +409,10 @@ static void o2net_set_nn_state(struct o2net_node *nn,
409 * the only way to start connecting again is to down 409 * the only way to start connecting again is to down
410 * heartbeat and bring it back up. */ 410 * heartbeat and bring it back up. */
411 cancel_delayed_work(&nn->nn_connect_expired); 411 cancel_delayed_work(&nn->nn_connect_expired);
412 mlog(ML_NOTICE, "%s " SC_NODEF_FMT "\n", 412 printk(KERN_INFO "o2net: %s " SC_NODEF_FMT "\n",
413 o2nm_this_node() > sc->sc_node->nd_num ? 413 o2nm_this_node() > sc->sc_node->nd_num ?
414 "connected to" : "accepted connection from", 414 "connected to" : "accepted connection from",
415 SC_NODEF_ARGS(sc)); 415 SC_NODEF_ARGS(sc));
416 } 416 }
417 417
418 /* trigger the connecting worker func as long as we're not valid, 418 /* trigger the connecting worker func as long as we're not valid,
@@ -1280,7 +1280,7 @@ static void o2net_idle_timer(unsigned long data)
1280 1280
1281 do_gettimeofday(&now); 1281 do_gettimeofday(&now);
1282 1282
1283 mlog(ML_NOTICE, "connection to " SC_NODEF_FMT " has been idle for 10 " 1283 printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for 10 "
1284 "seconds, shutting it down.\n", SC_NODEF_ARGS(sc)); 1284 "seconds, shutting it down.\n", SC_NODEF_ARGS(sc));
1285 mlog(ML_NOTICE, "here are some times that might help debug the " 1285 mlog(ML_NOTICE, "here are some times that might help debug the "
1286 "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " 1286 "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv "
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index ae47f450792f..3d494d1a5f36 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -213,11 +213,9 @@ int ocfs2_find_files_on_disk(const char *name,
213 struct ocfs2_dir_entry **dirent) 213 struct ocfs2_dir_entry **dirent)
214{ 214{
215 int status = -ENOENT; 215 int status = -ENOENT;
216 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
217 216
218 mlog_entry("(osb=%p, parent=%llu, name='%.*s', blkno=%p, inode=%p)\n", 217 mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n",
219 osb, (unsigned long long)OCFS2_I(inode)->ip_blkno, 218 namelen, name, blkno, inode, dirent_bh, dirent);
220 namelen, name, blkno, inode);
221 219
222 *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); 220 *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent);
223 if (!*dirent_bh || !*dirent) { 221 if (!*dirent_bh || !*dirent) {
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 9bdc9cf65991..14530ee7e11d 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -822,8 +822,6 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data);
822int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data); 822int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data);
823int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, 823int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
824 u8 nodenum, u8 *real_master); 824 u8 nodenum, u8 *real_master);
825int dlm_lockres_master_requery(struct dlm_ctxt *dlm,
826 struct dlm_lock_resource *res, u8 *real_master);
827 825
828 826
829int dlm_dispatch_assert_master(struct dlm_ctxt *dlm, 827int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index b8c23f7ba67e..8d1065f8b3bd 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -408,12 +408,13 @@ static void __dlm_print_nodes(struct dlm_ctxt *dlm)
408 408
409 assert_spin_locked(&dlm->spinlock); 409 assert_spin_locked(&dlm->spinlock);
410 410
411 mlog(ML_NOTICE, "Nodes in my domain (\"%s\"):\n", dlm->name); 411 printk(KERN_INFO "ocfs2_dlm: Nodes in domain (\"%s\"): ", dlm->name);
412 412
413 while ((node = find_next_bit(dlm->domain_map, O2NM_MAX_NODES, 413 while ((node = find_next_bit(dlm->domain_map, O2NM_MAX_NODES,
414 node + 1)) < O2NM_MAX_NODES) { 414 node + 1)) < O2NM_MAX_NODES) {
415 mlog(ML_NOTICE, " node %d\n", node); 415 printk("%d ", node);
416 } 416 }
417 printk("\n");
417} 418}
418 419
419static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data) 420static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data)
@@ -429,7 +430,7 @@ static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data)
429 430
430 node = exit_msg->node_idx; 431 node = exit_msg->node_idx;
431 432
432 mlog(0, "Node %u leaves domain %s\n", node, dlm->name); 433 printk(KERN_INFO "ocfs2_dlm: Node %u leaves domain %s\n", node, dlm->name);
433 434
434 spin_lock(&dlm->spinlock); 435 spin_lock(&dlm->spinlock);
435 clear_bit(node, dlm->domain_map); 436 clear_bit(node, dlm->domain_map);
@@ -678,6 +679,8 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data)
678 set_bit(assert->node_idx, dlm->domain_map); 679 set_bit(assert->node_idx, dlm->domain_map);
679 __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); 680 __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN);
680 681
682 printk(KERN_INFO "ocfs2_dlm: Node %u joins domain %s\n",
683 assert->node_idx, dlm->name);
681 __dlm_print_nodes(dlm); 684 __dlm_print_nodes(dlm);
682 685
683 /* notify anything attached to the heartbeat events */ 686 /* notify anything attached to the heartbeat events */
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 29b2845f370d..594745fab0b5 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -95,6 +95,9 @@ static void dlm_reco_unlock_ast(void *astdata, enum dlm_status st);
95static void dlm_request_all_locks_worker(struct dlm_work_item *item, 95static void dlm_request_all_locks_worker(struct dlm_work_item *item,
96 void *data); 96 void *data);
97static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data); 97static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data);
98static int dlm_lockres_master_requery(struct dlm_ctxt *dlm,
99 struct dlm_lock_resource *res,
100 u8 *real_master);
98 101
99static u64 dlm_get_next_mig_cookie(void); 102static u64 dlm_get_next_mig_cookie(void);
100 103
@@ -1484,8 +1487,9 @@ leave:
1484 1487
1485 1488
1486 1489
1487int dlm_lockres_master_requery(struct dlm_ctxt *dlm, 1490static int dlm_lockres_master_requery(struct dlm_ctxt *dlm,
1488 struct dlm_lock_resource *res, u8 *real_master) 1491 struct dlm_lock_resource *res,
1492 u8 *real_master)
1489{ 1493{
1490 struct dlm_node_iter iter; 1494 struct dlm_node_iter iter;
1491 int nodenum; 1495 int nodenum;
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 4acd37286bdd..762eb1fbb34d 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2071,8 +2071,7 @@ int ocfs2_dlm_init(struct ocfs2_super *osb)
2071 } 2071 }
2072 2072
2073 /* launch vote thread */ 2073 /* launch vote thread */
2074 osb->vote_task = kthread_run(ocfs2_vote_thread, osb, "ocfs2vote-%d", 2074 osb->vote_task = kthread_run(ocfs2_vote_thread, osb, "ocfs2vote");
2075 osb->osb_id);
2076 if (IS_ERR(osb->vote_task)) { 2075 if (IS_ERR(osb->vote_task)) {
2077 status = PTR_ERR(osb->vote_task); 2076 status = PTR_ERR(osb->vote_task);
2078 osb->vote_task = NULL; 2077 osb->vote_task = NULL;
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 1a5c69071df6..fcd4475d1f89 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -298,7 +298,7 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
298 298
299 ret = ocfs2_extent_map_insert(inode, rec, 299 ret = ocfs2_extent_map_insert(inode, rec,
300 le16_to_cpu(el->l_tree_depth)); 300 le16_to_cpu(el->l_tree_depth));
301 if (ret) { 301 if (ret && (ret != -EEXIST)) {
302 mlog_errno(ret); 302 mlog_errno(ret);
303 goto out_free; 303 goto out_free;
304 } 304 }
@@ -427,6 +427,11 @@ static int ocfs2_extent_map_insert_entry(struct ocfs2_extent_map *em,
427/* 427/*
428 * Simple rule: on any return code other than -EAGAIN, anything left 428 * Simple rule: on any return code other than -EAGAIN, anything left
429 * in the insert_context will be freed. 429 * in the insert_context will be freed.
430 *
431 * Simple rule #2: A return code of -EEXIST from this function or
432 * its calls to ocfs2_extent_map_insert_entry() signifies that another
433 * thread beat us to the insert. It is not an actual error, but it
434 * tells the caller we have no more work to do.
430 */ 435 */
431static int ocfs2_extent_map_try_insert(struct inode *inode, 436static int ocfs2_extent_map_try_insert(struct inode *inode,
432 struct ocfs2_extent_rec *rec, 437 struct ocfs2_extent_rec *rec,
@@ -448,22 +453,32 @@ static int ocfs2_extent_map_try_insert(struct inode *inode,
448 goto out_unlock; 453 goto out_unlock;
449 } 454 }
450 455
456 /* Since insert_entry failed, the map MUST have old_ent */
451 old_ent = ocfs2_extent_map_lookup(em, le32_to_cpu(rec->e_cpos), 457 old_ent = ocfs2_extent_map_lookup(em, le32_to_cpu(rec->e_cpos),
452 le32_to_cpu(rec->e_clusters), NULL, 458 le32_to_cpu(rec->e_clusters),
453 NULL); 459 NULL, NULL);
454 460
455 BUG_ON(!old_ent); 461 BUG_ON(!old_ent);
456 462
457 ret = -EEXIST; 463 if (old_ent->e_tree_depth < tree_depth) {
458 if (old_ent->e_tree_depth < tree_depth) 464 /* Another thread beat us to the lower tree_depth */
465 ret = -EEXIST;
459 goto out_unlock; 466 goto out_unlock;
467 }
460 468
461 if (old_ent->e_tree_depth == tree_depth) { 469 if (old_ent->e_tree_depth == tree_depth) {
470 /*
471 * Another thread beat us to this tree_depth.
472 * Let's make sure we agree with that thread (the
473 * extent_rec should be identical).
474 */
462 if (!memcmp(rec, &old_ent->e_rec, 475 if (!memcmp(rec, &old_ent->e_rec,
463 sizeof(struct ocfs2_extent_rec))) 476 sizeof(struct ocfs2_extent_rec)))
464 ret = 0; 477 ret = 0;
478 else
479 /* FIXME: Should this be ESRCH/EBADR??? */
480 ret = -EEXIST;
465 481
466 /* FIXME: Should this be ESRCH/EBADR??? */
467 goto out_unlock; 482 goto out_unlock;
468 } 483 }
469 484
@@ -599,7 +614,7 @@ static int ocfs2_extent_map_insert(struct inode *inode,
599 tree_depth, &ctxt); 614 tree_depth, &ctxt);
600 } while (ret == -EAGAIN); 615 } while (ret == -EAGAIN);
601 616
602 if (ret < 0) 617 if ((ret < 0) && (ret != -EEXIST))
603 mlog_errno(ret); 618 mlog_errno(ret);
604 619
605 if (ctxt.left_ent) 620 if (ctxt.left_ent)
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 910a601b2e98..f92bf1dd379a 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -784,8 +784,7 @@ int ocfs2_journal_load(struct ocfs2_journal *journal)
784 } 784 }
785 785
786 /* Launch the commit thread */ 786 /* Launch the commit thread */
787 osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt-%d", 787 osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt");
788 osb->osb_id);
789 if (IS_ERR(osb->commit_task)) { 788 if (IS_ERR(osb->commit_task)) {
790 status = PTR_ERR(osb->commit_task); 789 status = PTR_ERR(osb->commit_task);
791 osb->commit_task = NULL; 790 osb->commit_task = NULL;
@@ -1118,7 +1117,7 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)
1118 goto out; 1117 goto out;
1119 1118
1120 osb->recovery_thread_task = kthread_run(__ocfs2_recovery_thread, osb, 1119 osb->recovery_thread_task = kthread_run(__ocfs2_recovery_thread, osb,
1121 "ocfs2rec-%d", osb->osb_id); 1120 "ocfs2rec");
1122 if (IS_ERR(osb->recovery_thread_task)) { 1121 if (IS_ERR(osb->recovery_thread_task)) {
1123 mlog_errno((int)PTR_ERR(osb->recovery_thread_task)); 1122 mlog_errno((int)PTR_ERR(osb->recovery_thread_task));
1124 osb->recovery_thread_task = NULL; 1123 osb->recovery_thread_task = NULL;
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
index 843cf9ddefe8..83934e33e5b0 100644
--- a/fs/ocfs2/mmap.c
+++ b/fs/ocfs2/mmap.c
@@ -46,12 +46,12 @@ static struct page *ocfs2_nopage(struct vm_area_struct * area,
46 unsigned long address, 46 unsigned long address,
47 int *type) 47 int *type)
48{ 48{
49 struct inode *inode = area->vm_file->f_dentry->d_inode;
50 struct page *page = NOPAGE_SIGBUS; 49 struct page *page = NOPAGE_SIGBUS;
51 sigset_t blocked, oldset; 50 sigset_t blocked, oldset;
52 int ret; 51 int ret;
53 52
54 mlog_entry("(inode %lu, address %lu)\n", inode->i_ino, address); 53 mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address,
54 type);
55 55
56 /* The best way to deal with signals in this path is 56 /* The best way to deal with signals in this path is
57 * to block them upfront, rather than allowing the 57 * to block them upfront, rather than allowing the
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index da1093039c01..cd4a6f253d13 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -184,7 +184,6 @@ struct ocfs2_journal;
184struct ocfs2_journal_handle; 184struct ocfs2_journal_handle;
185struct ocfs2_super 185struct ocfs2_super
186{ 186{
187 u32 osb_id; /* id used by the proc interface */
188 struct task_struct *commit_task; 187 struct task_struct *commit_task;
189 struct super_block *sb; 188 struct super_block *sb;
190 struct inode *root_inode; 189 struct inode *root_inode;
@@ -222,13 +221,11 @@ struct ocfs2_super
222 unsigned long s_mount_opt; 221 unsigned long s_mount_opt;
223 222
224 u16 max_slots; 223 u16 max_slots;
225 u16 num_nodes;
226 s16 node_num; 224 s16 node_num;
227 s16 slot_num; 225 s16 slot_num;
228 int s_sectsize_bits; 226 int s_sectsize_bits;
229 int s_clustersize; 227 int s_clustersize;
230 int s_clustersize_bits; 228 int s_clustersize_bits;
231 struct proc_dir_entry *proc_sub_dir; /* points to /proc/fs/ocfs2/<maj_min> */
232 229
233 atomic_t vol_state; 230 atomic_t vol_state;
234 struct mutex recovery_lock; 231 struct mutex recovery_lock;
@@ -294,7 +291,6 @@ struct ocfs2_super
294}; 291};
295 292
296#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) 293#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info)
297#define OCFS2_MAX_OSB_ID 65536
298 294
299static inline int ocfs2_should_order_data(struct inode *inode) 295static inline int ocfs2_should_order_data(struct inode *inode)
300{ 296{
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
index 871627961d6d..aa6f5aadedc4 100644
--- a/fs/ocfs2/slot_map.c
+++ b/fs/ocfs2/slot_map.c
@@ -264,7 +264,7 @@ int ocfs2_find_slot(struct ocfs2_super *osb)
264 osb->slot_num = slot; 264 osb->slot_num = slot;
265 spin_unlock(&si->si_lock); 265 spin_unlock(&si->si_lock);
266 266
267 mlog(ML_NOTICE, "taking node slot %d\n", osb->slot_num); 267 mlog(0, "taking node slot %d\n", osb->slot_num);
268 268
269 status = ocfs2_update_disk_slots(osb, si); 269 status = ocfs2_update_disk_slots(osb, si);
270 if (status < 0) 270 if (status < 0)
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index cdf73393f094..382706a67ffd 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -68,13 +68,6 @@
68 68
69#include "buffer_head_io.h" 69#include "buffer_head_io.h"
70 70
71/*
72 * Globals
73 */
74static spinlock_t ocfs2_globals_lock = SPIN_LOCK_UNLOCKED;
75
76static u32 osb_id; /* Keeps track of next available OSB Id */
77
78static kmem_cache_t *ocfs2_inode_cachep = NULL; 71static kmem_cache_t *ocfs2_inode_cachep = NULL;
79 72
80kmem_cache_t *ocfs2_lock_cache = NULL; 73kmem_cache_t *ocfs2_lock_cache = NULL;
@@ -642,10 +635,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
642 635
643 ocfs2_complete_mount_recovery(osb); 636 ocfs2_complete_mount_recovery(osb);
644 637
645 printk("ocfs2: Mounting device (%u,%u) on (node %d, slot %d) with %s " 638 printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %d, slot %d) "
646 "data mode.\n", 639 "with %s data mode.\n",
647 MAJOR(sb->s_dev), MINOR(sb->s_dev), osb->node_num, 640 osb->dev_str, osb->node_num, osb->slot_num,
648 osb->slot_num,
649 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : 641 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" :
650 "ordered"); 642 "ordered");
651 643
@@ -800,10 +792,6 @@ static int __init ocfs2_init(void)
800 goto leave; 792 goto leave;
801 } 793 }
802 794
803 spin_lock(&ocfs2_globals_lock);
804 osb_id = 0;
805 spin_unlock(&ocfs2_globals_lock);
806
807 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); 795 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
808 if (!ocfs2_debugfs_root) { 796 if (!ocfs2_debugfs_root) {
809 status = -EFAULT; 797 status = -EFAULT;
@@ -1020,7 +1008,7 @@ static int ocfs2_fill_local_node_info(struct ocfs2_super *osb)
1020 goto bail; 1008 goto bail;
1021 } 1009 }
1022 1010
1023 mlog(ML_NOTICE, "I am node %d\n", osb->node_num); 1011 mlog(0, "I am node %d\n", osb->node_num);
1024 1012
1025 status = 0; 1013 status = 0;
1026bail: 1014bail:
@@ -1191,8 +1179,8 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
1191 1179
1192 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); 1180 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);
1193 1181
1194 printk("ocfs2: Unmounting device (%u,%u) on (node %d)\n", 1182 printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %d)\n",
1195 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev), osb->node_num); 1183 osb->dev_str, osb->node_num);
1196 1184
1197 ocfs2_delete_osb(osb); 1185 ocfs2_delete_osb(osb);
1198 kfree(osb); 1186 kfree(osb);
@@ -1212,8 +1200,6 @@ static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uu
1212 if (osb->uuid_str == NULL) 1200 if (osb->uuid_str == NULL)
1213 return -ENOMEM; 1201 return -ENOMEM;
1214 1202
1215 memcpy(osb->uuid, uuid, OCFS2_VOL_UUID_LEN);
1216
1217 for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) { 1203 for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) {
1218 /* print with null */ 1204 /* print with null */
1219 ret = snprintf(ptr, 3, "%02X", uuid[i]); 1205 ret = snprintf(ptr, 3, "%02X", uuid[i]);
@@ -1311,13 +1297,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
1311 goto bail; 1297 goto bail;
1312 } 1298 }
1313 1299
1314 osb->uuid = kmalloc(OCFS2_VOL_UUID_LEN, GFP_KERNEL);
1315 if (!osb->uuid) {
1316 mlog(ML_ERROR, "unable to alloc uuid\n");
1317 status = -ENOMEM;
1318 goto bail;
1319 }
1320
1321 di = (struct ocfs2_dinode *)bh->b_data; 1300 di = (struct ocfs2_dinode *)bh->b_data;
1322 1301
1323 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); 1302 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
@@ -1327,7 +1306,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
1327 status = -EINVAL; 1306 status = -EINVAL;
1328 goto bail; 1307 goto bail;
1329 } 1308 }
1330 mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots); 1309 mlog(0, "max_slots for this device: %u\n", osb->max_slots);
1331 1310
1332 init_waitqueue_head(&osb->osb_wipe_event); 1311 init_waitqueue_head(&osb->osb_wipe_event);
1333 osb->osb_orphan_wipes = kcalloc(osb->max_slots, 1312 osb->osb_orphan_wipes = kcalloc(osb->max_slots,
@@ -1418,7 +1397,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
1418 goto bail; 1397 goto bail;
1419 } 1398 }
1420 1399
1421 memcpy(&uuid_net_key, &osb->uuid[i], sizeof(osb->net_key)); 1400 memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key));
1422 osb->net_key = le32_to_cpu(uuid_net_key); 1401 osb->net_key = le32_to_cpu(uuid_net_key);
1423 1402
1424 strncpy(osb->vol_label, di->id2.i_super.s_label, 63); 1403 strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
@@ -1484,18 +1463,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
1484 goto bail; 1463 goto bail;
1485 } 1464 }
1486 1465
1487 /* Link this osb onto the global linked list of all osb structures. */
1488 /* The Global Link List is mainted for the whole driver . */
1489 spin_lock(&ocfs2_globals_lock);
1490 osb->osb_id = osb_id;
1491 if (osb_id < OCFS2_MAX_OSB_ID)
1492 osb_id++;
1493 else {
1494 mlog(ML_ERROR, "Too many volumes mounted\n");
1495 status = -ENOMEM;
1496 }
1497 spin_unlock(&ocfs2_globals_lock);
1498
1499bail: 1466bail:
1500 mlog_exit(status); 1467 mlog_exit(status);
1501 return status; 1468 return status;
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index 0c8a1294ec96..c0f68aa6c175 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -154,7 +154,7 @@ static void *ocfs2_follow_link(struct dentry *dentry,
154 } 154 }
155 155
156 status = vfs_follow_link(nd, link); 156 status = vfs_follow_link(nd, link);
157 if (status) 157 if (status && status != -ENOENT)
158 mlog_errno(status); 158 mlog_errno(status);
159bail: 159bail:
160 if (page) { 160 if (page) {