Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2:
ocfs2: Remove ->hangup() from stack glue operations.
ocfs2: Move the call of ocfs2_hb_ctl into the stack glue.
ocfs2: Move the hb_ctl_path sysctl into the stack glue.

+123 -137
+1 -73
fs/ocfs2/cluster/nodemanager.c
··· 21 21 22 22 #include <linux/kernel.h> 23 23 #include <linux/module.h> 24 - #include <linux/sysctl.h> 25 24 #include <linux/configfs.h> 26 25 27 26 #include "tcp.h" ··· 35 36 * cluster references throughout where nodes are looked up */ 36 37 struct o2nm_cluster *o2nm_single_cluster = NULL; 37 38 38 - #define OCFS2_MAX_HB_CTL_PATH 256 39 - static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; 40 - 41 - static ctl_table ocfs2_nm_table[] = { 42 - { 43 - .ctl_name = 1, 44 - .procname = "hb_ctl_path", 45 - .data = ocfs2_hb_ctl_path, 46 - .maxlen = OCFS2_MAX_HB_CTL_PATH, 47 - .mode = 0644, 48 - .proc_handler = &proc_dostring, 49 - .strategy = &sysctl_string, 50 - }, 51 - { .ctl_name = 0 } 52 - }; 53 - 54 - static ctl_table ocfs2_mod_table[] = { 55 - { 56 - .ctl_name = FS_OCFS2_NM, 57 - .procname = "nm", 58 - .data = NULL, 59 - .maxlen = 0, 60 - .mode = 0555, 61 - .child = ocfs2_nm_table 62 - }, 63 - { .ctl_name = 0} 64 - }; 65 - 66 - static ctl_table ocfs2_kern_table[] = { 67 - { 68 - .ctl_name = FS_OCFS2, 69 - .procname = "ocfs2", 70 - .data = NULL, 71 - .maxlen = 0, 72 - .mode = 0555, 73 - .child = ocfs2_mod_table 74 - }, 75 - { .ctl_name = 0} 76 - }; 77 - 78 - static ctl_table ocfs2_root_table[] = { 79 - { 80 - .ctl_name = CTL_FS, 81 - .procname = "fs", 82 - .data = NULL, 83 - .maxlen = 0, 84 - .mode = 0555, 85 - .child = ocfs2_kern_table 86 - }, 87 - { .ctl_name = 0 } 88 - }; 89 - 90 - static struct ctl_table_header *ocfs2_table_header = NULL; 91 - 92 - const char *o2nm_get_hb_ctl_path(void) 93 - { 94 - return ocfs2_hb_ctl_path; 95 - } 96 - EXPORT_SYMBOL_GPL(o2nm_get_hb_ctl_path); 97 39 98 40 struct o2nm_node *o2nm_get_node_by_num(u8 node_num) 99 41 { ··· 881 941 882 942 static void __exit exit_o2nm(void) 883 943 { 884 - if (ocfs2_table_header) 885 - unregister_sysctl_table(ocfs2_table_header); 886 - 887 944 /* XXX sync with hb callbacks and shut down hb? */ 888 945 o2net_unregister_hb_callbacks(); 889 946 configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys); ··· 901 964 if (ret) 902 965 goto out; 903 966 904 - ocfs2_table_header = register_sysctl_table(ocfs2_root_table); 905 - if (!ocfs2_table_header) { 906 - printk(KERN_ERR "nodemanager: unable to register sysctl\n"); 907 - ret = -ENOMEM; /* or something. */ 908 - goto out_o2net; 909 - } 910 - 911 967 ret = o2net_register_hb_callbacks(); 912 968 if (ret) 913 - goto out_sysctl; 969 + goto out_o2net; 914 970 915 971 config_group_init(&o2nm_cluster_group.cs_subsys.su_group); 916 972 mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex); ··· 920 990 configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys); 921 991 out_callbacks: 922 992 o2net_unregister_hb_callbacks(); 923 - out_sysctl: 924 - unregister_sysctl_table(ocfs2_table_header); 925 993 out_o2net: 926 994 o2net_exit(); 927 995 out:
-4
fs/ocfs2/cluster/nodemanager.h
··· 33 33 #include <linux/configfs.h> 34 34 #include <linux/rbtree.h> 35 35 36 - #define FS_OCFS2_NM 1 37 - 38 - const char *o2nm_get_hb_ctl_path(void); 39 - 40 36 struct o2nm_node { 41 37 spinlock_t nd_lock; 42 38 struct config_item nd_item;
+1 -40
fs/ocfs2/stack_o2cb.c
··· 317 317 return rc; 318 318 } 319 319 320 - static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn, 321 - int hangup_pending) 320 + static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn) 322 321 { 323 322 struct dlm_ctxt *dlm = conn->cc_lockspace; 324 323 struct o2dlm_private *priv = conn->cc_private; ··· 330 331 conn->cc_lockspace = NULL; 331 332 332 333 return 0; 333 - } 334 - 335 - static void o2hb_stop(const char *group) 336 - { 337 - int ret; 338 - char *argv[5], *envp[3]; 339 - 340 - argv[0] = (char *)o2nm_get_hb_ctl_path(); 341 - argv[1] = "-K"; 342 - argv[2] = "-u"; 343 - argv[3] = (char *)group; 344 - argv[4] = NULL; 345 - 346 - mlog(0, "Run: %s %s %s %s\n", argv[0], argv[1], argv[2], argv[3]); 347 - 348 - /* minimal command environment taken from cpu_run_sbin_hotplug */ 349 - envp[0] = "HOME=/"; 350 - envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; 351 - envp[2] = NULL; 352 - 353 - ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); 354 - if (ret < 0) 355 - mlog_errno(ret); 356 - } 357 - 358 - /* 359 - * Hangup is a hack for tools compatibility. Older ocfs2-tools software 360 - * expects the filesystem to call "ocfs2_hb_ctl" during unmount. This 361 - * happens regardless of whether the DLM got started, so we can't do it 362 - * in ocfs2_cluster_disconnect(). We bring the o2hb_stop() function into 363 - * the glue and provide a "hangup" API for super.c to call. 364 - * 365 - * Other stacks will eventually provide a NULL ->hangup() pointer. 366 - */ 367 - static void o2cb_cluster_hangup(const char *group, int grouplen) 368 - { 369 - o2hb_stop(group); 370 334 } 371 335 372 336 static int o2cb_cluster_this_node(unsigned int *node) ··· 350 388 static struct ocfs2_stack_operations o2cb_stack_ops = { 351 389 .connect = o2cb_cluster_connect, 352 390 .disconnect = o2cb_cluster_disconnect, 353 - .hangup = o2cb_cluster_hangup, 354 391 .this_node = o2cb_cluster_this_node, 355 392 .dlm_lock = o2cb_dlm_lock, 356 393 .dlm_unlock = o2cb_dlm_unlock,
+1 -2
fs/ocfs2/stack_user.c
··· 816 816 return rc; 817 817 } 818 818 819 - static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn, 820 - int hangup_pending) 819 + static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn) 821 820 { 822 821 dlm_release_lockspace(conn->cc_lockspace, 2); 823 822 conn->cc_lockspace = NULL;
+116 -3
fs/ocfs2/stackglue.c
··· 26 26 #include <linux/fs.h> 27 27 #include <linux/kobject.h> 28 28 #include <linux/sysfs.h> 29 + #include <linux/sysctl.h> 29 30 30 31 #include "ocfs2_fs.h" 31 32 ··· 34 33 35 34 #define OCFS2_STACK_PLUGIN_O2CB "o2cb" 36 35 #define OCFS2_STACK_PLUGIN_USER "user" 36 + #define OCFS2_MAX_HB_CTL_PATH 256 37 37 38 38 static struct ocfs2_locking_protocol *lproto; 39 39 static DEFINE_SPINLOCK(ocfs2_stack_lock); 40 40 static LIST_HEAD(ocfs2_stack_list); 41 41 static char cluster_stack_name[OCFS2_STACK_LABEL_LEN + 1]; 42 + static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; 42 43 43 44 /* 44 45 * The stack currently in use. If not null, active_stack->sp_count > 0, ··· 352 349 353 350 BUG_ON(conn == NULL); 354 351 355 - ret = active_stack->sp_ops->disconnect(conn, hangup_pending); 352 + ret = active_stack->sp_ops->disconnect(conn); 356 353 357 354 /* XXX Should we free it anyway? */ 358 355 if (!ret) { ··· 365 362 } 366 363 EXPORT_SYMBOL_GPL(ocfs2_cluster_disconnect); 367 364 365 + /* 366 + * Leave the group for this filesystem. This is executed by a userspace 367 + * program (stored in ocfs2_hb_ctl_path). 368 + */ 369 + static void ocfs2_leave_group(const char *group) 370 + { 371 + int ret; 372 + char *argv[5], *envp[3]; 373 + 374 + argv[0] = ocfs2_hb_ctl_path; 375 + argv[1] = "-K"; 376 + argv[2] = "-u"; 377 + argv[3] = (char *)group; 378 + argv[4] = NULL; 379 + 380 + /* minimal command environment taken from cpu_run_sbin_hotplug */ 381 + envp[0] = "HOME=/"; 382 + envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; 383 + envp[2] = NULL; 384 + 385 + ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); 386 + if (ret < 0) { 387 + printk(KERN_ERR 388 + "ocfs2: Error %d running user helper " 389 + "\"%s %s %s %s\"\n", 390 + ret, argv[0], argv[1], argv[2], argv[3]); 391 + } 392 + } 393 + 394 + /* 395 + * Hangup is a required post-umount. ocfs2-tools software expects the 396 + * filesystem to call "ocfs2_hb_ctl" during unmount. This happens 397 + * regardless of whether the DLM got started, so we can't do it 398 + * in ocfs2_cluster_disconnect(). The ocfs2_leave_group() function does 399 + * the actual work. 400 + */ 368 401 void ocfs2_cluster_hangup(const char *group, int grouplen) 369 402 { 370 403 BUG_ON(group == NULL); 371 404 BUG_ON(group[grouplen] != '\0'); 372 405 373 - if (active_stack->sp_ops->hangup) 374 - active_stack->sp_ops->hangup(group, grouplen); 406 + ocfs2_leave_group(group); 375 407 376 408 /* cluster_disconnect() was called with hangup_pending==1 */ 377 409 ocfs2_stack_driver_put(); ··· 586 548 return ret; 587 549 } 588 550 551 + /* 552 + * Sysctl bits 553 + * 554 + * The sysctl lives at /proc/sys/fs/ocfs2/nm/hb_ctl_path. The 'nm' doesn't 555 + * make as much sense in a multiple cluster stack world, but it's safer 556 + * and easier to preserve the name. 557 + */ 558 + 559 + #define FS_OCFS2_NM 1 560 + 561 + static ctl_table ocfs2_nm_table[] = { 562 + { 563 + .ctl_name = 1, 564 + .procname = "hb_ctl_path", 565 + .data = ocfs2_hb_ctl_path, 566 + .maxlen = OCFS2_MAX_HB_CTL_PATH, 567 + .mode = 0644, 568 + .proc_handler = &proc_dostring, 569 + .strategy = &sysctl_string, 570 + }, 571 + { .ctl_name = 0 } 572 + }; 573 + 574 + static ctl_table ocfs2_mod_table[] = { 575 + { 576 + .ctl_name = FS_OCFS2_NM, 577 + .procname = "nm", 578 + .data = NULL, 579 + .maxlen = 0, 580 + .mode = 0555, 581 + .child = ocfs2_nm_table 582 + }, 583 + { .ctl_name = 0} 584 + }; 585 + 586 + static ctl_table ocfs2_kern_table[] = { 587 + { 588 + .ctl_name = FS_OCFS2, 589 + .procname = "ocfs2", 590 + .data = NULL, 591 + .maxlen = 0, 592 + .mode = 0555, 593 + .child = ocfs2_mod_table 594 + }, 595 + { .ctl_name = 0} 596 + }; 597 + 598 + static ctl_table ocfs2_root_table[] = { 599 + { 600 + .ctl_name = CTL_FS, 601 + .procname = "fs", 602 + .data = NULL, 603 + .maxlen = 0, 604 + .mode = 0555, 605 + .child = ocfs2_kern_table 606 + }, 607 + { .ctl_name = 0 } 608 + }; 609 + 610 + static struct ctl_table_header *ocfs2_table_header = NULL; 611 + 612 + 613 + /* 614 + * Initialization 615 + */ 616 + 589 617 static int __init ocfs2_stack_glue_init(void) 590 618 { 591 619 strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); 620 + 621 + ocfs2_table_header = register_sysctl_table(ocfs2_root_table); 622 + if (!ocfs2_table_header) { 623 + printk(KERN_ERR 624 + "ocfs2 stack glue: unable to register sysctl\n"); 625 + return -ENOMEM; /* or something. */ 626 + } 592 627 593 628 return ocfs2_sysfs_init(); 594 629 } ··· 670 559 { 671 560 lproto = NULL; 672 561 ocfs2_sysfs_exit(); 562 + if (ocfs2_table_header) 563 + unregister_sysctl_table(ocfs2_table_header); 673 564 } 674 565 675 566 MODULE_AUTHOR("Oracle");
+4 -15
fs/ocfs2/stackglue.h
··· 134 134 * be freed. Thus, a stack must not return from ->disconnect() 135 135 * until it will no longer reference the conn pointer. 136 136 * 137 - * If hangup_pending is zero, ocfs2_cluster_disconnect() will also 138 - * be dropping the reference on the module. 137 + * Once this call returns, the stack glue will be dropping this 138 + * connection's reference on the module. 139 139 */ 140 - int (*disconnect)(struct ocfs2_cluster_connection *conn, 141 - int hangup_pending); 142 - 143 - /* 144 - * ocfs2_cluster_hangup() exists for compatibility with older 145 - * ocfs2 tools. Only the classic stack really needs it. As such 146 - * ->hangup() is not required of all stacks. See the comment by 147 - * ocfs2_cluster_hangup() for more details. 148 - * 149 - * Note that ocfs2_cluster_hangup() can only be called if 150 - * hangup_pending was passed to ocfs2_cluster_disconnect(). 151 - */ 152 - void (*hangup)(const char *group, int grouplen); 140 + int (*disconnect)(struct ocfs2_cluster_connection *conn); 153 141 154 142 /* 155 143 * ->this_node() returns the cluster's unique identifier for the ··· 246 258 /* Used by stack plugins */ 247 259 int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin); 248 260 void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin); 261 + 249 262 #endif /* STACKGLUE_H */