int slot_num, unsigned int node_num)
 {
        BUG_ON((slot_num < 0) || (slot_num >= si->si_num_slots));
-       BUG_ON((node_num == O2NM_INVALID_NODE_NUM) ||
-              (node_num >= O2NM_MAX_NODES));
 
        si->si_slots[slot_num].sl_valid = 1;
        si->si_slots[slot_num].sl_node_num = node_num;
 
 #include <linux/fs.h>
 
 #include "cluster/masklog.h"
+#include "cluster/nodemanager.h"
+
 #include "stackglue.h"
 
 static struct ocfs2_locking_protocol *lproto;
        return 0;
 }
 
+int ocfs2_cluster_this_node(unsigned int *node)
+{
+       int node_num;
+
+       node_num = o2nm_this_node();
+       if (node_num == O2NM_INVALID_NODE_NUM)
+               return -ENOENT;
+
+       if (node_num >= O2NM_MAX_NODES)
+               return -EOVERFLOW;
+
+       *node = node_num;
+       return 0;
+}
+
 void o2cb_get_stack(struct ocfs2_locking_protocol *proto)
 {
        BUG_ON(proto == NULL);
 
        if (ocfs2_mount_local(osb))
                snprintf(nodestr, sizeof(nodestr), "local");
        else
-               snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num);
+               snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num);
 
        printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %s, slot %d) "
               "with %s data mode.\n",
         * desirable. */
        if (ocfs2_mount_local(osb))
                osb->node_num = 0;
-       else
-               osb->node_num = o2nm_this_node();
-
-       if (osb->node_num == O2NM_MAX_NODES) {
-               mlog(ML_ERROR, "could not find this host's node number\n");
-               status = -ENOENT;
-               goto bail;
+       else {
+               status = ocfs2_cluster_this_node(&osb->node_num);
+               if (status < 0) {
+                       mlog_errno(status);
+                       mlog(ML_ERROR,
+                            "could not find this host's node number\n");
+                       goto bail;
+               }
        }
 
-       mlog(0, "I am node %d\n", osb->node_num);
+       mlog(0, "I am node %u\n", osb->node_num);
 
        status = 0;
 bail:
        if (ocfs2_mount_local(osb))
                snprintf(nodestr, sizeof(nodestr), "local");
        else
-               snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num);
+               snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num);
 
        printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %s)\n",
               osb->dev_str, nodestr);
 
        osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
 
-       osb->node_num = O2NM_INVALID_NODE_NUM;
        osb->slot_num = OCFS2_INVALID_SLOT;
 
        osb->local_alloc_state = OCFS2_LA_UNUSED;