aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/aops.c13
-rw-r--r--fs/ocfs2/cluster/heartbeat.c17
-rw-r--r--fs/ocfs2/cluster/netdebug.c8
-rw-r--r--fs/ocfs2/cluster/nodemanager.c45
-rw-r--r--fs/ocfs2/dlmglue.c122
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/ocfs2/journal.c2
-rw-r--r--fs/ocfs2/localalloc.c2
-rw-r--r--fs/ocfs2/ocfs2.h12
-rw-r--r--fs/ocfs2/ocfs2_fs.h2
-rw-r--r--fs/ocfs2/stack_user.c19
-rw-r--r--fs/ocfs2/super.c6
12 files changed, 200 insertions, 50 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 17964c0505a9..1db080135c6d 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -174,10 +174,17 @@ static int ocfs2_get_block(struct inode *inode, sector_t iblock,
174 * need to use BH_New is when we're extending i_size on a file 174 * need to use BH_New is when we're extending i_size on a file
175 * system which doesn't support holes, in which case BH_New 175 * system which doesn't support holes, in which case BH_New
176 * allows block_prepare_write() to zero. 176 * allows block_prepare_write() to zero.
177 *
178 * If we see this on a sparse file system, then a truncate has
179 * raced us and removed the cluster. In this case, we clear
180 * the buffers dirty and uptodate bits and let the buffer code
181 * ignore it as a hole.
177 */ 182 */
178 mlog_bug_on_msg(create && p_blkno == 0 && ocfs2_sparse_alloc(osb), 183 if (create && p_blkno == 0 && ocfs2_sparse_alloc(osb)) {
179 "ino %lu, iblock %llu\n", inode->i_ino, 184 clear_buffer_dirty(bh_result);
180 (unsigned long long)iblock); 185 clear_buffer_uptodate(bh_result);
186 goto bail;
187 }
181 188
182 /* Treat the unwritten extent as a hole for zeroing purposes. */ 189 /* Treat the unwritten extent as a hole for zeroing purposes. */
183 if (p_blkno && !(ext_flags & OCFS2_EXT_UNWRITTEN)) 190 if (p_blkno && !(ext_flags & OCFS2_EXT_UNWRITTEN))
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index f02ccb34604d..443d108211ab 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1489,25 +1489,28 @@ static struct o2hb_heartbeat_group *to_o2hb_heartbeat_group(struct config_group
1489 : NULL; 1489 : NULL;
1490} 1490}
1491 1491
1492static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *group, 1492static int o2hb_heartbeat_group_make_item(struct config_group *group,
1493 const char *name) 1493 const char *name,
1494 struct config_item **new_item)
1494{ 1495{
1495 struct o2hb_region *reg = NULL; 1496 struct o2hb_region *reg = NULL;
1496 struct config_item *ret = NULL; 1497 int ret = 0;
1497 1498
1498 reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL); 1499 reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL);
1499 if (reg == NULL) 1500 if (reg == NULL) {
1500 goto out; /* ENOMEM */ 1501 ret = -ENOMEM;
1502 goto out;
1503 }
1501 1504
1502 config_item_init_type_name(&reg->hr_item, name, &o2hb_region_type); 1505 config_item_init_type_name(&reg->hr_item, name, &o2hb_region_type);
1503 1506
1504 ret = &reg->hr_item; 1507 *new_item = &reg->hr_item;
1505 1508
1506 spin_lock(&o2hb_live_lock); 1509 spin_lock(&o2hb_live_lock);
1507 list_add_tail(&reg->hr_all_item, &o2hb_all_regions); 1510 list_add_tail(&reg->hr_all_item, &o2hb_all_regions);
1508 spin_unlock(&o2hb_live_lock); 1511 spin_unlock(&o2hb_live_lock);
1509out: 1512out:
1510 if (ret == NULL) 1513 if (ret)
1511 kfree(reg); 1514 kfree(reg);
1512 1515
1513 return ret; 1516 return ret;
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
index 7bf3c0ea7bd9..d8bfa0eb41b2 100644
--- a/fs/ocfs2/cluster/netdebug.c
+++ b/fs/ocfs2/cluster/netdebug.c
@@ -146,8 +146,10 @@ static int nst_seq_show(struct seq_file *seq, void *v)
146 nst->st_task->comm, nst->st_node, 146 nst->st_task->comm, nst->st_node,
147 nst->st_sc, nst->st_id, nst->st_msg_type, 147 nst->st_sc, nst->st_id, nst->st_msg_type,
148 nst->st_msg_key, 148 nst->st_msg_key,
149 nst->st_sock_time.tv_sec, nst->st_sock_time.tv_usec, 149 nst->st_sock_time.tv_sec,
150 nst->st_send_time.tv_sec, nst->st_send_time.tv_usec, 150 (unsigned long)nst->st_sock_time.tv_usec,
151 nst->st_send_time.tv_sec,
152 (unsigned long)nst->st_send_time.tv_usec,
151 nst->st_status_time.tv_sec, 153 nst->st_status_time.tv_sec,
152 nst->st_status_time.tv_usec); 154 nst->st_status_time.tv_usec);
153 } 155 }
@@ -274,7 +276,7 @@ static void *sc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
274 return sc; /* unused, just needs to be null when done */ 276 return sc; /* unused, just needs to be null when done */
275} 277}
276 278
277#define TV_SEC_USEC(TV) TV.tv_sec, TV.tv_usec 279#define TV_SEC_USEC(TV) TV.tv_sec, (unsigned long)TV.tv_usec
278 280
279static int sc_seq_show(struct seq_file *seq, void *v) 281static int sc_seq_show(struct seq_file *seq, void *v)
280{ 282{
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index cfdb08b484ed..b364b7052e46 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -644,27 +644,32 @@ out:
644 return ret; 644 return ret;
645} 645}
646 646
647static struct config_item *o2nm_node_group_make_item(struct config_group *group, 647static int o2nm_node_group_make_item(struct config_group *group,
648 const char *name) 648 const char *name,
649 struct config_item **new_item)
649{ 650{
650 struct o2nm_node *node = NULL; 651 struct o2nm_node *node = NULL;
651 struct config_item *ret = NULL; 652 int ret = 0;
652 653
653 if (strlen(name) > O2NM_MAX_NAME_LEN) 654 if (strlen(name) > O2NM_MAX_NAME_LEN) {
654 goto out; /* ENAMETOOLONG */ 655 ret = -ENAMETOOLONG;
656 goto out;
657 }
655 658
656 node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); 659 node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL);
657 if (node == NULL) 660 if (node == NULL) {
658 goto out; /* ENOMEM */ 661 ret = -ENOMEM;
662 goto out;
663 }
659 664
660 strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ 665 strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */
661 config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); 666 config_item_init_type_name(&node->nd_item, name, &o2nm_node_type);
662 spin_lock_init(&node->nd_lock); 667 spin_lock_init(&node->nd_lock);
663 668
664 ret = &node->nd_item; 669 *new_item = &node->nd_item;
665 670
666out: 671out:
667 if (ret == NULL) 672 if (ret)
668 kfree(node); 673 kfree(node);
669 674
670 return ret; 675 return ret;
@@ -751,25 +756,31 @@ static struct o2nm_cluster_group *to_o2nm_cluster_group(struct config_group *gro
751} 756}
752#endif 757#endif
753 758
754static struct config_group *o2nm_cluster_group_make_group(struct config_group *group, 759static int o2nm_cluster_group_make_group(struct config_group *group,
755 const char *name) 760 const char *name,
761 struct config_group **new_group)
756{ 762{
757 struct o2nm_cluster *cluster = NULL; 763 struct o2nm_cluster *cluster = NULL;
758 struct o2nm_node_group *ns = NULL; 764 struct o2nm_node_group *ns = NULL;
759 struct config_group *o2hb_group = NULL, *ret = NULL; 765 struct config_group *o2hb_group = NULL;
760 void *defs = NULL; 766 void *defs = NULL;
767 int ret = 0;
761 768
762 /* this runs under the parent dir's i_mutex; there can be only 769 /* this runs under the parent dir's i_mutex; there can be only
763 * one caller in here at a time */ 770 * one caller in here at a time */
764 if (o2nm_single_cluster) 771 if (o2nm_single_cluster) {
765 goto out; /* ENOSPC */ 772 ret = -ENOSPC;
773 goto out;
774 }
766 775
767 cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); 776 cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL);
768 ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); 777 ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL);
769 defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); 778 defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL);
770 o2hb_group = o2hb_alloc_hb_set(); 779 o2hb_group = o2hb_alloc_hb_set();
771 if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) 780 if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) {
781 ret = -ENOMEM;
772 goto out; 782 goto out;
783 }
773 784
774 config_group_init_type_name(&cluster->cl_group, name, 785 config_group_init_type_name(&cluster->cl_group, name,
775 &o2nm_cluster_type); 786 &o2nm_cluster_type);
@@ -786,11 +797,11 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g
786 cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; 797 cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT;
787 cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; 798 cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT;
788 799
789 ret = &cluster->cl_group; 800 *new_group = &cluster->cl_group;
790 o2nm_single_cluster = cluster; 801 o2nm_single_cluster = cluster;
791 802
792out: 803out:
793 if (ret == NULL) { 804 if (ret) {
794 kfree(cluster); 805 kfree(cluster);
795 kfree(ns); 806 kfree(ns);
796 o2hb_free_hb_set(o2hb_group); 807 o2hb_free_hb_set(o2hb_group);
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 80e20d9f2780..eae3d643a5e4 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -31,6 +31,7 @@
31#include <linux/pagemap.h> 31#include <linux/pagemap.h>
32#include <linux/debugfs.h> 32#include <linux/debugfs.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/time.h>
34 35
35#define MLOG_MASK_PREFIX ML_DLM_GLUE 36#define MLOG_MASK_PREFIX ML_DLM_GLUE
36#include <cluster/masklog.h> 37#include <cluster/masklog.h>
@@ -59,6 +60,9 @@ struct ocfs2_mask_waiter {
59 struct completion mw_complete; 60 struct completion mw_complete;
60 unsigned long mw_mask; 61 unsigned long mw_mask;
61 unsigned long mw_goal; 62 unsigned long mw_goal;
63#ifdef CONFIG_OCFS2_FS_STATS
64 unsigned long long mw_lock_start;
65#endif
62}; 66};
63 67
64static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); 68static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres);
@@ -366,6 +370,75 @@ static void ocfs2_remove_lockres_tracking(struct ocfs2_lock_res *res)
366 spin_unlock(&ocfs2_dlm_tracking_lock); 370 spin_unlock(&ocfs2_dlm_tracking_lock);
367} 371}
368 372
373#ifdef CONFIG_OCFS2_FS_STATS
374static void ocfs2_init_lock_stats(struct ocfs2_lock_res *res)
375{
376 res->l_lock_num_prmode = 0;
377 res->l_lock_num_prmode_failed = 0;
378 res->l_lock_total_prmode = 0;
379 res->l_lock_max_prmode = 0;
380 res->l_lock_num_exmode = 0;
381 res->l_lock_num_exmode_failed = 0;
382 res->l_lock_total_exmode = 0;
383 res->l_lock_max_exmode = 0;
384 res->l_lock_refresh = 0;
385}
386
387static void ocfs2_update_lock_stats(struct ocfs2_lock_res *res, int level,
388 struct ocfs2_mask_waiter *mw, int ret)
389{
390 unsigned long long *num, *sum;
391 unsigned int *max, *failed;
392 struct timespec ts = current_kernel_time();
393 unsigned long long time = timespec_to_ns(&ts) - mw->mw_lock_start;
394
395 if (level == LKM_PRMODE) {
396 num = &res->l_lock_num_prmode;
397 sum = &res->l_lock_total_prmode;
398 max = &res->l_lock_max_prmode;
399 failed = &res->l_lock_num_prmode_failed;
400 } else if (level == LKM_EXMODE) {
401 num = &res->l_lock_num_exmode;
402 sum = &res->l_lock_total_exmode;
403 max = &res->l_lock_max_exmode;
404 failed = &res->l_lock_num_exmode_failed;
405 } else
406 return;
407
408 (*num)++;
409 (*sum) += time;
410 if (time > *max)
411 *max = time;
412 if (ret)
413 (*failed)++;
414}
415
416static inline void ocfs2_track_lock_refresh(struct ocfs2_lock_res *lockres)
417{
418 lockres->l_lock_refresh++;
419}
420
421static inline void ocfs2_init_start_time(struct ocfs2_mask_waiter *mw)
422{
423 struct timespec ts = current_kernel_time();
424 mw->mw_lock_start = timespec_to_ns(&ts);
425}
426#else
427static inline void ocfs2_init_lock_stats(struct ocfs2_lock_res *res)
428{
429}
430static inline void ocfs2_update_lock_stats(struct ocfs2_lock_res *res,
431 int level, struct ocfs2_mask_waiter *mw, int ret)
432{
433}
434static inline void ocfs2_track_lock_refresh(struct ocfs2_lock_res *lockres)
435{
436}
437static inline void ocfs2_init_start_time(struct ocfs2_mask_waiter *mw)
438{
439}
440#endif
441
369static void ocfs2_lock_res_init_common(struct ocfs2_super *osb, 442static void ocfs2_lock_res_init_common(struct ocfs2_super *osb,
370 struct ocfs2_lock_res *res, 443 struct ocfs2_lock_res *res,
371 enum ocfs2_lock_type type, 444 enum ocfs2_lock_type type,
@@ -385,6 +458,8 @@ static void ocfs2_lock_res_init_common(struct ocfs2_super *osb,
385 res->l_flags = OCFS2_LOCK_INITIALIZED; 458 res->l_flags = OCFS2_LOCK_INITIALIZED;
386 459
387 ocfs2_add_lockres_tracking(res, osb->osb_dlm_debug); 460 ocfs2_add_lockres_tracking(res, osb->osb_dlm_debug);
461
462 ocfs2_init_lock_stats(res);
388} 463}
389 464
390void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res) 465void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res)
@@ -1048,6 +1123,7 @@ static void ocfs2_init_mask_waiter(struct ocfs2_mask_waiter *mw)
1048{ 1123{
1049 INIT_LIST_HEAD(&mw->mw_item); 1124 INIT_LIST_HEAD(&mw->mw_item);
1050 init_completion(&mw->mw_complete); 1125 init_completion(&mw->mw_complete);
1126 ocfs2_init_start_time(mw);
1051} 1127}
1052 1128
1053static int ocfs2_wait_for_mask(struct ocfs2_mask_waiter *mw) 1129static int ocfs2_wait_for_mask(struct ocfs2_mask_waiter *mw)
@@ -1254,6 +1330,7 @@ out:
1254 goto again; 1330 goto again;
1255 mlog_errno(ret); 1331 mlog_errno(ret);
1256 } 1332 }
1333 ocfs2_update_lock_stats(lockres, level, &mw, ret);
1257 1334
1258 mlog_exit(ret); 1335 mlog_exit(ret);
1259 return ret; 1336 return ret;
@@ -1983,6 +2060,7 @@ static int ocfs2_inode_lock_update(struct inode *inode,
1983 le32_to_cpu(fe->i_flags)); 2060 le32_to_cpu(fe->i_flags));
1984 2061
1985 ocfs2_refresh_inode(inode, fe); 2062 ocfs2_refresh_inode(inode, fe);
2063 ocfs2_track_lock_refresh(lockres);
1986 } 2064 }
1987 2065
1988 status = 0; 2066 status = 0;
@@ -2267,6 +2345,7 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
2267 2345
2268 if (status < 0) 2346 if (status < 0)
2269 mlog_errno(status); 2347 mlog_errno(status);
2348 ocfs2_track_lock_refresh(lockres);
2270 } 2349 }
2271bail: 2350bail:
2272 mlog_exit(status); 2351 mlog_exit(status);
@@ -2461,7 +2540,7 @@ static void *ocfs2_dlm_seq_next(struct seq_file *m, void *v, loff_t *pos)
2461} 2540}
2462 2541
2463/* So that debugfs.ocfs2 can determine which format is being used */ 2542/* So that debugfs.ocfs2 can determine which format is being used */
2464#define OCFS2_DLM_DEBUG_STR_VERSION 1 2543#define OCFS2_DLM_DEBUG_STR_VERSION 2
2465static int ocfs2_dlm_seq_show(struct seq_file *m, void *v) 2544static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
2466{ 2545{
2467 int i; 2546 int i;
@@ -2502,6 +2581,47 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
2502 for(i = 0; i < DLM_LVB_LEN; i++) 2581 for(i = 0; i < DLM_LVB_LEN; i++)
2503 seq_printf(m, "0x%x\t", lvb[i]); 2582 seq_printf(m, "0x%x\t", lvb[i]);
2504 2583
2584#ifdef CONFIG_OCFS2_FS_STATS
2585# define lock_num_prmode(_l) (_l)->l_lock_num_prmode
2586# define lock_num_exmode(_l) (_l)->l_lock_num_exmode
2587# define lock_num_prmode_failed(_l) (_l)->l_lock_num_prmode_failed
2588# define lock_num_exmode_failed(_l) (_l)->l_lock_num_exmode_failed
2589# define lock_total_prmode(_l) (_l)->l_lock_total_prmode
2590# define lock_total_exmode(_l) (_l)->l_lock_total_exmode
2591# define lock_max_prmode(_l) (_l)->l_lock_max_prmode
2592# define lock_max_exmode(_l) (_l)->l_lock_max_exmode
2593# define lock_refresh(_l) (_l)->l_lock_refresh
2594#else
2595# define lock_num_prmode(_l) (0ULL)
2596# define lock_num_exmode(_l) (0ULL)
2597# define lock_num_prmode_failed(_l) (0)
2598# define lock_num_exmode_failed(_l) (0)
2599# define lock_total_prmode(_l) (0ULL)
2600# define lock_total_exmode(_l) (0ULL)
2601# define lock_max_prmode(_l) (0)
2602# define lock_max_exmode(_l) (0)
2603# define lock_refresh(_l) (0)
2604#endif
2605 /* The following seq_print was added in version 2 of this output */
2606 seq_printf(m, "%llu\t"
2607 "%llu\t"
2608 "%u\t"
2609 "%u\t"
2610 "%llu\t"
2611 "%llu\t"
2612 "%u\t"
2613 "%u\t"
2614 "%u\t",
2615 lock_num_prmode(lockres),
2616 lock_num_exmode(lockres),
2617 lock_num_prmode_failed(lockres),
2618 lock_num_exmode_failed(lockres),
2619 lock_total_prmode(lockres),
2620 lock_total_exmode(lockres),
2621 lock_max_prmode(lockres),
2622 lock_max_exmode(lockres),
2623 lock_refresh(lockres));
2624
2505 /* End the line */ 2625 /* End the line */
2506 seq_printf(m, "\n"); 2626 seq_printf(m, "\n");
2507 return 0; 2627 return 0;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 57e0d30cde98..e8514e8b6ce8 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2202,7 +2202,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
2202 2202
2203 ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); 2203 ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
2204 if (ret == -EINVAL) 2204 if (ret == -EINVAL)
2205 mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n"); 2205 mlog(0, "generic_file_aio_read returned -EINVAL\n");
2206 2206
2207 /* buffered aio wouldn't have proper lock coverage today */ 2207 /* buffered aio wouldn't have proper lock coverage today */
2208 BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); 2208 BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT));
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 9698338adc39..a8c19cb3cfdd 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -329,7 +329,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
329 329
330 mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); 330 mlog(0, "Trying to extend transaction by %d blocks\n", nblocks);
331 331
332#ifdef OCFS2_DEBUG_FS 332#ifdef CONFIG_OCFS2_DEBUG_FS
333 status = 1; 333 status = 1;
334#else 334#else
335 status = journal_extend(handle, nblocks); 335 status = journal_extend(handle, nblocks);
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index be774bdc8b36..28e492e4ec88 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -498,7 +498,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
498 498
499 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; 499 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
500 500
501#ifdef OCFS2_DEBUG_FS 501#ifdef CONFIG_OCFS2_DEBUG_FS
502 if (le32_to_cpu(alloc->id1.bitmap1.i_used) != 502 if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
503 ocfs2_local_alloc_count_bits(alloc)) { 503 ocfs2_local_alloc_count_bits(alloc)) {
504 ocfs2_error(osb->sb, "local alloc inode %llu says it has " 504 ocfs2_error(osb->sb, "local alloc inode %llu says it has "
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 31692379c170..1cb814be8ef1 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -132,6 +132,18 @@ struct ocfs2_lock_res {
132 wait_queue_head_t l_event; 132 wait_queue_head_t l_event;
133 133
134 struct list_head l_debug_list; 134 struct list_head l_debug_list;
135
136#ifdef CONFIG_OCFS2_FS_STATS
137 unsigned long long l_lock_num_prmode; /* PR acquires */
138 unsigned long long l_lock_num_exmode; /* EX acquires */
139 unsigned int l_lock_num_prmode_failed; /* Failed PR gets */
140 unsigned int l_lock_num_exmode_failed; /* Failed EX gets */
141 unsigned long long l_lock_total_prmode; /* Tot wait for PR */
142 unsigned long long l_lock_total_exmode; /* Tot wait for EX */
143 unsigned int l_lock_max_prmode; /* Max wait for PR */
144 unsigned int l_lock_max_exmode; /* Max wait for EX */
145 unsigned int l_lock_refresh; /* Disk refreshes */
146#endif
135}; 147};
136 148
137struct ocfs2_dlm_debug { 149struct ocfs2_dlm_debug {
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 52c426665154..3f1945177629 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -901,7 +901,7 @@ static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
901 * list has a copy per slot. 901 * list has a copy per slot.
902 */ 902 */
903 if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE) 903 if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
904 chars = snprintf(buf, len, 904 chars = snprintf(buf, len, "%s",
905 ocfs2_system_inodes[type].si_name); 905 ocfs2_system_inodes[type].si_name);
906 else 906 else
907 chars = snprintf(buf, len, 907 chars = snprintf(buf, len,
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index bd7e0f3acfc7..353fc35c6748 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -550,26 +550,17 @@ static ssize_t ocfs2_control_read(struct file *file,
550 size_t count, 550 size_t count,
551 loff_t *ppos) 551 loff_t *ppos)
552{ 552{
553 char *proto_string = OCFS2_CONTROL_PROTO; 553 ssize_t ret;
554 size_t to_write = 0;
555
556 if (*ppos >= OCFS2_CONTROL_PROTO_LEN)
557 return 0;
558
559 to_write = OCFS2_CONTROL_PROTO_LEN - *ppos;
560 if (to_write > count)
561 to_write = count;
562 if (copy_to_user(buf, proto_string + *ppos, to_write))
563 return -EFAULT;
564 554
565 *ppos += to_write; 555 ret = simple_read_from_buffer(buf, count, ppos,
556 OCFS2_CONTROL_PROTO, OCFS2_CONTROL_PROTO_LEN);
566 557
567 /* Have we read the whole protocol list? */ 558 /* Have we read the whole protocol list? */
568 if (*ppos >= OCFS2_CONTROL_PROTO_LEN) 559 if (ret > 0 && *ppos >= OCFS2_CONTROL_PROTO_LEN)
569 ocfs2_control_set_handshake_state(file, 560 ocfs2_control_set_handshake_state(file,
570 OCFS2_CONTROL_HANDSHAKE_READ); 561 OCFS2_CONTROL_HANDSHAKE_READ);
571 562
572 return to_write; 563 return ret;
573} 564}
574 565
575static int ocfs2_control_release(struct inode *inode, struct file *file) 566static int ocfs2_control_release(struct inode *inode, struct file *file)
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index df63ba20ae90..ccecfe5094fa 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1703,7 +1703,11 @@ static int ocfs2_check_volume(struct ocfs2_super *osb)
1703 local = ocfs2_mount_local(osb); 1703 local = ocfs2_mount_local(osb);
1704 1704
1705 /* will play back anything left in the journal. */ 1705 /* will play back anything left in the journal. */
1706 ocfs2_journal_load(osb->journal, local); 1706 status = ocfs2_journal_load(osb->journal, local);
1707 if (status < 0) {
1708 mlog(ML_ERROR, "ocfs2 journal load failed! %d\n", status);
1709 goto finally;
1710 }
1707 1711
1708 if (dirty) { 1712 if (dirty) {
1709 /* recover my local alloc if we didn't unmount cleanly. */ 1713 /* recover my local alloc if we didn't unmount cleanly. */