Groupd uevent clean up
The following patch is designed to clean up a number of items relating to gfs_controld's handling of uevent notifications. When a uevent is received is consists of a number of strings whose total length is bounded by the buffer size and returned by the recv call.
Originally only the initial string was being used to select the various actions. That was wrong for various reasons, but mostly because its much easier to simply look for the individual fields, broken out from the message. The other reason that this is wrong, and also the reason that I started looking into this area initially is that the initial event string provides a "physical" view of the event. By using the SUBSYSTEM= field, we get the same information, but it can also be overridden by the kernel using the kset_uevent_ops which will become important when we merge the lock_dlm module into GFS2.
The other problem (unsolved here) is that we have to parse the fs name from the DEVPATH= variable. Its trivial to add a feature to the kernel to provide the LOCKTABLE as well, so I plan to do that in the future so we don't have to jump through hoops to get that information.
At the same time I've marked a bunch of variables const. Mainly because they started to throw up warnings after I'd added the new event parsing code.
I've tested the parsing code on its own, but since I don't have the right packages installed here, I've not had a chance to build & test a complete new groupd yet.
Also, I've fixed up some broken error handling in process_uevent at the same time.
group/gfs_controld/cpg-new.c +2 -2
@@ -2078,7 +2078,7 @@ static void apply_changes(struct mountgroup *mg)and then process the uevent/ipc upon receiving the message for it, so that it can be processed in the same order by all nodes. */ -void process_recovery_uevent (char *table) +void process_recovery_uevent (const char *table) {struct mountgroup *mg;struct journal *j;
@@ -2678,7 +2678,7 @@ static void leave_mountgroup(struct mountgroup *mg, int mnterr)log_error ("cpg_leave error %d" , error); } -void do_leave (char *table,int mnterr) +void do_leave (const char *table,int mnterr) {struct mountgroup *mg;char *name =strstr (table,":" ) +1 ;
group/gfs_controld/cpg-old.c +2 -2
@@ -1604,7 +1604,7 @@ static int need_kernel_recovery_done(struct mountgroup *mg)remain blocked until an rw node mounts, and the next mounter must be rw. */ -int process_recovery_uevent_old (char *table) +int process_recovery_uevent_old (const char *table) {struct mountgroup *mg;struct mg_member *memb;
@@ -1724,7 +1724,7 @@ static void leave_mountgroup(struct mountgroup *mg, int mnterr)group_leave (gh, mg->name); } -void do_leave_old (char *table,int mnterr) +void do_leave_old (const char *table,int mnterr) {struct mountgroup *mg;char *name =strstr (table,":" ) +1 ;
group/gfs_controld/gfs_daemon.h +5 -5
@@ -225,10 +225,10 @@ void process_cpg(int ci);int setup_dlmcontrol (void );void process_dlmcontrol (int ci);int set_protocol (void ); -void process_recovery_uevent (char *table); +void process_recovery_uevent (const char *table);void process_mountgroups (void );int gfs_join_mountgroup (struct mountgroup *mg); -void do_leave (char *table,int mnterr); +void do_leave (const char *table,int mnterr);void gfs_mount_done (struct mountgroup *mg);void send_remount (struct mountgroup *mg,struct gfsc_mount_args *ma);void send_withdraw (struct mountgroup *mg);
@@ -245,12 +245,12 @@ void close_cpg_old(void);void process_cpg_old (int ci);int gfs_join_mountgroup_old (struct mountgroup *mg,struct gfsc_mount_args *ma); -void do_leave_old (char *table,int mnterr); +void do_leave_old (const char *table,int mnterr);int send_group_message_old (struct mountgroup *mg,int len,char *buf);void save_message_old (struct mountgroup *mg,char *buf,int len,int from,int type);void send_withdraw_old (struct mountgroup *mg); -int process_recovery_uevent_old (char *table); +int process_recovery_uevent_old (const char *table);void ping_kernel_mount_old (char *table);void send_remount_old (struct mountgroup *mg,struct gfsc_mount_args *ma);void send_mount_status_old (struct mountgroup *mg);
@@ -282,7 +282,7 @@ int client_fd(int ci);void client_ignore (int ci,int fd);void client_back (int ci,int fd);struct mountgroup *create_mg (char *name); -struct mountgroup *find_mg (char *name); +struct mountgroup *find_mg (const char *name);struct mountgroup *find_mg_id (uint32_t id);void client_reply_remount (struct mountgroup *mg,int ci,int result);void client_reply_join (int ci,struct gfsc_mount_args *ma,int result);
group/gfs_controld/main.c +70 -99
219 lines not on this page · raw message
Quoted 21 lines · Steven Whitehouse
The following patch is designed to clean up a number of items relating to gfs_controld's handling of uevent notifications. When a uevent is received is consists of a number of strings whose total length is bounded by the buffer size and returned by the recv call.
Originally only the initial string was being used to select the various actions. That was wrong for various reasons, but mostly because its much easier to simply look for the individual fields, broken out from the message. The other reason that this is wrong, and also the reason that I started looking into this area initially is that the initial event string provides a "physical" view of the event. By using the SUBSYSTEM= field, we get the same information, but it can also be overridden by the kernel using the
kset_uevent_opswhich will become important when we merge thelock_dlmmodule into GFS2.The other problem (unsolved here) is that we have to parse the fs name from the DEVPATH= variable. Its trivial to add a feature to the kernel to provide the LOCKTABLE as well, so I plan to do that in the future so we don't have to jump through hoops to get that information.
Quoted 7 lines
At the same time I've marked a bunch of variables const. Mainly because they started to throw up warnings after I'd added the new event parsing code.
I've tested the parsing code on its own, but since I don't have the right packages installed here, I've not had a chance to build & test a complete new groupd yet.
OK, thanks, I dislike the const sprinkling, and I don't care about string parsing. I'll take your word that this string parsing is an improvement over what's there (I really dislike string parsing, previously get_args() was used for splitting args from other strings, too). All I know is that what's there works, so if you can verify that the new parsing really works I'll add it (or I can do a quick test if you resend a patch with just that bit).
Quoted 2 lines
Also, I've fixed up some broken error handling in
process_ueventat the same time.
Yep, good catch, I'll add that small bit right now.
Quoted 4 lines
+/* FIXME: All of the below functions call
find_mgas pretty much
+ * the first thing that they do. This ought to be done here and
+ * the found mg (if any) passed to the routines.
+ */
It didn't work out well last time I tried that, one of the main sticking points was that the "old" leave code needs to first look for the mg in a different list... once we get rid of the old code (post cluster3 split) we can try again.
Hi,
Quoted 26 lines · David Teigland
Quoted 25 lines · Steven Whitehouse
The following patch is designed to clean up a number of items relating to gfs_controld's handling of uevent notifications. When a uevent is received is consists of a number of strings whose total length is bounded by the buffer size and returned by the recv call.
Originally only the initial string was being used to select the various actions. That was wrong for various reasons, but mostly because its much easier to simply look for the individual fields, broken out from the message. The other reason that this is wrong, and also the reason that I started looking into this area initially is that the initial event string provides a "physical" view of the event. By using the SUBSYSTEM= field, we get the same information, but it can also be overridden by the kernel using the
kset_uevent_opswhich will become important when we merge thelock_dlmmodule into GFS2.The other problem (unsolved here) is that we have to parse the fs name from the DEVPATH= variable. Its trivial to add a feature to the kernel to provide the LOCKTABLE as well, so I plan to do that in the future so we don't have to jump through hoops to get that information.
At the same time I've marked a bunch of variables const. Mainly because they started to throw up warnings after I'd added the new event parsing code.
Quoted 5 lines
Quoted 3 lines
I've tested the parsing code on its own, but since I don't have the right packages installed here, I've not had a chance to build & test a complete new groupd yet.
OK, thanks, I dislike the const sprinkling, and I don't care about string
Whats wrong with adding the consts? It seems to make sense to mark the fsname as const since its just being used as a key for looking up the mg.
Quoted 7 lines
parsing. I'll take your word that this string parsing is an improvement over what's there (I really dislike string parsing, previously
get_args()was used for splitting args from other strings, too). All I know is that what's there works, so if you can verify that the new parsing really works I'll add it (or I can do a quick test if you resend a patch with just that bit).
The reason for changing the parsing is really that it was looking at the wrong string from the set of strings that uevent sends. It should be trivial to find the right bits, but for some reason, we didn't add the locktable to those variables. I hope to add that in the future, so that we might in time be able to avoid messing about chopping bits out of the DEVPATH= string in order to find the locktable.
My dev machine currently has a strange mix of F-9 and (old) rawhide packages on it, so that installing the required bits of openais to build isn't so easy. If you are able to run a quick test, that would be helpful otherwise, I'll look for another place to build it for testing.
Quoted 5 lines
Quoted 2 lines
Also, I've fixed up some broken error handling in
process_ueventat the same time.Yep, good catch, I'll add that small bit right now.
I've just noticed dlm_controld has this same bug,
Steve.
Quoted 4 lines · Steven Whitehouse
Quoted 1 line
OK, thanks, I dislike the const sprinkling, and I don't care about string
Whats wrong with adding the consts? It seems to make sense to mark the fsname as const since its just being used as a key for looking up the mg.
The PITA factor outweighs it's advantages, at least in the code I have to maintain myself.
Quoted 4 lines
My dev machine currently has a strange mix of F-9 and (old) rawhide packages on it, so that installing the required bits of openais to build isn't so easy. If you are able to run a quick test, that would be helpful otherwise, I'll look for another place to build it for testing.
I'll test a new patch that's limited to the parsing change.
Quoted 1 line
I've just noticed
dlm_controldhas this same bug,
Fixed that one too.
Hi,
Quoted 14 lines · David Teigland
Quoted 4 lines · Steven Whitehouse
Quoted 1 line
OK, thanks, I dislike the const sprinkling, and I don't care about string
Whats wrong with adding the consts? It seems to make sense to mark the fsname as const since its just being used as a key for looking up the mg.
The PITA factor outweighs it's advantages, at least in the code I have to maintain myself.
Quoted 4 lines
My dev machine currently has a strange mix of F-9 and (old) rawhide packages on it, so that installing the required bits of openais to build isn't so easy. If you are able to run a quick test, that would be helpful otherwise, I'll look for another place to build it for testing.
Quoted 6 lines
I'll test a new patch that's limited to the parsing change.
Quoted 1 line
I've just noticed
dlm_controldhas this same bug,Fixed that one too.
So I think this needs looking into some more... I've pushed patches to the tree which send more useful information with the uevents so that we can avoid reading the sysfs files in many cases, in future. Each uevent from gfs[2]/lock_dlm now includes:
LOCKTABLE=<clustername:fsname>
LOCKPROTO=[lock_dlm|lock_nolock]
to avoid all the messy parsing of the initial event string. Also I've added come further information to the two "change" events, so that we now have:
FIRSTMOUNT=Done
when the first mounter has finished and:
JID=<journal_id>
RECOVERY=[Done|Failed]
when recovery has finished. Is there anything else that is useful I wonder, while I'm adding new items here? I think I've covered the important bits anyway.
So I need to revise the initial patch a bit in order to take into account the new information,
Steve.
Quoted 9 lines · Steven Whitehouse
LOCKTABLE=<clustername:fsname>
LOCKPROTO=[lock_dlm|lock_nolock]to avoid all the messy parsing of the initial event string. Also I've added come further information to the two "change" events, so that we now have:
FIRSTMOUNT=Done
Quoted 8 lines
when the first mounter has finished and:
JID=<journal_id>
RECOVERY=[Done|Failed]when recovery has finished. Is there anything else that is useful I wonder, while I'm adding new items here? I think I've covered the important bits anyway.
That's excellent, much better than the sysfs files. We'll need to keep the sysfs files around for a while, though, so we don't break the user/kernel interface.
Dave
Hi,
Quoted 19 lines · David Teigland
Quoted 9 lines · Steven Whitehouse
LOCKTABLE=<clustername:fsname>
LOCKPROTO=[lock_dlm|lock_nolock]to avoid all the messy parsing of the initial event string. Also I've added come further information to the two "change" events, so that we now have:
FIRSTMOUNT=Done
Quoted 8 lines
when the first mounter has finished and:
JID=<journal_id>
RECOVERY=[Done|Failed]when recovery has finished. Is there anything else that is useful I wonder, while I'm adding new items here? I think I've covered the important bits anyway.
Quoted 6 lines
That's excellent, much better than the sysfs files. We'll need to keep the sysfs files around for a while, though, so we don't break the user/kernel interface.
Dave
We also need to change groupd and the reason that I didn't resend that original patch is that with these new bits of information, it might be better to implement something a bit more generic, so that it picks up all the right bits of information. Shouldn't be too tricky to keep it backwards compatible either,
Steve.