ocfs2: local mounts

This allows users to format an ocfs2 file system with a special flag,
OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT. When the file system sees this flag, it
will not use any cluster services, nor will it require a cluster
configuration, thus acting like a 'local' file system.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>

authored by Sunil Mushran and committed by Mark Fasheh c271c5c2 c9976797

+193 -66
+59 -20
fs/ocfs2/dlmglue.c
··· 770 770 int dlm_flags) 771 771 { 772 772 int ret = 0; 773 - enum dlm_status status; 773 + enum dlm_status status = DLM_NORMAL; 774 774 unsigned long flags; 775 775 776 776 mlog_entry_void(); ··· 1138 1138 { 1139 1139 int status, level; 1140 1140 struct ocfs2_lock_res *lockres; 1141 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1141 1142 1142 1143 BUG_ON(!inode); 1143 1144 ··· 1147 1146 mlog(0, "inode %llu take %s RW lock\n", 1148 1147 (unsigned long long)OCFS2_I(inode)->ip_blkno, 1149 1148 write ? "EXMODE" : "PRMODE"); 1149 + 1150 + if (ocfs2_mount_local(osb)) 1151 + return 0; 1150 1152 1151 1153 lockres = &OCFS2_I(inode)->ip_rw_lockres; 1152 1154 ··· 1168 1164 { 1169 1165 int level = write ? LKM_EXMODE : LKM_PRMODE; 1170 1166 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; 1167 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1171 1168 1172 1169 mlog_entry_void(); 1173 1170 ··· 1176 1171 (unsigned long long)OCFS2_I(inode)->ip_blkno, 1177 1172 write ? "EXMODE" : "PRMODE"); 1178 1173 1179 - ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); 1174 + if (!ocfs2_mount_local(osb)) 1175 + ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); 1180 1176 1181 1177 mlog_exit_void(); 1182 1178 } ··· 1188 1182 { 1189 1183 int status = 0, level; 1190 1184 struct ocfs2_lock_res *lockres; 1185 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1191 1186 1192 1187 BUG_ON(!inode); 1193 1188 ··· 1207 1200 } 1208 1201 goto out; 1209 1202 } 1203 + 1204 + if (ocfs2_mount_local(osb)) 1205 + goto out; 1210 1206 1211 1207 lockres = &OCFS2_I(inode)->ip_data_lockres; 1212 1208 ··· 1279 1269 { 1280 1270 int level = write ? LKM_EXMODE : LKM_PRMODE; 1281 1271 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_data_lockres; 1272 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1282 1273 1283 1274 mlog_entry_void(); 1284 1275 ··· 1287 1276 (unsigned long long)OCFS2_I(inode)->ip_blkno, 1288 1277 write ? "EXMODE" : "PRMODE"); 1289 1278 1290 - if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) 1279 + if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && 1280 + !ocfs2_mount_local(osb)) 1291 1281 ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); 1292 1282 1293 1283 mlog_exit_void(); ··· 1479 1467 { 1480 1468 int status = 0; 1481 1469 struct ocfs2_inode_info *oi = OCFS2_I(inode); 1482 - struct ocfs2_lock_res *lockres; 1470 + struct ocfs2_lock_res *lockres = NULL; 1483 1471 struct ocfs2_dinode *fe; 1472 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1484 1473 1485 1474 mlog_entry_void(); 1486 1475 ··· 1496 1483 } 1497 1484 spin_unlock(&oi->ip_lock); 1498 1485 1499 - lockres = &oi->ip_meta_lockres; 1486 + if (!ocfs2_mount_local(osb)) { 1487 + lockres = &oi->ip_meta_lockres; 1500 1488 1501 - if (!ocfs2_should_refresh_lock_res(lockres)) 1502 - goto bail; 1489 + if (!ocfs2_should_refresh_lock_res(lockres)) 1490 + goto bail; 1491 + } 1503 1492 1504 1493 /* This will discard any caching information we might have had 1505 1494 * for the inode metadata. */ ··· 1511 1496 * map (directories, bitmap files, etc) */ 1512 1497 ocfs2_extent_map_trunc(inode, 0); 1513 1498 1514 - if (ocfs2_meta_lvb_is_trustable(inode, lockres)) { 1499 + if (lockres && ocfs2_meta_lvb_is_trustable(inode, lockres)) { 1515 1500 mlog(0, "Trusting LVB on inode %llu\n", 1516 1501 (unsigned long long)oi->ip_blkno); 1517 1502 ocfs2_refresh_inode_from_lvb(inode); ··· 1558 1543 1559 1544 status = 0; 1560 1545 bail_refresh: 1561 - ocfs2_complete_lock_res_refresh(lockres, status); 1546 + if (lockres) 1547 + ocfs2_complete_lock_res_refresh(lockres, status); 1562 1548 bail: 1563 1549 mlog_exit(status); 1564 1550 return status; ··· 1601 1585 int arg_flags) 1602 1586 { 1603 1587 int status, level, dlm_flags, acquired; 1604 - struct ocfs2_lock_res *lockres; 1588 + struct ocfs2_lock_res *lockres = NULL; 1605 1589 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1606 1590 struct buffer_head *local_bh = NULL; 1607 1591 ··· 1622 1606 status = -EROFS; 1623 1607 goto bail; 1624 1608 } 1609 + 1610 + if (ocfs2_mount_local(osb)) 1611 + goto local; 1625 1612 1626 1613 if (!(arg_flags & OCFS2_META_LOCK_RECOVERY)) 1627 1614 wait_event(osb->recovery_event, ··· 1655 1636 wait_event(osb->recovery_event, 1656 1637 ocfs2_node_map_is_empty(osb, &osb->recovery_map)); 1657 1638 1639 + local: 1658 1640 /* 1659 1641 * We only see this flag if we're being called from 1660 1642 * ocfs2_read_locked_inode(). It means we're locking an inode ··· 1664 1644 */ 1665 1645 if (inode->i_state & I_NEW) { 1666 1646 status = 0; 1667 - ocfs2_complete_lock_res_refresh(lockres, 0); 1647 + if (lockres) 1648 + ocfs2_complete_lock_res_refresh(lockres, 0); 1668 1649 goto bail; 1669 1650 } 1670 1651 ··· 1788 1767 { 1789 1768 int level = ex ? LKM_EXMODE : LKM_PRMODE; 1790 1769 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_meta_lockres; 1770 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1791 1771 1792 1772 mlog_entry_void(); 1793 1773 ··· 1796 1774 (unsigned long long)OCFS2_I(inode)->ip_blkno, 1797 1775 ex ? "EXMODE" : "PRMODE"); 1798 1776 1799 - if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) 1777 + if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && 1778 + !ocfs2_mount_local(osb)) 1800 1779 ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); 1801 1780 1802 1781 mlog_exit_void(); ··· 1806 1783 int ocfs2_super_lock(struct ocfs2_super *osb, 1807 1784 int ex) 1808 1785 { 1809 - int status; 1786 + int status = 0; 1810 1787 int level = ex ? LKM_EXMODE : LKM_PRMODE; 1811 1788 struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; 1812 1789 struct buffer_head *bh; ··· 1816 1793 1817 1794 if (ocfs2_is_hard_readonly(osb)) 1818 1795 return -EROFS; 1796 + 1797 + if (ocfs2_mount_local(osb)) 1798 + goto bail; 1819 1799 1820 1800 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); 1821 1801 if (status < 0) { ··· 1858 1832 int level = ex ? LKM_EXMODE : LKM_PRMODE; 1859 1833 struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; 1860 1834 1861 - ocfs2_cluster_unlock(osb, lockres, level); 1835 + if (!ocfs2_mount_local(osb)) 1836 + ocfs2_cluster_unlock(osb, lockres, level); 1862 1837 } 1863 1838 1864 1839 int ocfs2_rename_lock(struct ocfs2_super *osb) ··· 1869 1842 1870 1843 if (ocfs2_is_hard_readonly(osb)) 1871 1844 return -EROFS; 1845 + 1846 + if (ocfs2_mount_local(osb)) 1847 + return 0; 1872 1848 1873 1849 status = ocfs2_cluster_lock(osb, lockres, LKM_EXMODE, 0, 0); 1874 1850 if (status < 0) ··· 1884 1854 { 1885 1855 struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; 1886 1856 1887 - ocfs2_cluster_unlock(osb, lockres, LKM_EXMODE); 1857 + if (!ocfs2_mount_local(osb)) 1858 + ocfs2_cluster_unlock(osb, lockres, LKM_EXMODE); 1888 1859 } 1889 1860 1890 1861 int ocfs2_dentry_lock(struct dentry *dentry, int ex) ··· 1900 1869 if (ocfs2_is_hard_readonly(osb)) 1901 1870 return -EROFS; 1902 1871 1872 + if (ocfs2_mount_local(osb)) 1873 + return 0; 1874 + 1903 1875 ret = ocfs2_cluster_lock(osb, &dl->dl_lockres, level, 0, 0); 1904 1876 if (ret < 0) 1905 1877 mlog_errno(ret); ··· 1916 1882 struct ocfs2_dentry_lock *dl = dentry->d_fsdata; 1917 1883 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 1918 1884 1919 - ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); 1885 + if (!ocfs2_mount_local(osb)) 1886 + ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); 1920 1887 } 1921 1888 1922 1889 /* Reference counting of the dlm debug structure. We want this because ··· 2180 2145 2181 2146 int ocfs2_dlm_init(struct ocfs2_super *osb) 2182 2147 { 2183 - int status; 2148 + int status = 0; 2184 2149 u32 dlm_key; 2185 - struct dlm_ctxt *dlm; 2150 + struct dlm_ctxt *dlm = NULL; 2186 2151 2187 2152 mlog_entry_void(); 2153 + 2154 + if (ocfs2_mount_local(osb)) 2155 + goto local; 2188 2156 2189 2157 status = ocfs2_dlm_init_debug(osb); 2190 2158 if (status < 0) { ··· 2216 2178 goto bail; 2217 2179 } 2218 2180 2181 + dlm_register_eviction_cb(dlm, &osb->osb_eviction_cb); 2182 + 2183 + local: 2219 2184 ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb); 2220 2185 ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb); 2221 - 2222 - dlm_register_eviction_cb(dlm, &osb->osb_eviction_cb); 2223 2186 2224 2187 osb->dlm = dlm; 2225 2188
+9
fs/ocfs2/heartbeat.c
··· 154 154 { 155 155 int status; 156 156 157 + if (ocfs2_mount_local(osb)) 158 + return 0; 159 + 157 160 status = o2hb_register_callback(&osb->osb_hb_down); 158 161 if (status < 0) { 159 162 mlog_errno(status); ··· 175 172 { 176 173 int status; 177 174 175 + if (ocfs2_mount_local(osb)) 176 + return; 177 + 178 178 status = o2hb_unregister_callback(&osb->osb_hb_down); 179 179 if (status < 0) 180 180 mlog_errno(status); ··· 191 185 { 192 186 int ret; 193 187 char *argv[5], *envp[3]; 188 + 189 + if (ocfs2_mount_local(osb)) 190 + return; 194 191 195 192 if (!osb->uuid_str) { 196 193 /* This can happen if we don't get far enough in mount... */
+2 -1
fs/ocfs2/inode.c
··· 423 423 * cluster lock before trusting anything anyway. 424 424 */ 425 425 can_lock = !(args->fi_flags & OCFS2_FI_FLAG_SYSFILE) 426 - && !(args->fi_flags & OCFS2_FI_FLAG_NOLOCK); 426 + && !(args->fi_flags & OCFS2_FI_FLAG_NOLOCK) 427 + && !ocfs2_mount_local(osb); 427 428 428 429 /* 429 430 * To maintain backwards compatibility with older versions of
+33 -13
fs/ocfs2/journal.c
··· 144 144 ocfs2_abort(osb->sb, "Detected aborted journal"); 145 145 handle = ERR_PTR(-EROFS); 146 146 } 147 - } else 148 - atomic_inc(&(osb->journal->j_num_trans)); 147 + } else { 148 + if (!ocfs2_mount_local(osb)) 149 + atomic_inc(&(osb->journal->j_num_trans)); 150 + } 149 151 150 152 return handle; 151 153 } ··· 509 507 510 508 BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); 511 509 512 - status = ocfs2_journal_toggle_dirty(osb, 0); 513 - if (status < 0) 514 - mlog_errno(status); 510 + if (ocfs2_mount_local(osb)) { 511 + journal_lock_updates(journal->j_journal); 512 + status = journal_flush(journal->j_journal); 513 + journal_unlock_updates(journal->j_journal); 514 + if (status < 0) 515 + mlog_errno(status); 516 + } 517 + 518 + if (status == 0) { 519 + /* 520 + * Do not toggle if flush was unsuccessful otherwise 521 + * will leave dirty metadata in a "clean" journal 522 + */ 523 + status = ocfs2_journal_toggle_dirty(osb, 0); 524 + if (status < 0) 525 + mlog_errno(status); 526 + } 515 527 516 528 /* Shutdown the kernel journal system */ 517 529 journal_destroy(journal->j_journal); ··· 565 549 } 566 550 } 567 551 568 - int ocfs2_journal_load(struct ocfs2_journal *journal) 552 + int ocfs2_journal_load(struct ocfs2_journal *journal, int local) 569 553 { 570 554 int status = 0; 571 555 struct ocfs2_super *osb; ··· 592 576 } 593 577 594 578 /* Launch the commit thread */ 595 - osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt"); 596 - if (IS_ERR(osb->commit_task)) { 597 - status = PTR_ERR(osb->commit_task); 579 + if (!local) { 580 + osb->commit_task = kthread_run(ocfs2_commit_thread, osb, 581 + "ocfs2cmt"); 582 + if (IS_ERR(osb->commit_task)) { 583 + status = PTR_ERR(osb->commit_task); 584 + osb->commit_task = NULL; 585 + mlog(ML_ERROR, "unable to launch ocfs2commit thread, " 586 + "error=%d", status); 587 + goto done; 588 + } 589 + } else 598 590 osb->commit_task = NULL; 599 - mlog(ML_ERROR, "unable to launch ocfs2commit thread, error=%d", 600 - status); 601 - goto done; 602 - } 603 591 604 592 done: 605 593 mlog_exit(status);
+4 -1
fs/ocfs2/journal.h
··· 157 157 void ocfs2_journal_shutdown(struct ocfs2_super *osb); 158 158 int ocfs2_journal_wipe(struct ocfs2_journal *journal, 159 159 int full); 160 - int ocfs2_journal_load(struct ocfs2_journal *journal); 160 + int ocfs2_journal_load(struct ocfs2_journal *journal, int local); 161 161 int ocfs2_check_journals_nolocks(struct ocfs2_super *osb); 162 162 void ocfs2_recovery_thread(struct ocfs2_super *osb, 163 163 int node_num); ··· 173 173 static inline void ocfs2_checkpoint_inode(struct inode *inode) 174 174 { 175 175 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 176 + 177 + if (ocfs2_mount_local(osb)) 178 + return; 176 179 177 180 if (!ocfs2_inode_fully_checkpointed(inode)) { 178 181 /* WARNING: This only kicks off a single
+4 -2
fs/ocfs2/mmap.c
··· 83 83 int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) 84 84 { 85 85 int ret = 0, lock_level = 0; 86 + struct ocfs2_super *osb = OCFS2_SB(file->f_dentry->d_inode->i_sb); 86 87 87 88 /* We don't want to support shared writable mappings yet. */ 88 - if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) 89 - && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { 89 + if (!ocfs2_mount_local(osb) && 90 + ((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) && 91 + ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { 90 92 mlog(0, "disallow shared writable mmaps %lx\n", vma->vm_flags); 91 93 /* This is -EINVAL because generic_file_readonly_mmap 92 94 * returns it in a similar situation. */
+5 -3
fs/ocfs2/namei.c
··· 587 587 } 588 588 589 589 ocfs2_inode_set_new(osb, inode); 590 - status = ocfs2_create_new_inode_locks(inode); 591 - if (status < 0) 592 - mlog_errno(status); 590 + if (!ocfs2_mount_local(osb)) { 591 + status = ocfs2_create_new_inode_locks(inode); 592 + if (status < 0) 593 + mlog_errno(status); 594 + } 593 595 594 596 status = 0; /* error in ocfs2_create_new_inode_locks is not 595 597 * critical */
+5
fs/ocfs2/ocfs2.h
··· 349 349 return ret; 350 350 } 351 351 352 + static inline int ocfs2_mount_local(struct ocfs2_super *osb) 353 + { 354 + return (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT); 355 + } 356 + 352 357 #define OCFS2_IS_VALID_DINODE(ptr) \ 353 358 (!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE)) 354 359
+4 -1
fs/ocfs2/ocfs2_fs.h
··· 86 86 OCFS2_SB(sb)->s_feature_incompat &= ~(mask) 87 87 88 88 #define OCFS2_FEATURE_COMPAT_SUPP 0 89 - #define OCFS2_FEATURE_INCOMPAT_SUPP 0 89 + #define OCFS2_FEATURE_INCOMPAT_SUPP OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT 90 90 #define OCFS2_FEATURE_RO_COMPAT_SUPP 0 91 91 92 92 /* ··· 96 96 */ 97 97 #define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV 0x0002 98 98 99 + 100 + /* Used to denote a non-clustered volume */ 101 + #define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT 0x0008 99 102 100 103 /* 101 104 * Flags on ocfs2_dinode.i_flags
+65 -25
fs/ocfs2/super.c
··· 508 508 return status; 509 509 } 510 510 511 + static int ocfs2_verify_heartbeat(struct ocfs2_super *osb) 512 + { 513 + if (ocfs2_mount_local(osb)) { 514 + if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) { 515 + mlog(ML_ERROR, "Cannot heartbeat on a locally " 516 + "mounted device.\n"); 517 + return -EINVAL; 518 + } 519 + } 520 + 521 + if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) { 522 + if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb)) { 523 + mlog(ML_ERROR, "Heartbeat has to be started to mount " 524 + "a read-write clustered device.\n"); 525 + return -EINVAL; 526 + } 527 + } 528 + 529 + return 0; 530 + } 531 + 511 532 static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) 512 533 { 513 534 struct dentry *root; ··· 537 516 struct inode *inode = NULL; 538 517 struct ocfs2_super *osb = NULL; 539 518 struct buffer_head *bh = NULL; 519 + char nodestr[8]; 540 520 541 521 mlog_entry("%p, %p, %i", sb, data, silent); 542 522 543 - /* for now we only have one cluster/node, make sure we see it 544 - * in the heartbeat universe */ 545 - if (!o2hb_check_local_node_heartbeating()) { 523 + if (!ocfs2_parse_options(sb, data, &parsed_opt, 0)) { 546 524 status = -EINVAL; 547 525 goto read_super_error; 526 + } 527 + 528 + /* for now we only have one cluster/node, make sure we see it 529 + * in the heartbeat universe */ 530 + if (parsed_opt & OCFS2_MOUNT_HB_LOCAL) { 531 + if (!o2hb_check_local_node_heartbeating()) { 532 + status = -EINVAL; 533 + goto read_super_error; 534 + } 548 535 } 549 536 550 537 /* probe for superblock */ ··· 570 541 } 571 542 brelse(bh); 572 543 bh = NULL; 573 - 574 - if (!ocfs2_parse_options(sb, data, &parsed_opt, 0)) { 575 - status = -EINVAL; 576 - goto read_super_error; 577 - } 578 544 osb->s_mount_opt = parsed_opt; 579 545 580 546 sb->s_magic = OCFS2_SUPER_MAGIC; ··· 612 588 } 613 589 614 590 if (!ocfs2_is_hard_readonly(osb)) { 615 - /* If this isn't a hard readonly mount, then we need 616 - * to make sure that heartbeat is in a valid state, 617 - * and that we mark ourselves soft readonly is -oro 618 - * was specified. */ 619 - if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) { 620 - mlog(ML_ERROR, "No heartbeat for device (%s)\n", 621 - sb->s_id); 622 - status = -EINVAL; 623 - goto read_super_error; 624 - } 625 - 626 591 if (sb->s_flags & MS_RDONLY) 627 592 ocfs2_set_ro_flag(osb, 0); 593 + } 594 + 595 + status = ocfs2_verify_heartbeat(osb); 596 + if (status < 0) { 597 + mlog_errno(status); 598 + goto read_super_error; 628 599 } 629 600 630 601 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, ··· 654 635 655 636 ocfs2_complete_mount_recovery(osb); 656 637 657 - printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %d, slot %d) " 638 + if (ocfs2_mount_local(osb)) 639 + snprintf(nodestr, sizeof(nodestr), "local"); 640 + else 641 + snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num); 642 + 643 + printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %s, slot %d) " 658 644 "with %s data mode.\n", 659 - osb->dev_str, osb->node_num, osb->slot_num, 645 + osb->dev_str, nodestr, osb->slot_num, 660 646 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : 661 647 "ordered"); 662 648 ··· 1023 999 1024 1000 /* XXX hold a ref on the node while mounte? easy enough, if 1025 1001 * desirable. */ 1026 - osb->node_num = o2nm_this_node(); 1002 + if (ocfs2_mount_local(osb)) 1003 + osb->node_num = 0; 1004 + else 1005 + osb->node_num = o2nm_this_node(); 1006 + 1027 1007 if (osb->node_num == O2NM_MAX_NODES) { 1028 1008 mlog(ML_ERROR, "could not find this host's node number\n"); 1029 1009 status = -ENOENT; ··· 1112 1084 goto leave; 1113 1085 } 1114 1086 1087 + if (ocfs2_mount_local(osb)) 1088 + goto leave; 1089 + 1115 1090 /* This should be sent *after* we recovered our journal as it 1116 1091 * will cause other nodes to unmark us as needing 1117 1092 * recovery. However, we need to send it *before* dropping the ··· 1145 1114 { 1146 1115 int tmp; 1147 1116 struct ocfs2_super *osb = NULL; 1117 + char nodestr[8]; 1148 1118 1149 1119 mlog_entry("(0x%p)\n", sb); 1150 1120 ··· 1209 1177 1210 1178 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); 1211 1179 1212 - printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %d)\n", 1213 - osb->dev_str, osb->node_num); 1180 + if (ocfs2_mount_local(osb)) 1181 + snprintf(nodestr, sizeof(nodestr), "local"); 1182 + else 1183 + snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num); 1184 + 1185 + printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %s)\n", 1186 + osb->dev_str, nodestr); 1214 1187 1215 1188 ocfs2_delete_osb(osb); 1216 1189 kfree(osb); ··· 1573 1536 { 1574 1537 int status = 0; 1575 1538 int dirty; 1539 + int local; 1576 1540 struct ocfs2_dinode *local_alloc = NULL; /* only used if we 1577 1541 * recover 1578 1542 * ourselves. */ ··· 1601 1563 "recovering volume.\n"); 1602 1564 } 1603 1565 1566 + local = ocfs2_mount_local(osb); 1567 + 1604 1568 /* will play back anything left in the journal. */ 1605 - ocfs2_journal_load(osb->journal); 1569 + ocfs2_journal_load(osb->journal, local); 1606 1570 1607 1571 if (dirty) { 1608 1572 /* recover my local alloc if we didn't unmount cleanly. */
+3
fs/ocfs2/vote.c
··· 1000 1000 { 1001 1001 int status = 0; 1002 1002 1003 + if (ocfs2_mount_local(osb)) 1004 + return 0; 1005 + 1003 1006 status = o2net_register_handler(OCFS2_MESSAGE_TYPE_RESPONSE, 1004 1007 osb->net_key, 1005 1008 sizeof(struct ocfs2_response_msg),