diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/aops.c | 15 | ||||
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 19 | ||||
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/cluster/netdebug.c | 78 | ||||
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 43 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdebug.c | 39 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 44 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 25 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/dlmglue.c | 23 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 47 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 2 | ||||
-rw-r--r-- | fs/ocfs2/move_extents.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/stack_user.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 1 |
15 files changed, 169 insertions, 179 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 4a231a166cf8..1ef547e49373 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -1481,8 +1481,16 @@ static int ocfs2_write_begin_inline(struct address_space *mapping, | |||
1481 | handle_t *handle; | 1481 | handle_t *handle; |
1482 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; | 1482 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; |
1483 | 1483 | ||
1484 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | ||
1485 | if (IS_ERR(handle)) { | ||
1486 | ret = PTR_ERR(handle); | ||
1487 | mlog_errno(ret); | ||
1488 | goto out; | ||
1489 | } | ||
1490 | |||
1484 | page = find_or_create_page(mapping, 0, GFP_NOFS); | 1491 | page = find_or_create_page(mapping, 0, GFP_NOFS); |
1485 | if (!page) { | 1492 | if (!page) { |
1493 | ocfs2_commit_trans(osb, handle); | ||
1486 | ret = -ENOMEM; | 1494 | ret = -ENOMEM; |
1487 | mlog_errno(ret); | 1495 | mlog_errno(ret); |
1488 | goto out; | 1496 | goto out; |
@@ -1494,13 +1502,6 @@ static int ocfs2_write_begin_inline(struct address_space *mapping, | |||
1494 | wc->w_pages[0] = wc->w_target_page = page; | 1502 | wc->w_pages[0] = wc->w_target_page = page; |
1495 | wc->w_num_pages = 1; | 1503 | wc->w_num_pages = 1; |
1496 | 1504 | ||
1497 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | ||
1498 | if (IS_ERR(handle)) { | ||
1499 | ret = PTR_ERR(handle); | ||
1500 | mlog_errno(ret); | ||
1501 | goto out; | ||
1502 | } | ||
1503 | |||
1504 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), wc->w_di_bh, | 1505 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), wc->w_di_bh, |
1505 | OCFS2_JOURNAL_ACCESS_WRITE); | 1506 | OCFS2_JOURNAL_ACCESS_WRITE); |
1506 | if (ret) { | 1507 | if (ret) { |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 73039295d0d1..d13385448168 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -2572,6 +2572,25 @@ int o2hb_check_node_heartbeating(u8 node_num) | |||
2572 | } | 2572 | } |
2573 | EXPORT_SYMBOL_GPL(o2hb_check_node_heartbeating); | 2573 | EXPORT_SYMBOL_GPL(o2hb_check_node_heartbeating); |
2574 | 2574 | ||
2575 | int o2hb_check_node_heartbeating_no_sem(u8 node_num) | ||
2576 | { | ||
2577 | unsigned long testing_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; | ||
2578 | unsigned long flags; | ||
2579 | |||
2580 | spin_lock_irqsave(&o2hb_live_lock, flags); | ||
2581 | o2hb_fill_node_map_from_callback(testing_map, sizeof(testing_map)); | ||
2582 | spin_unlock_irqrestore(&o2hb_live_lock, flags); | ||
2583 | if (!test_bit(node_num, testing_map)) { | ||
2584 | mlog(ML_HEARTBEAT, | ||
2585 | "node (%u) does not have heartbeating enabled.\n", | ||
2586 | node_num); | ||
2587 | return 0; | ||
2588 | } | ||
2589 | |||
2590 | return 1; | ||
2591 | } | ||
2592 | EXPORT_SYMBOL_GPL(o2hb_check_node_heartbeating_no_sem); | ||
2593 | |||
2575 | int o2hb_check_node_heartbeating_from_callback(u8 node_num) | 2594 | int o2hb_check_node_heartbeating_from_callback(u8 node_num) |
2576 | { | 2595 | { |
2577 | unsigned long testing_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 2596 | unsigned long testing_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h index 00ad8e8fea51..3ef5137dc362 100644 --- a/fs/ocfs2/cluster/heartbeat.h +++ b/fs/ocfs2/cluster/heartbeat.h | |||
@@ -80,6 +80,7 @@ void o2hb_fill_node_map(unsigned long *map, | |||
80 | void o2hb_exit(void); | 80 | void o2hb_exit(void); |
81 | int o2hb_init(void); | 81 | int o2hb_init(void); |
82 | int o2hb_check_node_heartbeating(u8 node_num); | 82 | int o2hb_check_node_heartbeating(u8 node_num); |
83 | int o2hb_check_node_heartbeating_no_sem(u8 node_num); | ||
83 | int o2hb_check_node_heartbeating_from_callback(u8 node_num); | 84 | int o2hb_check_node_heartbeating_from_callback(u8 node_num); |
84 | int o2hb_check_local_node_heartbeating(void); | 85 | int o2hb_check_local_node_heartbeating(void); |
85 | void o2hb_stop_all_regions(void); | 86 | void o2hb_stop_all_regions(void); |
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index 73ba81928bce..27d1242c8383 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
@@ -185,29 +185,13 @@ static const struct seq_operations nst_seq_ops = { | |||
185 | static int nst_fop_open(struct inode *inode, struct file *file) | 185 | static int nst_fop_open(struct inode *inode, struct file *file) |
186 | { | 186 | { |
187 | struct o2net_send_tracking *dummy_nst; | 187 | struct o2net_send_tracking *dummy_nst; |
188 | struct seq_file *seq; | ||
189 | int ret; | ||
190 | 188 | ||
191 | dummy_nst = kmalloc(sizeof(struct o2net_send_tracking), GFP_KERNEL); | 189 | dummy_nst = __seq_open_private(file, &nst_seq_ops, sizeof(*dummy_nst)); |
192 | if (dummy_nst == NULL) { | 190 | if (!dummy_nst) |
193 | ret = -ENOMEM; | 191 | return -ENOMEM; |
194 | goto out; | ||
195 | } | ||
196 | dummy_nst->st_task = NULL; | ||
197 | |||
198 | ret = seq_open(file, &nst_seq_ops); | ||
199 | if (ret) | ||
200 | goto out; | ||
201 | |||
202 | seq = file->private_data; | ||
203 | seq->private = dummy_nst; | ||
204 | o2net_debug_add_nst(dummy_nst); | 192 | o2net_debug_add_nst(dummy_nst); |
205 | 193 | ||
206 | dummy_nst = NULL; | 194 | return 0; |
207 | |||
208 | out: | ||
209 | kfree(dummy_nst); | ||
210 | return ret; | ||
211 | } | 195 | } |
212 | 196 | ||
213 | static int nst_fop_release(struct inode *inode, struct file *file) | 197 | static int nst_fop_release(struct inode *inode, struct file *file) |
@@ -412,33 +396,27 @@ static const struct seq_operations sc_seq_ops = { | |||
412 | .show = sc_seq_show, | 396 | .show = sc_seq_show, |
413 | }; | 397 | }; |
414 | 398 | ||
415 | static int sc_common_open(struct file *file, struct o2net_sock_debug *sd) | 399 | static int sc_common_open(struct file *file, int ctxt) |
416 | { | 400 | { |
401 | struct o2net_sock_debug *sd; | ||
417 | struct o2net_sock_container *dummy_sc; | 402 | struct o2net_sock_container *dummy_sc; |
418 | struct seq_file *seq; | ||
419 | int ret; | ||
420 | 403 | ||
421 | dummy_sc = kmalloc(sizeof(struct o2net_sock_container), GFP_KERNEL); | 404 | dummy_sc = kzalloc(sizeof(*dummy_sc), GFP_KERNEL); |
422 | if (dummy_sc == NULL) { | 405 | if (!dummy_sc) |
423 | ret = -ENOMEM; | 406 | return -ENOMEM; |
424 | goto out; | ||
425 | } | ||
426 | dummy_sc->sc_page = NULL; | ||
427 | 407 | ||
428 | ret = seq_open(file, &sc_seq_ops); | 408 | sd = __seq_open_private(file, &sc_seq_ops, sizeof(*sd)); |
429 | if (ret) | 409 | if (!sd) { |
430 | goto out; | 410 | kfree(dummy_sc); |
411 | return -ENOMEM; | ||
412 | } | ||
431 | 413 | ||
432 | seq = file->private_data; | 414 | sd->dbg_ctxt = ctxt; |
433 | seq->private = sd; | ||
434 | sd->dbg_sock = dummy_sc; | 415 | sd->dbg_sock = dummy_sc; |
435 | o2net_debug_add_sc(dummy_sc); | ||
436 | 416 | ||
437 | dummy_sc = NULL; | 417 | o2net_debug_add_sc(dummy_sc); |
438 | 418 | ||
439 | out: | 419 | return 0; |
440 | kfree(dummy_sc); | ||
441 | return ret; | ||
442 | } | 420 | } |
443 | 421 | ||
444 | static int sc_fop_release(struct inode *inode, struct file *file) | 422 | static int sc_fop_release(struct inode *inode, struct file *file) |
@@ -453,16 +431,7 @@ static int sc_fop_release(struct inode *inode, struct file *file) | |||
453 | 431 | ||
454 | static int stats_fop_open(struct inode *inode, struct file *file) | 432 | static int stats_fop_open(struct inode *inode, struct file *file) |
455 | { | 433 | { |
456 | struct o2net_sock_debug *sd; | 434 | return sc_common_open(file, SHOW_SOCK_STATS); |
457 | |||
458 | sd = kmalloc(sizeof(struct o2net_sock_debug), GFP_KERNEL); | ||
459 | if (sd == NULL) | ||
460 | return -ENOMEM; | ||
461 | |||
462 | sd->dbg_ctxt = SHOW_SOCK_STATS; | ||
463 | sd->dbg_sock = NULL; | ||
464 | |||
465 | return sc_common_open(file, sd); | ||
466 | } | 435 | } |
467 | 436 | ||
468 | static const struct file_operations stats_seq_fops = { | 437 | static const struct file_operations stats_seq_fops = { |
@@ -474,16 +443,7 @@ static const struct file_operations stats_seq_fops = { | |||
474 | 443 | ||
475 | static int sc_fop_open(struct inode *inode, struct file *file) | 444 | static int sc_fop_open(struct inode *inode, struct file *file) |
476 | { | 445 | { |
477 | struct o2net_sock_debug *sd; | 446 | return sc_common_open(file, SHOW_SOCK_CONTAINERS); |
478 | |||
479 | sd = kmalloc(sizeof(struct o2net_sock_debug), GFP_KERNEL); | ||
480 | if (sd == NULL) | ||
481 | return -ENOMEM; | ||
482 | |||
483 | sd->dbg_ctxt = SHOW_SOCK_CONTAINERS; | ||
484 | sd->dbg_sock = NULL; | ||
485 | |||
486 | return sc_common_open(file, sd); | ||
487 | } | 447 | } |
488 | 448 | ||
489 | static const struct file_operations sc_seq_fops = { | 449 | static const struct file_operations sc_seq_fops = { |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index ea34952f9496..97de0fbd9f78 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -536,7 +536,7 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
536 | if (nn->nn_persistent_error || nn->nn_sc_valid) | 536 | if (nn->nn_persistent_error || nn->nn_sc_valid) |
537 | wake_up(&nn->nn_sc_wq); | 537 | wake_up(&nn->nn_sc_wq); |
538 | 538 | ||
539 | if (!was_err && nn->nn_persistent_error) { | 539 | if (was_valid && !was_err && nn->nn_persistent_error) { |
540 | o2quo_conn_err(o2net_num_from_nn(nn)); | 540 | o2quo_conn_err(o2net_num_from_nn(nn)); |
541 | queue_delayed_work(o2net_wq, &nn->nn_still_up, | 541 | queue_delayed_work(o2net_wq, &nn->nn_still_up, |
542 | msecs_to_jiffies(O2NET_QUORUM_DELAY_MS)); | 542 | msecs_to_jiffies(O2NET_QUORUM_DELAY_MS)); |
@@ -1601,7 +1601,15 @@ static void o2net_start_connect(struct work_struct *work) | |||
1601 | struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; | 1601 | struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; |
1602 | int ret = 0, stop; | 1602 | int ret = 0, stop; |
1603 | unsigned int timeout; | 1603 | unsigned int timeout; |
1604 | unsigned int noio_flag; | ||
1604 | 1605 | ||
1606 | /* | ||
1607 | * sock_create allocates the sock with GFP_KERNEL. We must set | ||
1608 | * per-process flag PF_MEMALLOC_NOIO so that all allocations done | ||
1609 | * by this process are done as if GFP_NOIO was specified. So we | ||
1610 | * are not reentering filesystem while doing memory reclaim. | ||
1611 | */ | ||
1612 | noio_flag = memalloc_noio_save(); | ||
1605 | /* if we're greater we initiate tx, otherwise we accept */ | 1613 | /* if we're greater we initiate tx, otherwise we accept */ |
1606 | if (o2nm_this_node() <= o2net_num_from_nn(nn)) | 1614 | if (o2nm_this_node() <= o2net_num_from_nn(nn)) |
1607 | goto out; | 1615 | goto out; |
@@ -1710,6 +1718,7 @@ out: | |||
1710 | if (mynode) | 1718 | if (mynode) |
1711 | o2nm_node_put(mynode); | 1719 | o2nm_node_put(mynode); |
1712 | 1720 | ||
1721 | memalloc_noio_restore(noio_flag); | ||
1713 | return; | 1722 | return; |
1714 | } | 1723 | } |
1715 | 1724 | ||
@@ -1721,7 +1730,8 @@ static void o2net_connect_expired(struct work_struct *work) | |||
1721 | spin_lock(&nn->nn_lock); | 1730 | spin_lock(&nn->nn_lock); |
1722 | if (!nn->nn_sc_valid) { | 1731 | if (!nn->nn_sc_valid) { |
1723 | printk(KERN_NOTICE "o2net: No connection established with " | 1732 | printk(KERN_NOTICE "o2net: No connection established with " |
1724 | "node %u after %u.%u seconds, giving up.\n", | 1733 | "node %u after %u.%u seconds, check network and" |
1734 | " cluster configuration.\n", | ||
1725 | o2net_num_from_nn(nn), | 1735 | o2net_num_from_nn(nn), |
1726 | o2net_idle_timeout() / 1000, | 1736 | o2net_idle_timeout() / 1000, |
1727 | o2net_idle_timeout() % 1000); | 1737 | o2net_idle_timeout() % 1000); |
@@ -1835,6 +1845,15 @@ static int o2net_accept_one(struct socket *sock, int *more) | |||
1835 | struct o2nm_node *local_node = NULL; | 1845 | struct o2nm_node *local_node = NULL; |
1836 | struct o2net_sock_container *sc = NULL; | 1846 | struct o2net_sock_container *sc = NULL; |
1837 | struct o2net_node *nn; | 1847 | struct o2net_node *nn; |
1848 | unsigned int noio_flag; | ||
1849 | |||
1850 | /* | ||
1851 | * sock_create_lite allocates the sock with GFP_KERNEL. We must set | ||
1852 | * per-process flag PF_MEMALLOC_NOIO so that all allocations done | ||
1853 | * by this process are done as if GFP_NOIO was specified. So we | ||
1854 | * are not reentering filesystem while doing memory reclaim. | ||
1855 | */ | ||
1856 | noio_flag = memalloc_noio_save(); | ||
1838 | 1857 | ||
1839 | BUG_ON(sock == NULL); | 1858 | BUG_ON(sock == NULL); |
1840 | *more = 0; | 1859 | *more = 0; |
@@ -1951,6 +1970,8 @@ out: | |||
1951 | o2nm_node_put(local_node); | 1970 | o2nm_node_put(local_node); |
1952 | if (sc) | 1971 | if (sc) |
1953 | sc_put(sc); | 1972 | sc_put(sc); |
1973 | |||
1974 | memalloc_noio_restore(noio_flag); | ||
1954 | return ret; | 1975 | return ret; |
1955 | } | 1976 | } |
1956 | 1977 | ||
@@ -2146,17 +2167,13 @@ int o2net_init(void) | |||
2146 | o2quo_init(); | 2167 | o2quo_init(); |
2147 | 2168 | ||
2148 | if (o2net_debugfs_init()) | 2169 | if (o2net_debugfs_init()) |
2149 | return -ENOMEM; | 2170 | goto out; |
2150 | 2171 | ||
2151 | o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL); | 2172 | o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL); |
2152 | o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); | 2173 | o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); |
2153 | o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); | 2174 | o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); |
2154 | if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp) { | 2175 | if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp) |
2155 | kfree(o2net_hand); | 2176 | goto out; |
2156 | kfree(o2net_keep_req); | ||
2157 | kfree(o2net_keep_resp); | ||
2158 | return -ENOMEM; | ||
2159 | } | ||
2160 | 2177 | ||
2161 | o2net_hand->protocol_version = cpu_to_be64(O2NET_PROTOCOL_VERSION); | 2178 | o2net_hand->protocol_version = cpu_to_be64(O2NET_PROTOCOL_VERSION); |
2162 | o2net_hand->connector_id = cpu_to_be64(1); | 2179 | o2net_hand->connector_id = cpu_to_be64(1); |
@@ -2181,6 +2198,14 @@ int o2net_init(void) | |||
2181 | } | 2198 | } |
2182 | 2199 | ||
2183 | return 0; | 2200 | return 0; |
2201 | |||
2202 | out: | ||
2203 | kfree(o2net_hand); | ||
2204 | kfree(o2net_keep_req); | ||
2205 | kfree(o2net_keep_resp); | ||
2206 | |||
2207 | o2quo_exit(); | ||
2208 | return -ENOMEM; | ||
2184 | } | 2209 | } |
2185 | 2210 | ||
2186 | void o2net_exit(void) | 2211 | void o2net_exit(void) |
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 18f13c2e4a10..149eb556b8c6 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c | |||
@@ -647,41 +647,30 @@ static const struct seq_operations debug_lockres_ops = { | |||
647 | static int debug_lockres_open(struct inode *inode, struct file *file) | 647 | static int debug_lockres_open(struct inode *inode, struct file *file) |
648 | { | 648 | { |
649 | struct dlm_ctxt *dlm = inode->i_private; | 649 | struct dlm_ctxt *dlm = inode->i_private; |
650 | int ret = -ENOMEM; | 650 | struct debug_lockres *dl; |
651 | struct seq_file *seq; | 651 | void *buf; |
652 | struct debug_lockres *dl = NULL; | ||
653 | 652 | ||
654 | dl = kzalloc(sizeof(struct debug_lockres), GFP_KERNEL); | 653 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
655 | if (!dl) { | 654 | if (!buf) |
656 | mlog_errno(ret); | ||
657 | goto bail; | 655 | goto bail; |
658 | } | ||
659 | 656 | ||
660 | dl->dl_len = PAGE_SIZE; | 657 | dl = __seq_open_private(file, &debug_lockres_ops, sizeof(*dl)); |
661 | dl->dl_buf = kmalloc(dl->dl_len, GFP_KERNEL); | 658 | if (!dl) |
662 | if (!dl->dl_buf) { | 659 | goto bailfree; |
663 | mlog_errno(ret); | ||
664 | goto bail; | ||
665 | } | ||
666 | 660 | ||
667 | ret = seq_open(file, &debug_lockres_ops); | 661 | dl->dl_len = PAGE_SIZE; |
668 | if (ret) { | 662 | dl->dl_buf = buf; |
669 | mlog_errno(ret); | ||
670 | goto bail; | ||
671 | } | ||
672 | |||
673 | seq = file->private_data; | ||
674 | seq->private = dl; | ||
675 | 663 | ||
676 | dlm_grab(dlm); | 664 | dlm_grab(dlm); |
677 | dl->dl_ctxt = dlm; | 665 | dl->dl_ctxt = dlm; |
678 | 666 | ||
679 | return 0; | 667 | return 0; |
668 | |||
669 | bailfree: | ||
670 | kfree(buf); | ||
680 | bail: | 671 | bail: |
681 | if (dl) | 672 | mlog_errno(-ENOMEM); |
682 | kfree(dl->dl_buf); | 673 | return -ENOMEM; |
683 | kfree(dl); | ||
684 | return ret; | ||
685 | } | 674 | } |
686 | 675 | ||
687 | static int debug_lockres_release(struct inode *inode, struct file *file) | 676 | static int debug_lockres_release(struct inode *inode, struct file *file) |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 3fcf205ee900..02d315fef432 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -839,7 +839,7 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | |||
839 | * to back off and try again. This gives heartbeat a chance | 839 | * to back off and try again. This gives heartbeat a chance |
840 | * to catch up. | 840 | * to catch up. |
841 | */ | 841 | */ |
842 | if (!o2hb_check_node_heartbeating(query->node_idx)) { | 842 | if (!o2hb_check_node_heartbeating_no_sem(query->node_idx)) { |
843 | mlog(0, "node %u is not in our live map yet\n", | 843 | mlog(0, "node %u is not in our live map yet\n", |
844 | query->node_idx); | 844 | query->node_idx); |
845 | 845 | ||
@@ -1975,24 +1975,22 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
1975 | 1975 | ||
1976 | dlm = kzalloc(sizeof(*dlm), GFP_KERNEL); | 1976 | dlm = kzalloc(sizeof(*dlm), GFP_KERNEL); |
1977 | if (!dlm) { | 1977 | if (!dlm) { |
1978 | mlog_errno(-ENOMEM); | 1978 | ret = -ENOMEM; |
1979 | mlog_errno(ret); | ||
1979 | goto leave; | 1980 | goto leave; |
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | dlm->name = kstrdup(domain, GFP_KERNEL); | 1983 | dlm->name = kstrdup(domain, GFP_KERNEL); |
1983 | if (dlm->name == NULL) { | 1984 | if (dlm->name == NULL) { |
1984 | mlog_errno(-ENOMEM); | 1985 | ret = -ENOMEM; |
1985 | kfree(dlm); | 1986 | mlog_errno(ret); |
1986 | dlm = NULL; | ||
1987 | goto leave; | 1987 | goto leave; |
1988 | } | 1988 | } |
1989 | 1989 | ||
1990 | dlm->lockres_hash = (struct hlist_head **)dlm_alloc_pagevec(DLM_HASH_PAGES); | 1990 | dlm->lockres_hash = (struct hlist_head **)dlm_alloc_pagevec(DLM_HASH_PAGES); |
1991 | if (!dlm->lockres_hash) { | 1991 | if (!dlm->lockres_hash) { |
1992 | mlog_errno(-ENOMEM); | 1992 | ret = -ENOMEM; |
1993 | kfree(dlm->name); | 1993 | mlog_errno(ret); |
1994 | kfree(dlm); | ||
1995 | dlm = NULL; | ||
1996 | goto leave; | 1994 | goto leave; |
1997 | } | 1995 | } |
1998 | 1996 | ||
@@ -2002,11 +2000,8 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2002 | dlm->master_hash = (struct hlist_head **) | 2000 | dlm->master_hash = (struct hlist_head **) |
2003 | dlm_alloc_pagevec(DLM_HASH_PAGES); | 2001 | dlm_alloc_pagevec(DLM_HASH_PAGES); |
2004 | if (!dlm->master_hash) { | 2002 | if (!dlm->master_hash) { |
2005 | mlog_errno(-ENOMEM); | 2003 | ret = -ENOMEM; |
2006 | dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES); | 2004 | mlog_errno(ret); |
2007 | kfree(dlm->name); | ||
2008 | kfree(dlm); | ||
2009 | dlm = NULL; | ||
2010 | goto leave; | 2005 | goto leave; |
2011 | } | 2006 | } |
2012 | 2007 | ||
@@ -2017,14 +2012,8 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2017 | dlm->node_num = o2nm_this_node(); | 2012 | dlm->node_num = o2nm_this_node(); |
2018 | 2013 | ||
2019 | ret = dlm_create_debugfs_subroot(dlm); | 2014 | ret = dlm_create_debugfs_subroot(dlm); |
2020 | if (ret < 0) { | 2015 | if (ret < 0) |
2021 | dlm_free_pagevec((void **)dlm->master_hash, DLM_HASH_PAGES); | ||
2022 | dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES); | ||
2023 | kfree(dlm->name); | ||
2024 | kfree(dlm); | ||
2025 | dlm = NULL; | ||
2026 | goto leave; | 2016 | goto leave; |
2027 | } | ||
2028 | 2017 | ||
2029 | spin_lock_init(&dlm->spinlock); | 2018 | spin_lock_init(&dlm->spinlock); |
2030 | spin_lock_init(&dlm->master_lock); | 2019 | spin_lock_init(&dlm->master_lock); |
@@ -2085,6 +2074,19 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2085 | atomic_read(&dlm->dlm_refs.refcount)); | 2074 | atomic_read(&dlm->dlm_refs.refcount)); |
2086 | 2075 | ||
2087 | leave: | 2076 | leave: |
2077 | if (ret < 0 && dlm) { | ||
2078 | if (dlm->master_hash) | ||
2079 | dlm_free_pagevec((void **)dlm->master_hash, | ||
2080 | DLM_HASH_PAGES); | ||
2081 | |||
2082 | if (dlm->lockres_hash) | ||
2083 | dlm_free_pagevec((void **)dlm->lockres_hash, | ||
2084 | DLM_HASH_PAGES); | ||
2085 | |||
2086 | kfree(dlm->name); | ||
2087 | kfree(dlm); | ||
2088 | dlm = NULL; | ||
2089 | } | ||
2088 | return dlm; | 2090 | return dlm; |
2089 | } | 2091 | } |
2090 | 2092 | ||
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 3ec906ef5d9a..215e41abf101 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -625,9 +625,6 @@ struct dlm_lock_resource *dlm_new_lockres(struct dlm_ctxt *dlm, | |||
625 | return res; | 625 | return res; |
626 | 626 | ||
627 | error: | 627 | error: |
628 | if (res && res->lockname.name) | ||
629 | kmem_cache_free(dlm_lockname_cache, (void *)res->lockname.name); | ||
630 | |||
631 | if (res) | 628 | if (res) |
632 | kmem_cache_free(dlm_lockres_cache, res); | 629 | kmem_cache_free(dlm_lockres_cache, res); |
633 | return NULL; | 630 | return NULL; |
@@ -655,12 +652,9 @@ void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm, | |||
655 | clear_bit(bit, res->refmap); | 652 | clear_bit(bit, res->refmap); |
656 | } | 653 | } |
657 | 654 | ||
658 | 655 | static void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | |
659 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
660 | struct dlm_lock_resource *res) | 656 | struct dlm_lock_resource *res) |
661 | { | 657 | { |
662 | assert_spin_locked(&res->spinlock); | ||
663 | |||
664 | res->inflight_locks++; | 658 | res->inflight_locks++; |
665 | 659 | ||
666 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, | 660 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, |
@@ -668,6 +662,13 @@ void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | |||
668 | __builtin_return_address(0)); | 662 | __builtin_return_address(0)); |
669 | } | 663 | } |
670 | 664 | ||
665 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
666 | struct dlm_lock_resource *res) | ||
667 | { | ||
668 | assert_spin_locked(&res->spinlock); | ||
669 | __dlm_lockres_grab_inflight_ref(dlm, res); | ||
670 | } | ||
671 | |||
671 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | 672 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, |
672 | struct dlm_lock_resource *res) | 673 | struct dlm_lock_resource *res) |
673 | { | 674 | { |
@@ -894,10 +895,8 @@ lookup: | |||
894 | /* finally add the lockres to its hash bucket */ | 895 | /* finally add the lockres to its hash bucket */ |
895 | __dlm_insert_lockres(dlm, res); | 896 | __dlm_insert_lockres(dlm, res); |
896 | 897 | ||
897 | /* Grab inflight ref to pin the resource */ | 898 | /* since this lockres is new it doesn't not require the spinlock */ |
898 | spin_lock(&res->spinlock); | 899 | __dlm_lockres_grab_inflight_ref(dlm, res); |
899 | dlm_lockres_grab_inflight_ref(dlm, res); | ||
900 | spin_unlock(&res->spinlock); | ||
901 | 900 | ||
902 | /* get an extra ref on the mle in case this is a BLOCK | 901 | /* get an extra ref on the mle in case this is a BLOCK |
903 | * if so, the creator of the BLOCK may try to put the last | 902 | * if so, the creator of the BLOCK may try to put the last |
@@ -2037,6 +2036,10 @@ kill: | |||
2037 | "and killing the other node now! This node is OK and can continue.\n"); | 2036 | "and killing the other node now! This node is OK and can continue.\n"); |
2038 | __dlm_print_one_lock_resource(res); | 2037 | __dlm_print_one_lock_resource(res); |
2039 | spin_unlock(&res->spinlock); | 2038 | spin_unlock(&res->spinlock); |
2039 | spin_lock(&dlm->master_lock); | ||
2040 | if (mle) | ||
2041 | __dlm_put_mle(mle); | ||
2042 | spin_unlock(&dlm->master_lock); | ||
2040 | spin_unlock(&dlm->spinlock); | 2043 | spin_unlock(&dlm->spinlock); |
2041 | *ret_data = (void *)res; | 2044 | *ret_data = (void *)res; |
2042 | dlm_put(dlm); | 2045 | dlm_put(dlm); |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 45067faf5695..3365839d2971 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1710,9 +1710,12 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1710 | BUG(); | 1710 | BUG(); |
1711 | } else | 1711 | } else |
1712 | __dlm_lockres_grab_inflight_worker(dlm, res); | 1712 | __dlm_lockres_grab_inflight_worker(dlm, res); |
1713 | } else /* put.. incase we are not the master */ | 1713 | spin_unlock(&res->spinlock); |
1714 | } else { | ||
1715 | /* put.. incase we are not the master */ | ||
1716 | spin_unlock(&res->spinlock); | ||
1714 | dlm_lockres_put(res); | 1717 | dlm_lockres_put(res); |
1715 | spin_unlock(&res->spinlock); | 1718 | } |
1716 | } | 1719 | } |
1717 | spin_unlock(&dlm->spinlock); | 1720 | spin_unlock(&dlm->spinlock); |
1718 | 1721 | ||
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 52cfe99ae056..21262f2b1654 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -2892,37 +2892,24 @@ static int ocfs2_dlm_debug_release(struct inode *inode, struct file *file) | |||
2892 | 2892 | ||
2893 | static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file) | 2893 | static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file) |
2894 | { | 2894 | { |
2895 | int ret; | ||
2896 | struct ocfs2_dlm_seq_priv *priv; | 2895 | struct ocfs2_dlm_seq_priv *priv; |
2897 | struct seq_file *seq; | ||
2898 | struct ocfs2_super *osb; | 2896 | struct ocfs2_super *osb; |
2899 | 2897 | ||
2900 | priv = kzalloc(sizeof(struct ocfs2_dlm_seq_priv), GFP_KERNEL); | 2898 | priv = __seq_open_private(file, &ocfs2_dlm_seq_ops, sizeof(*priv)); |
2901 | if (!priv) { | 2899 | if (!priv) { |
2902 | ret = -ENOMEM; | 2900 | mlog_errno(-ENOMEM); |
2903 | mlog_errno(ret); | 2901 | return -ENOMEM; |
2904 | goto out; | ||
2905 | } | 2902 | } |
2903 | |||
2906 | osb = inode->i_private; | 2904 | osb = inode->i_private; |
2907 | ocfs2_get_dlm_debug(osb->osb_dlm_debug); | 2905 | ocfs2_get_dlm_debug(osb->osb_dlm_debug); |
2908 | priv->p_dlm_debug = osb->osb_dlm_debug; | 2906 | priv->p_dlm_debug = osb->osb_dlm_debug; |
2909 | INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list); | 2907 | INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list); |
2910 | 2908 | ||
2911 | ret = seq_open(file, &ocfs2_dlm_seq_ops); | ||
2912 | if (ret) { | ||
2913 | kfree(priv); | ||
2914 | mlog_errno(ret); | ||
2915 | goto out; | ||
2916 | } | ||
2917 | |||
2918 | seq = file->private_data; | ||
2919 | seq->private = priv; | ||
2920 | |||
2921 | ocfs2_add_lockres_tracking(&priv->p_iter_res, | 2909 | ocfs2_add_lockres_tracking(&priv->p_iter_res, |
2922 | priv->p_dlm_debug); | 2910 | priv->p_dlm_debug); |
2923 | 2911 | ||
2924 | out: | 2912 | return 0; |
2925 | return ret; | ||
2926 | } | 2913 | } |
2927 | 2914 | ||
2928 | static const struct file_operations ocfs2_dlm_debug_fops = { | 2915 | static const struct file_operations ocfs2_dlm_debug_fops = { |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index f39482ee22f0..324dc93ac896 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -760,7 +760,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
760 | struct address_space *mapping = inode->i_mapping; | 760 | struct address_space *mapping = inode->i_mapping; |
761 | struct page *page; | 761 | struct page *page; |
762 | unsigned long index = abs_from >> PAGE_CACHE_SHIFT; | 762 | unsigned long index = abs_from >> PAGE_CACHE_SHIFT; |
763 | handle_t *handle = NULL; | 763 | handle_t *handle; |
764 | int ret = 0; | 764 | int ret = 0; |
765 | unsigned zero_from, zero_to, block_start, block_end; | 765 | unsigned zero_from, zero_to, block_start, block_end; |
766 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; | 766 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; |
@@ -769,11 +769,17 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
769 | BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT)); | 769 | BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT)); |
770 | BUG_ON(abs_from & (inode->i_blkbits - 1)); | 770 | BUG_ON(abs_from & (inode->i_blkbits - 1)); |
771 | 771 | ||
772 | handle = ocfs2_zero_start_ordered_transaction(inode, di_bh); | ||
773 | if (IS_ERR(handle)) { | ||
774 | ret = PTR_ERR(handle); | ||
775 | goto out; | ||
776 | } | ||
777 | |||
772 | page = find_or_create_page(mapping, index, GFP_NOFS); | 778 | page = find_or_create_page(mapping, index, GFP_NOFS); |
773 | if (!page) { | 779 | if (!page) { |
774 | ret = -ENOMEM; | 780 | ret = -ENOMEM; |
775 | mlog_errno(ret); | 781 | mlog_errno(ret); |
776 | goto out; | 782 | goto out_commit_trans; |
777 | } | 783 | } |
778 | 784 | ||
779 | /* Get the offsets within the page that we want to zero */ | 785 | /* Get the offsets within the page that we want to zero */ |
@@ -805,15 +811,6 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
805 | goto out_unlock; | 811 | goto out_unlock; |
806 | } | 812 | } |
807 | 813 | ||
808 | if (!handle) { | ||
809 | handle = ocfs2_zero_start_ordered_transaction(inode, | ||
810 | di_bh); | ||
811 | if (IS_ERR(handle)) { | ||
812 | ret = PTR_ERR(handle); | ||
813 | handle = NULL; | ||
814 | break; | ||
815 | } | ||
816 | } | ||
817 | 814 | ||
818 | /* must not update i_size! */ | 815 | /* must not update i_size! */ |
819 | ret = block_commit_write(page, block_start + 1, | 816 | ret = block_commit_write(page, block_start + 1, |
@@ -824,27 +821,29 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
824 | ret = 0; | 821 | ret = 0; |
825 | } | 822 | } |
826 | 823 | ||
824 | /* | ||
825 | * fs-writeback will release the dirty pages without page lock | ||
826 | * whose offset are over inode size, the release happens at | ||
827 | * block_write_full_page(). | ||
828 | */ | ||
829 | i_size_write(inode, abs_to); | ||
830 | inode->i_blocks = ocfs2_inode_sector_count(inode); | ||
831 | di->i_size = cpu_to_le64((u64)i_size_read(inode)); | ||
832 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
833 | di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); | ||
834 | di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); | ||
835 | di->i_mtime_nsec = di->i_ctime_nsec; | ||
827 | if (handle) { | 836 | if (handle) { |
828 | /* | ||
829 | * fs-writeback will release the dirty pages without page lock | ||
830 | * whose offset are over inode size, the release happens at | ||
831 | * block_write_full_page(). | ||
832 | */ | ||
833 | i_size_write(inode, abs_to); | ||
834 | inode->i_blocks = ocfs2_inode_sector_count(inode); | ||
835 | di->i_size = cpu_to_le64((u64)i_size_read(inode)); | ||
836 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
837 | di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); | ||
838 | di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); | ||
839 | di->i_mtime_nsec = di->i_ctime_nsec; | ||
840 | ocfs2_journal_dirty(handle, di_bh); | 837 | ocfs2_journal_dirty(handle, di_bh); |
841 | ocfs2_update_inode_fsync_trans(handle, inode, 1); | 838 | ocfs2_update_inode_fsync_trans(handle, inode, 1); |
842 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | ||
843 | } | 839 | } |
844 | 840 | ||
845 | out_unlock: | 841 | out_unlock: |
846 | unlock_page(page); | 842 | unlock_page(page); |
847 | page_cache_release(page); | 843 | page_cache_release(page); |
844 | out_commit_trans: | ||
845 | if (handle) | ||
846 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | ||
848 | out: | 847 | out: |
849 | return ret; | 848 | return ret; |
850 | } | 849 | } |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index a6c991c0fc98..a9b76de46047 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -162,7 +162,7 @@ static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode) | |||
162 | { | 162 | { |
163 | int c_to_s_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits - 9; | 163 | int c_to_s_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits - 9; |
164 | 164 | ||
165 | return (blkcnt_t)(OCFS2_I(inode)->ip_clusters << c_to_s_bits); | 165 | return (blkcnt_t)OCFS2_I(inode)->ip_clusters << c_to_s_bits; |
166 | } | 166 | } |
167 | 167 | ||
168 | /* Validate that a bh contains a valid inode */ | 168 | /* Validate that a bh contains a valid inode */ |
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 6219aaadeb08..74caffeeee1d 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
@@ -404,7 +404,7 @@ static int ocfs2_find_victim_alloc_group(struct inode *inode, | |||
404 | * 'vict_blkno' was out of the valid range. | 404 | * 'vict_blkno' was out of the valid range. |
405 | */ | 405 | */ |
406 | if ((vict_blkno < le64_to_cpu(rec->c_blkno)) || | 406 | if ((vict_blkno < le64_to_cpu(rec->c_blkno)) || |
407 | (vict_blkno >= (le32_to_cpu(ac_dinode->id1.bitmap1.i_total) << | 407 | (vict_blkno >= ((u64)le32_to_cpu(ac_dinode->id1.bitmap1.i_total) << |
408 | bits_per_unit))) { | 408 | bits_per_unit))) { |
409 | ret = -EINVAL; | 409 | ret = -EINVAL; |
410 | goto out; | 410 | goto out; |
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 13a8537d8e8b..720aa389e0ea 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -591,7 +591,7 @@ static int ocfs2_control_release(struct inode *inode, struct file *file) | |||
591 | */ | 591 | */ |
592 | ocfs2_control_this_node = -1; | 592 | ocfs2_control_this_node = -1; |
593 | running_proto.pv_major = 0; | 593 | running_proto.pv_major = 0; |
594 | running_proto.pv_major = 0; | 594 | running_proto.pv_minor = 0; |
595 | } | 595 | } |
596 | 596 | ||
597 | out: | 597 | out: |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index aa35d6309b93..93c85bc745e1 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -2536,6 +2536,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb) | |||
2536 | kfree(osb->journal); | 2536 | kfree(osb->journal); |
2537 | kfree(osb->local_alloc_copy); | 2537 | kfree(osb->local_alloc_copy); |
2538 | kfree(osb->uuid_str); | 2538 | kfree(osb->uuid_str); |
2539 | kfree(osb->vol_label); | ||
2539 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); | 2540 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); |
2540 | memset(osb, 0, sizeof(struct ocfs2_super)); | 2541 | memset(osb, 0, sizeof(struct ocfs2_super)); |
2541 | } | 2542 | } |