Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
ocfs2/cluster: Make o2net connect messages KERN_NOTICE
ocfs2/dlm: Fix printing of lockname
ocfs2: Fix contiguousness check in ocfs2_try_to_merge_extent_map()
ocfs2/dlm: Remove BUG_ON in dlm recovery when freeing locks of a dead node
ocfs2: Plugs race between the dc thread and an unlock ast message
ocfs2: Remove overzealous BUG_ON during blocked lock processing
ocfs2: Do not downconvert if the lock level is already compatible
ocfs2: Prevent a livelock in dlmglue
ocfs2: Fix setting of OCFS2_LOCK_BLOCKED during bast
ocfs2: Use compat_ptr in reflink_arguments.
ocfs2/dlm: Handle EAGAIN for compatibility - v2
ocfs2: Add parenthesis to wrap the check for O_DIRECT.
ocfs2: Only bug out when page size is larger than cluster size.
ocfs2: Fix memory overflow in cow_by_page.
ocfs2/dlm: Print more messages during lock migration
ocfs2/dlm: Ignore LVBs of locks in the Blocked list
ocfs2/trivial: Remove trailing whitespaces
ocfs2: fix a misleading variable name
ocfs2: Sync max_inline_data_with_xattr from tools.
ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path

+284 -129
+2 -2
fs/ocfs2/aops.c
··· 599 599 return ret; 600 600 } 601 601 602 - /* 602 + /* 603 603 * ocfs2_dio_end_io is called by the dio core when a dio is finished. We're 604 604 * particularly interested in the aio/dio case. Like the core uses 605 605 * i_alloc_sem, we use the rw_lock DLM lock to protect io on one node from ··· 670 670 671 671 ret = blockdev_direct_IO_no_locking(rw, iocb, inode, 672 672 inode->i_sb->s_bdev, iov, offset, 673 - nr_segs, 673 + nr_segs, 674 674 ocfs2_direct_IO_get_blocks, 675 675 ocfs2_dio_end_io); 676 676
+1 -1
fs/ocfs2/buffer_head_io.c
··· 368 368 } 369 369 ocfs2_metadata_cache_io_unlock(ci); 370 370 371 - mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", 371 + mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", 372 372 (unsigned long long)block, nr, 373 373 ((flags & OCFS2_BH_IGNORE_CACHE) || ignore_cache) ? "no" : "yes", 374 374 flags);
+3 -3
fs/ocfs2/cluster/heartbeat.c
··· 78 78 79 79 unsigned int o2hb_dead_threshold = O2HB_DEFAULT_DEAD_THRESHOLD; 80 80 81 - /* Only sets a new threshold if there are no active regions. 81 + /* Only sets a new threshold if there are no active regions. 82 82 * 83 83 * No locking or otherwise interesting code is required for reading 84 84 * o2hb_dead_threshold as it can't change once regions are active and ··· 170 170 171 171 mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u " 172 172 "milliseconds\n", reg->hr_dev_name, 173 - jiffies_to_msecs(jiffies - reg->hr_last_timeout_start)); 173 + jiffies_to_msecs(jiffies - reg->hr_last_timeout_start)); 174 174 o2quo_disk_timeout(); 175 175 } 176 176 ··· 624 624 "seq %llu last %llu changed %u equal %u\n", 625 625 slot->ds_node_num, (long long)slot->ds_last_generation, 626 626 le32_to_cpu(hb_block->hb_cksum), 627 - (unsigned long long)le64_to_cpu(hb_block->hb_seq), 627 + (unsigned long long)le64_to_cpu(hb_block->hb_seq), 628 628 (unsigned long long)slot->ds_last_time, slot->ds_changed_samples, 629 629 slot->ds_equal_samples); 630 630
+5 -5
fs/ocfs2/cluster/tcp.c
··· 485 485 } 486 486 487 487 if (was_valid && !valid) { 488 - printk(KERN_INFO "o2net: no longer connected to " 488 + printk(KERN_NOTICE "o2net: no longer connected to " 489 489 SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); 490 490 o2net_complete_nodes_nsw(nn); 491 491 } ··· 493 493 if (!was_valid && valid) { 494 494 o2quo_conn_up(o2net_num_from_nn(nn)); 495 495 cancel_delayed_work(&nn->nn_connect_expired); 496 - printk(KERN_INFO "o2net: %s " SC_NODEF_FMT "\n", 496 + printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n", 497 497 o2nm_this_node() > sc->sc_node->nd_num ? 498 498 "connected to" : "accepted connection from", 499 499 SC_NODEF_ARGS(sc)); ··· 930 930 cond_resched(); 931 931 continue; 932 932 } 933 - mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 933 + mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 934 934 " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); 935 935 o2net_ensure_shutdown(nn, sc, 0); 936 936 break; ··· 1476 1476 1477 1477 do_gettimeofday(&now); 1478 1478 1479 - printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " 1479 + printk(KERN_NOTICE "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " 1480 1480 "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), 1481 1481 o2net_idle_timeout() / 1000, 1482 1482 o2net_idle_timeout() % 1000); 1483 1483 mlog(ML_NOTICE, "here are some times that might help debug the " 1484 1484 "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " 1485 1485 "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n", 1486 - sc->sc_tv_timer.tv_sec, (long) sc->sc_tv_timer.tv_usec, 1486 + sc->sc_tv_timer.tv_sec, (long) sc->sc_tv_timer.tv_usec, 1487 1487 now.tv_sec, (long) now.tv_usec, 1488 1488 sc->sc_tv_data_ready.tv_sec, (long) sc->sc_tv_data_ready.tv_usec, 1489 1489 sc->sc_tv_advance_start.tv_sec,
+2 -2
fs/ocfs2/cluster/tcp_internal.h
··· 32 32 * on their number */ 33 33 #define O2NET_QUORUM_DELAY_MS ((o2hb_dead_threshold + 2) * O2HB_REGION_TIMEOUT_MS) 34 34 35 - /* 35 + /* 36 36 * This version number represents quite a lot, unfortunately. It not 37 37 * only represents the raw network message protocol on the wire but also 38 - * locking semantics of the file system using the protocol. It should 38 + * locking semantics of the file system using the protocol. It should 39 39 * be somewhere else, I'm sure, but right now it isn't. 40 40 * 41 41 * With version 11, we separate out the filesystem locking portion. The
+1 -1
fs/ocfs2/dlm/dlmapi.h
··· 95 95 mlog(ML_ERROR, "dlm status = %s\n", dlm_errname((st))); \ 96 96 } while (0) 97 97 98 - #define DLM_LKSB_UNUSED1 0x01 98 + #define DLM_LKSB_UNUSED1 0x01 99 99 #define DLM_LKSB_PUT_LVB 0x02 100 100 #define DLM_LKSB_GET_LVB 0x04 101 101 #define DLM_LKSB_UNUSED2 0x08
+1 -1
fs/ocfs2/dlm/dlmast.c
··· 123 123 dlm_lock_put(lock); 124 124 /* free up the reserved bast that we are cancelling. 125 125 * guaranteed that this will not be the last reserved 126 - * ast because *both* an ast and a bast were reserved 126 + * ast because *both* an ast and a bast were reserved 127 127 * to get to this point. the res->spinlock will not be 128 128 * taken here */ 129 129 dlm_lockres_release_ast(dlm, res);
+1 -1
fs/ocfs2/dlm/dlmconvert.c
··· 396 396 /* instead of logging the same network error over 397 397 * and over, sleep here and wait for the heartbeat 398 398 * to notice the node is dead. times out after 5s. */ 399 - dlm_wait_for_node_death(dlm, res->owner, 399 + dlm_wait_for_node_death(dlm, res->owner, 400 400 DLM_NODE_DEATH_WAIT_MAX); 401 401 ret = DLM_RECOVERING; 402 402 mlog(0, "node %u died so returning DLM_RECOVERING "
+1 -1
fs/ocfs2/dlm/dlmdebug.c
··· 102 102 assert_spin_locked(&res->spinlock); 103 103 104 104 stringify_lockname(res->lockname.name, res->lockname.len, 105 - buf, sizeof(buf) - 1); 105 + buf, sizeof(buf)); 106 106 printk("lockres: %s, owner=%u, state=%u\n", 107 107 buf, res->owner, res->state); 108 108 printk(" last used: %lu, refcnt: %u, on purge list: %s\n",
+1 -1
fs/ocfs2/dlm/dlmdomain.c
··· 816 816 } 817 817 818 818 /* Once the dlm ctxt is marked as leaving then we don't want 819 - * to be put in someone's domain map. 819 + * to be put in someone's domain map. 820 820 * Also, explicitly disallow joining at certain troublesome 821 821 * times (ie. during recovery). */ 822 822 if (dlm && dlm->dlm_state != DLM_CTXT_LEAVING) {
+1 -1
fs/ocfs2/dlm/dlmlock.c
··· 269 269 } 270 270 dlm_revert_pending_lock(res, lock); 271 271 dlm_lock_put(lock); 272 - } else if (dlm_is_recovery_lock(res->lockname.name, 272 + } else if (dlm_is_recovery_lock(res->lockname.name, 273 273 res->lockname.len)) { 274 274 /* special case for the $RECOVERY lock. 275 275 * there will never be an AST delivered to put
+19 -19
fs/ocfs2/dlm/dlmmaster.c
··· 366 366 struct dlm_master_list_entry *mle; 367 367 368 368 assert_spin_locked(&dlm->spinlock); 369 - 369 + 370 370 list_for_each_entry(mle, &dlm->mle_hb_events, hb_events) { 371 371 if (node_up) 372 372 dlm_mle_node_up(dlm, mle, NULL, idx); ··· 833 833 __dlm_insert_mle(dlm, mle); 834 834 835 835 /* still holding the dlm spinlock, check the recovery map 836 - * to see if there are any nodes that still need to be 836 + * to see if there are any nodes that still need to be 837 837 * considered. these will not appear in the mle nodemap 838 838 * but they might own this lockres. wait on them. */ 839 839 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); ··· 883 883 msleep(500); 884 884 } 885 885 continue; 886 - } 886 + } 887 887 888 888 dlm_kick_recovery_thread(dlm); 889 889 msleep(1000); ··· 939 939 res->lockname.name, blocked); 940 940 if (++tries > 20) { 941 941 mlog(ML_ERROR, "%s:%.*s: spinning on " 942 - "dlm_wait_for_lock_mastery, blocked=%d\n", 943 - dlm->name, res->lockname.len, 942 + "dlm_wait_for_lock_mastery, blocked=%d\n", 943 + dlm->name, res->lockname.len, 944 944 res->lockname.name, blocked); 945 945 dlm_print_one_lock_resource(res); 946 946 dlm_print_one_mle(mle); ··· 1029 1029 ret = dlm_restart_lock_mastery(dlm, res, mle, *blocked); 1030 1030 b = (mle->type == DLM_MLE_BLOCK); 1031 1031 if ((*blocked && !b) || (!*blocked && b)) { 1032 - mlog(0, "%s:%.*s: status change: old=%d new=%d\n", 1032 + mlog(0, "%s:%.*s: status change: old=%d new=%d\n", 1033 1033 dlm->name, res->lockname.len, res->lockname.name, 1034 1034 *blocked, b); 1035 1035 *blocked = b; ··· 1602 1602 } 1603 1603 mlog(0, "%u is the owner of %.*s, cleaning everyone else\n", 1604 1604 dlm->node_num, res->lockname.len, res->lockname.name); 1605 - ret = dlm_dispatch_assert_master(dlm, res, 0, request->node_idx, 1605 + ret = dlm_dispatch_assert_master(dlm, res, 0, request->node_idx, 1606 1606 DLM_ASSERT_MASTER_MLE_CLEANUP); 1607 1607 if (ret < 0) { 1608 1608 mlog(ML_ERROR, "failed to dispatch assert master work\n"); ··· 1701 1701 1702 1702 if (r & DLM_ASSERT_RESPONSE_REASSERT) { 1703 1703 mlog(0, "%.*s: node %u create mles on other " 1704 - "nodes and requests a re-assert\n", 1704 + "nodes and requests a re-assert\n", 1705 1705 namelen, lockname, to); 1706 1706 reassert = 1; 1707 1707 } ··· 1812 1812 spin_unlock(&dlm->master_lock); 1813 1813 spin_unlock(&dlm->spinlock); 1814 1814 goto done; 1815 - } 1815 + } 1816 1816 } 1817 1817 } 1818 1818 spin_unlock(&dlm->master_lock); ··· 1883 1883 int extra_ref = 0; 1884 1884 int nn = -1; 1885 1885 int rr, err = 0; 1886 - 1886 + 1887 1887 spin_lock(&mle->spinlock); 1888 1888 if (mle->type == DLM_MLE_BLOCK || mle->type == DLM_MLE_MIGRATION) 1889 1889 extra_ref = 1; ··· 1891 1891 /* MASTER mle: if any bits set in the response map 1892 1892 * then the calling node needs to re-assert to clear 1893 1893 * up nodes that this node contacted */ 1894 - while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES, 1894 + while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES, 1895 1895 nn+1)) < O2NM_MAX_NODES) { 1896 1896 if (nn != dlm->node_num && nn != assert->node_idx) 1897 1897 master_request = 1; ··· 2002 2002 __dlm_print_one_lock_resource(res); 2003 2003 spin_unlock(&res->spinlock); 2004 2004 spin_unlock(&dlm->spinlock); 2005 - *ret_data = (void *)res; 2005 + *ret_data = (void *)res; 2006 2006 dlm_put(dlm); 2007 2007 return -EINVAL; 2008 2008 } ··· 2040 2040 item->u.am.request_from = request_from; 2041 2041 item->u.am.flags = flags; 2042 2042 2043 - if (ignore_higher) 2044 - mlog(0, "IGNORE HIGHER: %.*s\n", res->lockname.len, 2043 + if (ignore_higher) 2044 + mlog(0, "IGNORE HIGHER: %.*s\n", res->lockname.len, 2045 2045 res->lockname.name); 2046 - 2046 + 2047 2047 spin_lock(&dlm->work_lock); 2048 2048 list_add_tail(&item->list, &dlm->work_list); 2049 2049 spin_unlock(&dlm->work_lock); ··· 2133 2133 * think that $RECOVERY is currently mastered by a dead node. If so, 2134 2134 * we wait a short time to allow that node to get notified by its own 2135 2135 * heartbeat stack, then check again. All $RECOVERY lock resources 2136 - * mastered by dead nodes are purged when the hearbeat callback is 2136 + * mastered by dead nodes are purged when the hearbeat callback is 2137 2137 * fired, so we can know for sure that it is safe to continue once 2138 2138 * the node returns a live node or no node. */ 2139 2139 static int dlm_pre_master_reco_lockres(struct dlm_ctxt *dlm, ··· 2174 2174 ret = -EAGAIN; 2175 2175 } 2176 2176 spin_unlock(&dlm->spinlock); 2177 - mlog(0, "%s: reco lock master is %u\n", dlm->name, 2177 + mlog(0, "%s: reco lock master is %u\n", dlm->name, 2178 2178 master); 2179 2179 break; 2180 2180 } ··· 2602 2602 2603 2603 mlog(0, "%s:%.*s: timed out during migration\n", 2604 2604 dlm->name, res->lockname.len, res->lockname.name); 2605 - /* avoid hang during shutdown when migrating lockres 2605 + /* avoid hang during shutdown when migrating lockres 2606 2606 * to a node which also goes down */ 2607 2607 if (dlm_is_node_dead(dlm, target)) { 2608 2608 mlog(0, "%s:%.*s: expected migration " ··· 2738 2738 can_proceed = !!(res->state & DLM_LOCK_RES_MIGRATING); 2739 2739 spin_unlock(&res->spinlock); 2740 2740 2741 - /* target has died, so make the caller break out of the 2741 + /* target has died, so make the caller break out of the 2742 2742 * wait_event, but caller must recheck the domain_map */ 2743 2743 spin_lock(&dlm->spinlock); 2744 2744 if (!test_bit(mig_target, dlm->domain_map))
+104 -43
fs/ocfs2/dlm/dlmrecovery.c
··· 1050 1050 if (lock->ml.node == dead_node) { 1051 1051 mlog(0, "AHA! there was " 1052 1052 "a $RECOVERY lock for dead " 1053 - "node %u (%s)!\n", 1053 + "node %u (%s)!\n", 1054 1054 dead_node, dlm->name); 1055 1055 list_del_init(&lock->list); 1056 1056 dlm_lock_put(lock); ··· 1164 1164 mres->master = master; 1165 1165 } 1166 1166 1167 + static void dlm_prepare_lvb_for_migration(struct dlm_lock *lock, 1168 + struct dlm_migratable_lockres *mres, 1169 + int queue) 1170 + { 1171 + if (!lock->lksb) 1172 + return; 1173 + 1174 + /* Ignore lvb in all locks in the blocked list */ 1175 + if (queue == DLM_BLOCKED_LIST) 1176 + return; 1177 + 1178 + /* Only consider lvbs in locks with granted EX or PR lock levels */ 1179 + if (lock->ml.type != LKM_EXMODE && lock->ml.type != LKM_PRMODE) 1180 + return; 1181 + 1182 + if (dlm_lvb_is_empty(mres->lvb)) { 1183 + memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN); 1184 + return; 1185 + } 1186 + 1187 + /* Ensure the lvb copied for migration matches in other valid locks */ 1188 + if (!memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN)) 1189 + return; 1190 + 1191 + mlog(ML_ERROR, "Mismatched lvb in lock cookie=%u:%llu, name=%.*s, " 1192 + "node=%u\n", 1193 + dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), 1194 + dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), 1195 + lock->lockres->lockname.len, lock->lockres->lockname.name, 1196 + lock->ml.node); 1197 + dlm_print_one_lock_resource(lock->lockres); 1198 + BUG(); 1199 + } 1167 1200 1168 1201 /* returns 1 if this lock fills the network structure, 1169 1202 * 0 otherwise */ ··· 1214 1181 ml->list = queue; 1215 1182 if (lock->lksb) { 1216 1183 ml->flags = lock->lksb->flags; 1217 - /* send our current lvb */ 1218 - if (ml->type == LKM_EXMODE || 1219 - ml->type == LKM_PRMODE) { 1220 - /* if it is already set, this had better be a PR 1221 - * and it has to match */ 1222 - if (!dlm_lvb_is_empty(mres->lvb) && 1223 - (ml->type == LKM_EXMODE || 1224 - memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN))) { 1225 - mlog(ML_ERROR, "mismatched lvbs!\n"); 1226 - dlm_print_one_lock_resource(lock->lockres); 1227 - BUG(); 1228 - } 1229 - memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN); 1230 - } 1184 + dlm_prepare_lvb_for_migration(lock, mres, queue); 1231 1185 } 1232 1186 ml->node = lock->ml.node; 1233 1187 mres->num_locks++; ··· 1750 1730 struct dlm_lock *lock = NULL; 1751 1731 u8 from = O2NM_MAX_NODES; 1752 1732 unsigned int added = 0; 1733 + __be64 c; 1753 1734 1754 1735 mlog(0, "running %d locks for this lockres\n", mres->num_locks); 1755 1736 for (i=0; i<mres->num_locks; i++) { ··· 1798 1777 /* lock is always created locally first, and 1799 1778 * destroyed locally last. it must be on the list */ 1800 1779 if (!lock) { 1801 - __be64 c = ml->cookie; 1802 - mlog(ML_ERROR, "could not find local lock " 1803 - "with cookie %u:%llu!\n", 1780 + c = ml->cookie; 1781 + mlog(ML_ERROR, "Could not find local lock " 1782 + "with cookie %u:%llu, node %u, " 1783 + "list %u, flags 0x%x, type %d, " 1784 + "conv %d, highest blocked %d\n", 1804 1785 dlm_get_lock_cookie_node(be64_to_cpu(c)), 1805 - dlm_get_lock_cookie_seq(be64_to_cpu(c))); 1786 + dlm_get_lock_cookie_seq(be64_to_cpu(c)), 1787 + ml->node, ml->list, ml->flags, ml->type, 1788 + ml->convert_type, ml->highest_blocked); 1806 1789 __dlm_print_one_lock_resource(res); 1807 1790 BUG(); 1808 1791 } 1809 - BUG_ON(lock->ml.node != ml->node); 1792 + 1793 + if (lock->ml.node != ml->node) { 1794 + c = lock->ml.cookie; 1795 + mlog(ML_ERROR, "Mismatched node# in lock " 1796 + "cookie %u:%llu, name %.*s, node %u\n", 1797 + dlm_get_lock_cookie_node(be64_to_cpu(c)), 1798 + dlm_get_lock_cookie_seq(be64_to_cpu(c)), 1799 + res->lockname.len, res->lockname.name, 1800 + lock->ml.node); 1801 + c = ml->cookie; 1802 + mlog(ML_ERROR, "Migrate lock cookie %u:%llu, " 1803 + "node %u, list %u, flags 0x%x, type %d, " 1804 + "conv %d, highest blocked %d\n", 1805 + dlm_get_lock_cookie_node(be64_to_cpu(c)), 1806 + dlm_get_lock_cookie_seq(be64_to_cpu(c)), 1807 + ml->node, ml->list, ml->flags, ml->type, 1808 + ml->convert_type, ml->highest_blocked); 1809 + __dlm_print_one_lock_resource(res); 1810 + BUG(); 1811 + } 1810 1812 1811 1813 if (tmpq != queue) { 1812 - mlog(0, "lock was on %u instead of %u for %.*s\n", 1813 - j, ml->list, res->lockname.len, res->lockname.name); 1814 + c = ml->cookie; 1815 + mlog(0, "Lock cookie %u:%llu was on list %u " 1816 + "instead of list %u for %.*s\n", 1817 + dlm_get_lock_cookie_node(be64_to_cpu(c)), 1818 + dlm_get_lock_cookie_seq(be64_to_cpu(c)), 1819 + j, ml->list, res->lockname.len, 1820 + res->lockname.name); 1821 + __dlm_print_one_lock_resource(res); 1814 1822 spin_unlock(&res->spinlock); 1815 1823 continue; 1816 1824 } ··· 1889 1839 * the lvb. */ 1890 1840 memcpy(res->lvb, mres->lvb, DLM_LVB_LEN); 1891 1841 } else { 1892 - /* otherwise, the node is sending its 1842 + /* otherwise, the node is sending its 1893 1843 * most recent valid lvb info */ 1894 1844 BUG_ON(ml->type != LKM_EXMODE && 1895 1845 ml->type != LKM_PRMODE); ··· 1936 1886 spin_lock(&res->spinlock); 1937 1887 list_for_each_entry(lock, queue, list) { 1938 1888 if (lock->ml.cookie == ml->cookie) { 1939 - __be64 c = lock->ml.cookie; 1889 + c = lock->ml.cookie; 1940 1890 mlog(ML_ERROR, "%s:%.*s: %u:%llu: lock already " 1941 1891 "exists on this lockres!\n", dlm->name, 1942 1892 res->lockname.len, res->lockname.name, ··· 2164 2114 assert_spin_locked(&res->spinlock); 2165 2115 2166 2116 if (res->owner == dlm->node_num) 2167 - /* if this node owned the lockres, and if the dead node 2117 + /* if this node owned the lockres, and if the dead node 2168 2118 * had an EX when he died, blank out the lvb */ 2169 2119 search_node = dead_node; 2170 2120 else { ··· 2202 2152 2203 2153 /* this node is the lockres master: 2204 2154 * 1) remove any stale locks for the dead node 2205 - * 2) if the dead node had an EX when he died, blank out the lvb 2155 + * 2) if the dead node had an EX when he died, blank out the lvb 2206 2156 */ 2207 2157 assert_spin_locked(&dlm->spinlock); 2208 2158 assert_spin_locked(&res->spinlock); ··· 2243 2193 mlog(0, "%s:%.*s: freed %u locks for dead node %u, " 2244 2194 "dropping ref from lockres\n", dlm->name, 2245 2195 res->lockname.len, res->lockname.name, freed, dead_node); 2246 - BUG_ON(!test_bit(dead_node, res->refmap)); 2196 + if(!test_bit(dead_node, res->refmap)) { 2197 + mlog(ML_ERROR, "%s:%.*s: freed %u locks for dead node %u, " 2198 + "but ref was not set\n", dlm->name, 2199 + res->lockname.len, res->lockname.name, freed, dead_node); 2200 + __dlm_print_one_lock_resource(res); 2201 + } 2247 2202 dlm_lockres_clear_refmap_bit(dead_node, res); 2248 2203 } else if (test_bit(dead_node, res->refmap)) { 2249 2204 mlog(0, "%s:%.*s: dead node %u had a ref, but had " ··· 2315 2260 } 2316 2261 spin_unlock(&res->spinlock); 2317 2262 continue; 2318 - } 2263 + } 2319 2264 spin_lock(&res->spinlock); 2320 2265 /* zero the lvb if necessary */ 2321 2266 dlm_revalidate_lvb(dlm, res, dead_node); ··· 2466 2411 * this function on each node racing to become the recovery 2467 2412 * master will not stop attempting this until either: 2468 2413 * a) this node gets the EX (and becomes the recovery master), 2469 - * or b) dlm->reco.new_master gets set to some nodenum 2414 + * or b) dlm->reco.new_master gets set to some nodenum 2470 2415 * != O2NM_INVALID_NODE_NUM (another node will do the reco). 2471 2416 * so each time a recovery master is needed, the entire cluster 2472 2417 * will sync at this point. if the new master dies, that will ··· 2479 2424 2480 2425 mlog(0, "starting recovery of %s at %lu, dead=%u, this=%u\n", 2481 2426 dlm->name, jiffies, dlm->reco.dead_node, dlm->node_num); 2482 - again: 2427 + again: 2483 2428 memset(&lksb, 0, sizeof(lksb)); 2484 2429 2485 2430 ret = dlmlock(dlm, LKM_EXMODE, &lksb, LKM_NOQUEUE|LKM_RECOVERY, ··· 2492 2437 if (ret == DLM_NORMAL) { 2493 2438 mlog(0, "dlm=%s dlmlock says I got it (this=%u)\n", 2494 2439 dlm->name, dlm->node_num); 2495 - 2496 - /* got the EX lock. check to see if another node 2440 + 2441 + /* got the EX lock. check to see if another node 2497 2442 * just became the reco master */ 2498 2443 if (dlm_reco_master_ready(dlm)) { 2499 2444 mlog(0, "%s: got reco EX lock, but %u will " ··· 2506 2451 /* see if recovery was already finished elsewhere */ 2507 2452 spin_lock(&dlm->spinlock); 2508 2453 if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) { 2509 - status = -EINVAL; 2454 + status = -EINVAL; 2510 2455 mlog(0, "%s: got reco EX lock, but " 2511 2456 "node got recovered already\n", dlm->name); 2512 2457 if (dlm->reco.new_master != O2NM_INVALID_NODE_NUM) { 2513 2458 mlog(ML_ERROR, "%s: new master is %u " 2514 - "but no dead node!\n", 2459 + "but no dead node!\n", 2515 2460 dlm->name, dlm->reco.new_master); 2516 2461 BUG(); 2517 2462 } ··· 2523 2468 * set the master and send the messages to begin recovery */ 2524 2469 if (!status) { 2525 2470 mlog(0, "%s: dead=%u, this=%u, sending " 2526 - "begin_reco now\n", dlm->name, 2471 + "begin_reco now\n", dlm->name, 2527 2472 dlm->reco.dead_node, dlm->node_num); 2528 2473 status = dlm_send_begin_reco_message(dlm, 2529 2474 dlm->reco.dead_node); ··· 2556 2501 mlog(0, "dlm=%s dlmlock says another node got it (this=%u)\n", 2557 2502 dlm->name, dlm->node_num); 2558 2503 /* another node is master. wait on 2559 - * reco.new_master != O2NM_INVALID_NODE_NUM 2504 + * reco.new_master != O2NM_INVALID_NODE_NUM 2560 2505 * for at most one second */ 2561 2506 wait_event_timeout(dlm->dlm_reco_thread_wq, 2562 2507 dlm_reco_master_ready(dlm), ··· 2644 2589 "begin reco msg (%d)\n", dlm->name, nodenum, ret); 2645 2590 ret = 0; 2646 2591 } 2647 - if (ret == -EAGAIN) { 2592 + 2593 + /* 2594 + * Prior to commit aad1b15310b9bcd59fa81ab8f2b1513b59553ea8, 2595 + * dlm_begin_reco_handler() returned EAGAIN and not -EAGAIN. 2596 + * We are handling both for compatibility reasons. 2597 + */ 2598 + if (ret == -EAGAIN || ret == EAGAIN) { 2648 2599 mlog(0, "%s: trying to start recovery of node " 2649 2600 "%u, but node %u is waiting for last recovery " 2650 2601 "to complete, backoff for a bit\n", dlm->name, ··· 2660 2599 } 2661 2600 if (ret < 0) { 2662 2601 struct dlm_lock_resource *res; 2663 - /* this is now a serious problem, possibly ENOMEM 2602 + /* this is now a serious problem, possibly ENOMEM 2664 2603 * in the network stack. must retry */ 2665 2604 mlog_errno(ret); 2666 2605 mlog(ML_ERROR, "begin reco of dlm %s to node %u " ··· 2673 2612 } else { 2674 2613 mlog(ML_ERROR, "recovery lock not found\n"); 2675 2614 } 2676 - /* sleep for a bit in hopes that we can avoid 2615 + /* sleep for a bit in hopes that we can avoid 2677 2616 * another ENOMEM */ 2678 2617 msleep(100); 2679 2618 goto retry; ··· 2725 2664 } 2726 2665 if (dlm->reco.dead_node != O2NM_INVALID_NODE_NUM) { 2727 2666 mlog(ML_NOTICE, "%s: dead_node previously set to %u, " 2728 - "node %u changing it to %u\n", dlm->name, 2667 + "node %u changing it to %u\n", dlm->name, 2729 2668 dlm->reco.dead_node, br->node_idx, br->dead_node); 2730 2669 } 2731 2670 dlm_set_reco_master(dlm, br->node_idx); ··· 2791 2730 if (ret < 0) { 2792 2731 mlog_errno(ret); 2793 2732 if (dlm_is_host_down(ret)) { 2794 - /* this has no effect on this recovery 2795 - * session, so set the status to zero to 2733 + /* this has no effect on this recovery 2734 + * session, so set the status to zero to 2796 2735 * finish out the last recovery */ 2797 2736 mlog(ML_ERROR, "node %u went down after this " 2798 2737 "node finished recovery.\n", nodenum); ··· 2829 2768 mlog(0, "%s: node %u finalizing recovery stage%d of " 2830 2769 "node %u (%u:%u)\n", dlm->name, fr->node_idx, stage, 2831 2770 fr->dead_node, dlm->reco.dead_node, dlm->reco.new_master); 2832 - 2771 + 2833 2772 spin_lock(&dlm->spinlock); 2834 2773 2835 2774 if (dlm->reco.new_master != fr->node_idx) {
+4 -4
fs/ocfs2/dlm/dlmunlock.c
··· 190 190 actions &= ~(DLM_UNLOCK_REMOVE_LOCK| 191 191 DLM_UNLOCK_REGRANT_LOCK| 192 192 DLM_UNLOCK_CLEAR_CONVERT_TYPE); 193 - } else if (status == DLM_RECOVERING || 194 - status == DLM_MIGRATING || 193 + } else if (status == DLM_RECOVERING || 194 + status == DLM_MIGRATING || 195 195 status == DLM_FORWARD) { 196 196 /* must clear the actions because this unlock 197 197 * is about to be retried. cannot free or do ··· 661 661 if (call_ast) { 662 662 mlog(0, "calling unlockast(%p, %d)\n", data, status); 663 663 if (is_master) { 664 - /* it is possible that there is one last bast 664 + /* it is possible that there is one last bast 665 665 * pending. make sure it is flushed, then 666 666 * call the unlockast. 667 667 * not an issue if this is a mastered remotely, 668 668 * since this lock has been removed from the 669 669 * lockres queues and cannot be found. */ 670 670 dlm_kick_thread(dlm, NULL); 671 - wait_event(dlm->ast_wq, 671 + wait_event(dlm->ast_wq, 672 672 dlm_lock_basts_flushed(dlm, lock)); 673 673 } 674 674 (*unlockast)(data, status);
+76 -9
fs/ocfs2/dlmglue.c
··· 875 875 lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH); 876 876 877 877 lockres->l_level = lockres->l_requested; 878 + 879 + /* 880 + * We set the OCFS2_LOCK_UPCONVERT_FINISHING flag before clearing 881 + * the OCFS2_LOCK_BUSY flag to prevent the dc thread from 882 + * downconverting the lock before the upconvert has fully completed. 883 + */ 884 + lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); 885 + 878 886 lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); 879 887 880 888 mlog_exit_void(); ··· 915 907 916 908 assert_spin_locked(&lockres->l_lock); 917 909 918 - lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); 919 - 920 910 if (level > lockres->l_blocking) { 921 911 /* only schedule a downconvert if we haven't already scheduled 922 912 * one that goes low enough to satisfy the level we're ··· 926 920 927 921 lockres->l_blocking = level; 928 922 } 923 + 924 + if (needs_downconvert) 925 + lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); 929 926 930 927 mlog_exit(needs_downconvert); 931 928 return needs_downconvert; ··· 1142 1133 mlog_entry_void(); 1143 1134 spin_lock_irqsave(&lockres->l_lock, flags); 1144 1135 lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); 1136 + lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); 1145 1137 if (convert) 1146 1138 lockres->l_action = OCFS2_AST_INVALID; 1147 1139 else ··· 1333 1323 again: 1334 1324 wait = 0; 1335 1325 1326 + spin_lock_irqsave(&lockres->l_lock, flags); 1327 + 1336 1328 if (catch_signals && signal_pending(current)) { 1337 1329 ret = -ERESTARTSYS; 1338 - goto out; 1330 + goto unlock; 1339 1331 } 1340 - 1341 - spin_lock_irqsave(&lockres->l_lock, flags); 1342 1332 1343 1333 mlog_bug_on_msg(lockres->l_flags & OCFS2_LOCK_FREEING, 1344 1334 "Cluster lock called on freeing lockres %s! flags " ··· 1354 1344 lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BUSY, 0); 1355 1345 wait = 1; 1356 1346 goto unlock; 1347 + } 1348 + 1349 + if (lockres->l_flags & OCFS2_LOCK_UPCONVERT_FINISHING) { 1350 + /* 1351 + * We've upconverted. If the lock now has a level we can 1352 + * work with, we take it. If, however, the lock is not at the 1353 + * required level, we go thru the full cycle. One way this could 1354 + * happen is if a process requesting an upconvert to PR is 1355 + * closely followed by another requesting upconvert to an EX. 1356 + * If the process requesting EX lands here, we want it to 1357 + * continue attempting to upconvert and let the process 1358 + * requesting PR take the lock. 1359 + * If multiple processes request upconvert to PR, the first one 1360 + * here will take the lock. The others will have to go thru the 1361 + * OCFS2_LOCK_BLOCKED check to ensure that there is no pending 1362 + * downconvert request. 1363 + */ 1364 + if (level <= lockres->l_level) 1365 + goto update_holders; 1357 1366 } 1358 1367 1359 1368 if (lockres->l_flags & OCFS2_LOCK_BLOCKED && ··· 1445 1416 goto again; 1446 1417 } 1447 1418 1419 + update_holders: 1448 1420 /* Ok, if we get here then we're good to go. */ 1449 1421 ocfs2_inc_holders(lockres, level); 1450 1422 1451 1423 ret = 0; 1452 1424 unlock: 1425 + lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); 1426 + 1453 1427 spin_unlock_irqrestore(&lockres->l_lock, flags); 1454 1428 out: 1455 1429 /* ··· 3187 3155 /* Mark the lockres as being dropped. It will no longer be 3188 3156 * queued if blocking, but we still may have to wait on it 3189 3157 * being dequeued from the downconvert thread before we can consider 3190 - * it safe to drop. 3158 + * it safe to drop. 3191 3159 * 3192 3160 * You can *not* attempt to call cluster_lock on this lockres anymore. */ 3193 3161 void ocfs2_mark_lockres_freeing(struct ocfs2_lock_res *lockres) ··· 3384 3352 unsigned long flags; 3385 3353 int blocking; 3386 3354 int new_level; 3355 + int level; 3387 3356 int ret = 0; 3388 3357 int set_lvb = 0; 3389 3358 unsigned int gen; ··· 3393 3360 3394 3361 spin_lock_irqsave(&lockres->l_lock, flags); 3395 3362 3396 - BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED)); 3397 - 3398 3363 recheck: 3364 + /* 3365 + * Is it still blocking? If not, we have no more work to do. 3366 + */ 3367 + if (!(lockres->l_flags & OCFS2_LOCK_BLOCKED)) { 3368 + BUG_ON(lockres->l_blocking != DLM_LOCK_NL); 3369 + spin_unlock_irqrestore(&lockres->l_lock, flags); 3370 + ret = 0; 3371 + goto leave; 3372 + } 3373 + 3399 3374 if (lockres->l_flags & OCFS2_LOCK_BUSY) { 3400 3375 /* XXX 3401 3376 * This is a *big* race. The OCFS2_LOCK_PENDING flag ··· 3439 3398 if (ret < 0) 3440 3399 mlog_errno(ret); 3441 3400 } 3401 + goto leave; 3402 + } 3403 + 3404 + /* 3405 + * This prevents livelocks. OCFS2_LOCK_UPCONVERT_FINISHING flag is 3406 + * set when the ast is received for an upconvert just before the 3407 + * OCFS2_LOCK_BUSY flag is cleared. Now if the fs received a bast 3408 + * on the heels of the ast, we want to delay the downconvert just 3409 + * enough to allow the up requestor to do its task. Because this 3410 + * lock is in the blocked queue, the lock will be downconverted 3411 + * as soon as the requestor is done with the lock. 3412 + */ 3413 + if (lockres->l_flags & OCFS2_LOCK_UPCONVERT_FINISHING) 3414 + goto leave_requeue; 3415 + 3416 + /* 3417 + * How can we block and yet be at NL? We were trying to upconvert 3418 + * from NL and got canceled. The code comes back here, and now 3419 + * we notice and clear BLOCKING. 3420 + */ 3421 + if (lockres->l_level == DLM_LOCK_NL) { 3422 + BUG_ON(lockres->l_ex_holders || lockres->l_ro_holders); 3423 + lockres->l_blocking = DLM_LOCK_NL; 3424 + lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED); 3425 + spin_unlock_irqrestore(&lockres->l_lock, flags); 3442 3426 goto leave; 3443 3427 } 3444 3428 ··· 3504 3438 * may sleep, so we save off a copy of what we're blocking as 3505 3439 * it may change while we're not holding the spin lock. */ 3506 3440 blocking = lockres->l_blocking; 3441 + level = lockres->l_level; 3507 3442 spin_unlock_irqrestore(&lockres->l_lock, flags); 3508 3443 3509 3444 ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking); ··· 3513 3446 goto leave; 3514 3447 3515 3448 spin_lock_irqsave(&lockres->l_lock, flags); 3516 - if (blocking != lockres->l_blocking) { 3449 + if ((blocking != lockres->l_blocking) || (level != lockres->l_level)) { 3517 3450 /* If this changed underneath us, then we can't drop 3518 3451 * it just yet. */ 3519 3452 goto recheck;
+1 -1
fs/ocfs2/export.c
··· 239 239 mlog(0, "Encoding parent: blkno: %llu, generation: %u\n", 240 240 (unsigned long long)blkno, generation); 241 241 } 242 - 242 + 243 243 *max_len = len; 244 244 245 245 bail:
+1 -1
fs/ocfs2/extent_map.c
··· 192 192 emi->ei_clusters += ins->ei_clusters; 193 193 return 1; 194 194 } else if ((ins->ei_phys + ins->ei_clusters) == emi->ei_phys && 195 - (ins->ei_cpos + ins->ei_clusters) == emi->ei_phys && 195 + (ins->ei_cpos + ins->ei_clusters) == emi->ei_cpos && 196 196 ins->ei_flags == emi->ei_flags) { 197 197 emi->ei_phys = ins->ei_phys; 198 198 emi->ei_cpos = ins->ei_cpos;
+9 -9
fs/ocfs2/file.c
··· 749 749 int ret; 750 750 751 751 offset = (size & (PAGE_CACHE_SIZE-1)); /* Within page */ 752 - /* ugh. in prepare/commit_write, if from==to==start of block, we 752 + /* ugh. in prepare/commit_write, if from==to==start of block, we 753 753 ** skip the prepare. make sure we never send an offset for the start 754 754 ** of a block 755 755 */ ··· 1779 1779 struct inode *inode = dentry->d_inode; 1780 1780 loff_t saved_pos, end; 1781 1781 1782 - /* 1782 + /* 1783 1783 * We start with a read level meta lock and only jump to an ex 1784 1784 * if we need to make modifications here. 1785 1785 */ ··· 2013 2013 /* buffered aio wouldn't have proper lock coverage today */ 2014 2014 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); 2015 2015 2016 - if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode) || 2017 - (file->f_flags & O_DIRECT && has_refcount)) { 2016 + if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || 2017 + ((file->f_flags & O_DIRECT) && has_refcount)) { 2018 2018 ret = filemap_fdatawrite_range(file->f_mapping, pos, 2019 2019 pos + count - 1); 2020 2020 if (ret < 0) ··· 2033 2033 pos + count - 1); 2034 2034 } 2035 2035 2036 - /* 2036 + /* 2037 2037 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io 2038 2038 * function pointer which is called when o_direct io completes so that 2039 2039 * it can unlock our rw lock. (it's the clustered equivalent of ··· 2198 2198 goto bail; 2199 2199 } 2200 2200 2201 - /* 2201 + /* 2202 2202 * buffered reads protect themselves in ->readpage(). O_DIRECT reads 2203 2203 * need locks to protect pending reads from racing with truncate. 2204 2204 */ ··· 2220 2220 * We're fine letting folks race truncates and extending 2221 2221 * writes with read across the cluster, just like they can 2222 2222 * locally. Hence no rw_lock during read. 2223 - * 2223 + * 2224 2224 * Take and drop the meta data lock to update inode fields 2225 2225 * like i_size. This allows the checks down below 2226 - * generic_file_aio_read() a chance of actually working. 2226 + * generic_file_aio_read() a chance of actually working. 2227 2227 */ 2228 2228 ret = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level); 2229 2229 if (ret < 0) { ··· 2248 2248 bail: 2249 2249 if (have_alloc_sem) 2250 2250 up_read(&inode->i_alloc_sem); 2251 - if (rw_level != -1) 2251 + if (rw_level != -1) 2252 2252 ocfs2_rw_unlock(inode, rw_level); 2253 2253 mlog_exit(ret); 2254 2254
+2 -2
fs/ocfs2/inode.c
··· 475 475 if (args->fi_flags & OCFS2_FI_FLAG_ORPHAN_RECOVERY) { 476 476 status = ocfs2_try_open_lock(inode, 0); 477 477 if (status) { 478 - make_bad_inode(inode); 478 + make_bad_inode(inode); 479 479 return status; 480 480 } 481 481 } ··· 684 684 return status; 685 685 } 686 686 687 - /* 687 + /* 688 688 * Serialize with orphan dir recovery. If the process doing 689 689 * recovery on this orphan dir does an iget() with the dir 690 690 * i_mutex held, we'll deadlock here. Instead we detect this
+13 -1
fs/ocfs2/ioctl.c
··· 7 7 8 8 #include <linux/fs.h> 9 9 #include <linux/mount.h> 10 + #include <linux/compat.h> 10 11 11 12 #define MLOG_MASK_PREFIX ML_INODE 12 13 #include <cluster/masklog.h> ··· 182 181 #ifdef CONFIG_COMPAT 183 182 long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) 184 183 { 184 + bool preserve; 185 + struct reflink_arguments args; 186 + struct inode *inode = file->f_path.dentry->d_inode; 187 + 185 188 switch (cmd) { 186 189 case OCFS2_IOC32_GETFLAGS: 187 190 cmd = OCFS2_IOC_GETFLAGS; ··· 200 195 case OCFS2_IOC_GROUP_EXTEND: 201 196 case OCFS2_IOC_GROUP_ADD: 202 197 case OCFS2_IOC_GROUP_ADD64: 203 - case OCFS2_IOC_REFLINK: 204 198 break; 199 + case OCFS2_IOC_REFLINK: 200 + if (copy_from_user(&args, (struct reflink_arguments *)arg, 201 + sizeof(args))) 202 + return -EFAULT; 203 + preserve = (args.preserve != 0); 204 + 205 + return ocfs2_reflink_ioctl(inode, compat_ptr(args.old_path), 206 + compat_ptr(args.new_path), preserve); 205 207 default: 206 208 return -ENOIOCTLCMD; 207 209 }
+1 -1
fs/ocfs2/journal.c
··· 2034 2034 status = -ENOENT; 2035 2035 mlog_errno(status); 2036 2036 return status; 2037 - } 2037 + } 2038 2038 2039 2039 mutex_lock(&orphan_dir_inode->i_mutex); 2040 2040 status = ocfs2_inode_lock(orphan_dir_inode, NULL, 0);
+4
fs/ocfs2/ocfs2.h
··· 136 136 #define OCFS2_LOCK_PENDING (0x00000400) /* This lockres is pending a 137 137 call to dlm_lock. Only 138 138 exists with BUSY set. */ 139 + #define OCFS2_LOCK_UPCONVERT_FINISHING (0x00000800) /* blocks the dc thread 140 + * from downconverting 141 + * before the upconvert 142 + * has completed */ 139 143 140 144 struct ocfs2_lock_res_ops; 141 145
+9 -2
fs/ocfs2/ocfs2_fs.h
··· 1417 1417 return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink); 1418 1418 } 1419 1419 1420 - static inline int ocfs2_max_inline_data(int blocksize) 1420 + static inline int ocfs2_max_inline_data_with_xattr(int blocksize, 1421 + struct ocfs2_dinode *di) 1421 1422 { 1422 - return blocksize - offsetof(struct ocfs2_dinode, id2.i_data.id_data); 1423 + if (di && (di->i_dyn_features & OCFS2_INLINE_XATTR_FL)) 1424 + return blocksize - 1425 + offsetof(struct ocfs2_dinode, id2.i_data.id_data) - 1426 + di->i_xattr_inline_size; 1427 + else 1428 + return blocksize - 1429 + offsetof(struct ocfs2_dinode, id2.i_data.id_data); 1423 1430 } 1424 1431 1425 1432 static inline int ocfs2_extent_recs_per_inode(int blocksize)
+8 -4
fs/ocfs2/refcounttree.c
··· 2945 2945 2946 2946 while (offset < end) { 2947 2947 page_index = offset >> PAGE_CACHE_SHIFT; 2948 - map_end = (page_index + 1) << PAGE_CACHE_SHIFT; 2948 + map_end = ((loff_t)page_index + 1) << PAGE_CACHE_SHIFT; 2949 2949 if (map_end > end) 2950 2950 map_end = end; 2951 2951 ··· 2957 2957 2958 2958 page = grab_cache_page(mapping, page_index); 2959 2959 2960 - /* This page can't be dirtied before we CoW it out. */ 2961 - BUG_ON(PageDirty(page)); 2960 + /* 2961 + * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page 2962 + * can't be dirtied before we CoW it out. 2963 + */ 2964 + if (PAGE_CACHE_SIZE <= OCFS2_SB(sb)->s_clustersize) 2965 + BUG_ON(PageDirty(page)); 2962 2966 2963 2967 if (!PageUptodate(page)) { 2964 2968 ret = block_read_full_page(page, ocfs2_get_block); ··· 3174 3170 3175 3171 while (offset < end) { 3176 3172 page_index = offset >> PAGE_CACHE_SHIFT; 3177 - map_end = (page_index + 1) << PAGE_CACHE_SHIFT; 3173 + map_end = ((loff_t)page_index + 1) << PAGE_CACHE_SHIFT; 3178 3174 if (map_end > end) 3179 3175 map_end = end; 3180 3176
+6 -6
fs/ocfs2/stack_o2cb.c
··· 277 277 u32 dlm_key; 278 278 struct dlm_ctxt *dlm; 279 279 struct o2dlm_private *priv; 280 - struct dlm_protocol_version dlm_version; 280 + struct dlm_protocol_version fs_version; 281 281 282 282 BUG_ON(conn == NULL); 283 283 BUG_ON(o2cb_stack.sp_proto == NULL); ··· 304 304 /* used by the dlm code to make message headers unique, each 305 305 * node in this domain must agree on this. */ 306 306 dlm_key = crc32_le(0, conn->cc_name, conn->cc_namelen); 307 - dlm_version.pv_major = conn->cc_version.pv_major; 308 - dlm_version.pv_minor = conn->cc_version.pv_minor; 307 + fs_version.pv_major = conn->cc_version.pv_major; 308 + fs_version.pv_minor = conn->cc_version.pv_minor; 309 309 310 - dlm = dlm_register_domain(conn->cc_name, dlm_key, &dlm_version); 310 + dlm = dlm_register_domain(conn->cc_name, dlm_key, &fs_version); 311 311 if (IS_ERR(dlm)) { 312 312 rc = PTR_ERR(dlm); 313 313 mlog_errno(rc); 314 314 goto out_free; 315 315 } 316 316 317 - conn->cc_version.pv_major = dlm_version.pv_major; 318 - conn->cc_version.pv_minor = dlm_version.pv_minor; 317 + conn->cc_version.pv_major = fs_version.pv_major; 318 + conn->cc_version.pv_minor = fs_version.pv_minor; 319 319 conn->cc_lockspace = dlm; 320 320 321 321 dlm_register_eviction_cb(dlm, &priv->op_eviction_cb);
+1 -1
fs/ocfs2/super.c
··· 1062 1062 "file system, but write access is " 1063 1063 "unavailable.\n"); 1064 1064 else 1065 - mlog_errno(status); 1065 + mlog_errno(status); 1066 1066 goto read_super_error; 1067 1067 } 1068 1068
+5 -5
fs/ocfs2/symlink.c
··· 137 137 } 138 138 139 139 memcpy(link, target, len); 140 - nd_set_link(nd, link); 141 140 142 141 bail: 142 + nd_set_link(nd, status ? ERR_PTR(status) : link); 143 143 brelse(bh); 144 144 145 145 mlog_exit(status); 146 - return status ? ERR_PTR(status) : link; 146 + return NULL; 147 147 } 148 148 149 149 static void ocfs2_fast_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) 150 150 { 151 - char *link = cookie; 152 - 153 - kfree(link); 151 + char *link = nd_get_link(nd); 152 + if (!IS_ERR(link)) 153 + kfree(link); 154 154 } 155 155 156 156 const struct inode_operations ocfs2_symlink_inode_operations = {
+2 -2
fs/ocfs2/uptodate.c
··· 267 267 } 268 268 269 269 /* Warning: even if it returns true, this does *not* guarantee that 270 - * the block is stored in our inode metadata cache. 271 - * 270 + * the block is stored in our inode metadata cache. 271 + * 272 272 * This can be called under lock_buffer() 273 273 */ 274 274 int ocfs2_buffer_uptodate(struct ocfs2_caching_info *ci,