gfs uevent and sysfs changes
Here are the compatibility aspects to the recent ideas about changes to the user/kernel interface between gfs (1 & 2) and gfs_controld.
. gfs_controld can remove id from hostdata string in mount options
- no compat issues AFAICT
. getting rid of "id" sysfs file from lock_dlm
- new gfs_controld old gfs-kernel
old kernel provides both "block" and "id" sysfs files new daemon looks for "block" instead of "id" in sysfs
- old gfs_controld new gfs-kernel
old daemon looks for "id" sysfs file
new kernel needs to provide "id" as well as "block" sysfs files
Once everyone is using the new daemon, we can remove the "id" sysfs file from the kernel.
. uevent strings to replace recover_done/recover_status sysfs files
- new gfs_controld old gfs-kernel
old kernel has recover sysfs files, and no new uevent strings new daemon needs to look for either sysfs files or uevent strings
- old gfs_controld new gfs-kernel
old daemon looks for recover sysfs files, not new uevent strings new kernel needs to provide both sysfs files and uevent strings
Once everyone is using new kernel and new daemon, we can remove the recover sysfs files from kernel, and daemon can stop looking for recover sysfs files.
Hi,
Quoted 26 lines · David Teigland
Here are the compatibility aspects to the recent ideas about changes to the user/kernel interface between gfs (1 & 2) and
gfs_controld..
gfs_controldcan remove id from hostdata string in mount options- no compat issues AFAICT
. getting rid of "id" sysfs file from
lock_dlm- new
gfs_controldold gfs-kernel
old kernel provides both "block" and "id" sysfs files new daemon looks for "block" instead of "id" in sysfs- old
gfs_controldnew gfs-kernel
old daemon looks for "id" sysfs file
new kernel needs to provide "id" as well as "block" sysfs filesOnce everyone is using the new daemon, we can remove the "id" sysfs file from the kernel.
. uevent strings to replace recover_done/recover_status sysfs files
- new
gfs_controldold gfs-kernel
old kernel has recover sysfs files, and no new uevent strings new daemon needs to look for either sysfs files or uevent strings
Quoted 9 lines
- old
gfs_controldnew gfs-kernel
old daemon looks for recover sysfs files, not new uevent strings new kernel needs to provide both sysfs files and uevent stringsOnce everyone is using new kernel and new daemon, we can remove the recover sysfs files from kernel, and daemon can stop looking for recover sysfs files.
So notwithstanding the fact that I've still not sorted out a proper build environment for groupd, I have created a new patch based on the above, which I think should address all the issues.
I've tested the decode_uevent() function separately and it appears to work well. With the sysfs files which we intend to eventually replace with the new uevent variables which apply to the "change" message only, I've introduced a system where "-1" means that we don't know the value since the uevent didn't tell us. We then fall back to reading sysfs in that case. It seems to work nicely since all the existing valid values of those variable are positive integers.
I think I've addressed all the points above, and this version seems a bit cleaner than the previous one, although there is still scope to do a bit more cleaning up at a later date,
Steve.
group/gfs_controld/cpg-new.c +23 -19
@@ -2078,30 +2078,33 @@ 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 (char *name,int jid,int recover_status, +int first_done) {struct mountgroup *mg;struct journal *j; -char *name =strstr (table,":" ) +1 ; -int jid, recover_status, first_done;int rv; mg =find_mg (name);if (!mg) { -log_error ("recovery_uevent mg not found %s" , table); +log_error ("recovery_uevent mg not found %s" , name);return ; } - rv =read_sysfs_int (mg,"recover_done" , &jid); -if (rv <0 ) { -log_error ("recovery_uevent recover_done read %d" , rv); -return ; +if (jid <0 ) { + rv =read_sysfs_int (mg,"recover_done" , &jid); +if (rv <0 ) { +log_error ("recovery_uevent recover_done read %d" , rv); +return ; + } } - rv =read_sysfs_int (mg,"recover_status" , &recover_status); -if (rv <0 ) { -log_error ("recovery_uevent recover_status read %d" , rv); -return ; +if (recover_status <0 ) { + rv =read_sysfs_int (mg,"recover_status" , &recover_status); +if (rv <0 ) { +log_error ("recovery_uevent recover_status read %d" , rv); +return ; + } }if (!mg->first_recovery_needed) {
@@ -2162,10 +2165,12 @@ void process_recovery_uevent(char *table)if (mg->first_done_uevent)return ; - rv =read_sysfs_int (mg,"first_done" , &first_done); -if (rv <0 ) { -log_error ("recovery_uevent first_done read %d" , rv); -return ; +if (first_done <0 ) { + rv =read_sysfs_int (mg,"first_done" , &first_done); +if (rv <0 ) { +log_error ("recovery_uevent first_done read %d" , rv); +return ; + } }if (first_done) {
@@ -2678,12 +2683,11 @@ 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 (char *name,int mnterr) {struct mountgroup *mg; -char *name =strstr (table,":" ) +1 ; -log_debug ("do_leave %s mnterr %d" , table, mnterr); +log_debug ("do_leave %s mnterr %d" , name, mnterr); mg =find_mg (name);if (!mg) {
group/gfs_controld/cpg-old.c +26 -22
89 lines not on this page · raw message
group/gfs_controld/gfs_daemon.h +4 -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 (char *name,int jid,int status,int first);void process_mountgroups (void );int gfs_join_mountgroup (struct mountgroup *mg); -void do_leave (char *table,int mnterr); +void do_leave (char *name,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,13 +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 (char *name,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); -void ping_kernel_mount_old (char *table); +int process_recovery_uevent_old (char *name,int jid,int status,int first);void send_remount_old (struct mountgroup *mg,struct gfsc_mount_args *ma);void send_mount_status_old (struct mountgroup *mg);int do_stop (struct mountgroup *mg);
group/gfs_controld/main.c +115 -93
268 lines not on this page · raw message
Quoted 4 lines · David Teigland
Here are the compatibility aspects to the recent ideas about changes to the user/kernel interface between gfs (1 & 2) and
gfs_controld..
gfs_controldcan remove id from hostdata string in mount options
hi david,
I know I'm a peripheral consumer of the cluster suite, but I thought I'd chime in and say that I am currently using the "id" as passed into the kernel in the hostdata string (I believe by mount.gfs2?) in my pNFS work. does the above "gfs_controld can remove id from hostdata string" comment refer to something orthogonal, or would it affect what gets stored in the superblock's hostdata at mount time?
..hm, sorry, I don't have the code right in front of me, but is that "id" in the hostdata string the same thing as the mountgroup id? if so, then my above worry about the hostdata string is moot, because if gfs_controld still has that info I can just make a downcall.
thanks,
d
.
Quoted 32 lines
- no compat issues AFAICT
. getting rid of "id" sysfs file from
lock_dlm- new
gfs_controldold gfs-kernel
old kernel provides both "block" and "id" sysfs files new daemon looks for "block" instead of "id" in sysfs- old
gfs_controldnew gfs-kernel
old daemon looks for "id" sysfs file
new kernel needs to provide "id" as well as "block" sysfs filesOnce everyone is using the new daemon, we can remove the "id" sysfs file from the kernel.
. uevent strings to replace recover_done/recover_status sysfs files
- new
gfs_controldold gfs-kernel
old kernel has recover sysfs files, and no new uevent strings new daemon needs to look for either sysfs files or uevent strings- old
gfs_controldnew gfs-kernel
old daemon looks for recover sysfs files, not new uevent strings new kernel needs to provide both sysfs files and uevent stringsOnce everyone is using new kernel and new daemon, we can remove the recover sysfs files from kernel, and daemon can stop looking for recover sysfs files.
Quoted 6 lines · david m. richter
Quoted 4 lines · David Teigland
Here are the compatibility aspects to the recent ideas about changes to the user/kernel interface between gfs (1 & 2) and
gfs_controld..
gfs_controldcan remove id from hostdata string in mount options
Quoted 8 lines
hi david,
I know I'm a peripheral consumer of the cluster suite, but I thought I'd chime in and say that I am currently using the "id" as passed into the kernel in the hostdata string (I believe by mount.gfs2?) in my pNFS work. does the above "
gfs_controldcan remove id from hostdata string" comment refer to something orthogonal, or would it affect what gets stored in the superblock's hostdata at mount time?
yes
Quoted 4 lines
..hm, sorry, I don't have the code right in front of me, but is that "id" in the hostdata string the same thing as the mountgroup id? if so, then my above worry about the hostdata string is moot, because if
gfs_controldstill has that info I can just make a downcall.
Yes, it's created in gfs_controld, and passed to mount.gfs via the hostdata string which is then passed into the kernel during mount(2).
Previously, gfs-kernel (lock_dlm actually) would pass this id back up to gfs_controld within the plock op structures. This was because plock ops for all gfs fs's were funnelled to gfs_controld through a single misc device. gfs_controld would match the op to a particular fs using the id.
The dlm does this now, using the lockspace id.
Dave
Quoted 18 lines · David Teigland
Quoted 6 lines · david m. richter
Quoted 4 lines · David Teigland
Here are the compatibility aspects to the recent ideas about changes to the user/kernel interface between gfs (1 & 2) and
gfs_controld..
gfs_controldcan remove id from hostdata string in mount optionsQuoted 8 lines
hi david,
I know I'm a peripheral consumer of the cluster suite, but I thought I'd chime in and say that I am currently using the "id" as passed into the kernel in the hostdata string (I believe by mount.gfs2?) in my pNFS work. does the above "
gfs_controldcan remove id from hostdata string" comment refer to something orthogonal, or would it affect what gets stored in the superblock's hostdata at mount time?yes
Quoted 7 lines
Quoted 4 lines
..hm, sorry, I don't have the code right in front of me, but is that "id" in the hostdata string the same thing as the mountgroup id? if so, then my above worry about the hostdata string is moot, because if
gfs_controldstill has that info I can just make a downcall.Yes, it's created in
gfs_controld, and passed to mount.gfs via the hostdata string which is then passed into the kernel during mount(2).
ah, so just to make sure i'm with you here: (1) gfs_controld is generating this "id"-which-is-the-mountgroup-id, and (2) gfs_kernel will no longer receive this in the hostdata string, so (3) i can just rip out my in-kernel hostdata-parsing gunk and instead send in the mountgroup id on my own (i have my own up/downcall channel)? if i've got it right, then everything's a cinch and i'll shut up :)
say, one tangential question (i won't be offended if you skip it - heh): is there a particular reason that you folks went with the uevent mechanism for doing upcalls? i'm just curious, given the seeming-complexity and possible overhead of using the whole layered netlink apparatus vs. something like Trond Myklebust's rpc_pipefs (don't let the "rpc" fool you; it's a barebones, dead-simple pipe). -- and no, i'm not selling anything :) my boss was asking for a list of differences between rpc_pipefs and uevents and the best i could come up with is the former's bidirectional. Trond mentioned the netlink overhead and i wondered if that was actually a significant factor or just lost in the noise in most cases.
thanks again,
d
.
Quoted 10 lines
Previously, gfs-kernel (
lock_dlmactually) would pass this id back up togfs_controldwithin the plock op structures. This was because plock ops for all gfs fs's were funnelled togfs_controldthrough a single misc device.gfs_controldwould match the op to a particular fs using the id.The dlm does this now, using the lockspace id.
Dave
Quoted 6 lines · david m. richter
ah, so just to make sure i'm with you here: (1)
gfs_controldis generating this "id"-which-is-the-mountgroup-id, and (2)gfs_kernelwill no longer receive this in the hostdata string, so (3) i can just rip out my in-kernel hostdata-parsing gunk and instead send in the mountgroup id on my own (i have my own up/downcall channel)? if i've got it right, then everything's a cinch and i'll shut up :)
Yep. Generally, the best way to uniquely identify and refer to a gfs filesystem is using the fsname string (specified during mkfs with -t and saved in the superblock). But, sometimes it's just a lot easier have a numerical identifier instead. I expect this is why you're using the id, and it's why we were using it for communicating about plocks.
In cluster1 and cluster2 the cluster infrastructure dynamically selected a unique id when needed, and it never worked great. In cluster3 the id is just a crc of the fsname string.
Now that I think about this a bit more, there may be a reason to keep the id in the string. There was some interest on linux-kernel about better using the statfs fsid field, and this id is what gfs should be putting there.
Quoted 11 lines
say, one tangential question (i won't be offended if you skip it - heh): is there a particular reason that you folks went with the uevent mechanism for doing upcalls? i'm just curious, given the seeming-complexity and possible overhead of using the whole layered netlink apparatus vs. something like Trond Myklebust's
rpc_pipefs(don't let the "rpc" fool you; it's a barebones, dead-simple pipe). -- and no, i'm not selling anything :) my boss was asking for a list of differences betweenrpc_pipefsand uevents and the best i could come up with is the former's bidirectional. Trond mentioned the netlink overhead and i wondered if that was actually a significant factor or just lost in the noise in most cases.
The uevents looked pretty simple when I was initially designing how the kernel/user interactions would work, and they fit well with sysfs files which I was using too. I don't think the overhead of using uevents is too bad. Sysfs files and uevents definately don't work great if you need any kind of sophisticated bi-directional interface.
Dave
Hi,
Quoted 14 lines · David Teigland
Quoted 6 lines · david m. richter
ah, so just to make sure i'm with you here: (1)
gfs_controldis generating this "id"-which-is-the-mountgroup-id, and (2)gfs_kernelwill no longer receive this in the hostdata string, so (3) i can just rip out my in-kernel hostdata-parsing gunk and instead send in the mountgroup id on my own (i have my own up/downcall channel)? if i've got it right, then everything's a cinch and i'll shut up :)Yep. Generally, the best way to uniquely identify and refer to a gfs filesystem is using the fsname string (specified during mkfs with -t and saved in the superblock). But, sometimes it's just a lot easier have a numerical identifier instead. I expect this is why you're using the id, and it's why we were using it for communicating about plocks.
Quoted 9 lines
In cluster1 and cluster2 the cluster infrastructure dynamically selected a unique id when needed, and it never worked great. In cluster3 the id is just a crc of the fsname string.
Now that I think about this a bit more, there may be a reason to keep the id in the string. There was some interest on linux-kernel about better using the statfs fsid field, and this id is what gfs should be putting there.
In that case gfs2 should be able to generate the id itself from the fsname and it still doesn't need it passed in, even if it continues to expose the id in sysfs.
Perhaps better still, it should be possible for David to generate the id directly if he really needs it from the fsname.
Since we also have a UUID now, for recently created filesystems, it might be worth exposing that via sysfs and/or uevents too.
Quoted 12 lines
Quoted 11 lines
say, one tangential question (i won't be offended if you skip it - heh): is there a particular reason that you folks went with the uevent mechanism for doing upcalls? i'm just curious, given the seeming-complexity and possible overhead of using the whole layered netlink apparatus vs. something like Trond Myklebust's
rpc_pipefs(don't let the "rpc" fool you; it's a barebones, dead-simple pipe). -- and no, i'm not selling anything :) my boss was asking for a list of differences betweenrpc_pipefsand uevents and the best i could come up with is the former's bidirectional. Trond mentioned the netlink overhead and i wondered if that was actually a significant factor or just lost in the noise in most cases.
Quoted 8 lines
The uevents looked pretty simple when I was initially designing how the kernel/user interactions would work, and they fit well with sysfs files which I was using too. I don't think the overhead of using uevents is too bad. Sysfs files and uevents definately don't work great if you need any kind of sophisticated bi-directional interface.
Dave
I think uevents are a reasonable choice as they are easy enough to parse that it could be done by scripts, etc and easy to extend as well. We do intend to use netlink in the future (bz #337691) for quota messages, but in that case we would be using an existing standard for sending those messages.
Netlink can be extended fairly easily, but you do have to be careful when designing the message format. I've not come across rpc_pipefs before, so I can't comment on that yet. I don't think we need to worry about overhead on sending the messages (if you have so much recovery message traffic that its a problem, you probably have bigger things to worry about!), and I don't see that netlink should have any more overhead than any other method of sending messages.
Steve.
Quoted 6 lines · Steven Whitehouse
In that case gfs2 should be able to generate the id itself from the fsname and it still doesn't need it passed in, even if it continues to expose the id in sysfs.
Perhaps better still, it should be possible for David to generate the id directly if he really needs it from the fsname.
It's not actually a crc of the fsname, but a crc of the cpg name gfs_controld creates for the mountgroup, which is "gfs:mount:<fsname>". Also, we may at some point want to allow that generated id to be overriden by one that's set explicitly.
Quoted 2 lines
worry about!), and I don't see that netlink should have any more overhead than any other method of sending messages.
netlink is painful compared to uevents, look at dlm_controld/netlink.c which uses the "generic netlink" interface to transfer a data structure from the kernel to userspace. A library would help, but there didn't seem to be a de facto netlink lib when I needed it, maybe that's changed.
Quoted 5 lines · David Teigland
Quoted 4 lines · Steven Whitehouse
In that case gfs2 should be able to generate the id itself from the fsname and it still doesn't need it passed in, even if it continues to expose the id in sysfs.
Quoted 7 lines
Quoted 2 lines
Perhaps better still, it should be possible for David to generate the id directly if he really needs it from the fsname.
It's not actually a crc of the fsname, but a crc of the cpg name
gfs_controldcreates for the mountgroup, which is "gfs:mount:<fsname>". Also, we may at some point want to allow that generated id to be overriden by one that's set explicitly.
The fact that this id comes from gfs_controld, and becomes available only during mount, makes me think it's not well suited to be the statfs fsid. GFS should probably do it's own thing for statfs (like a hash of just the fsname) instead of depending on gfs_controld for it. With nolock the daemons won't be there, and we'd still want the same fsid to be produced.
Quoted 62 lines · Steven Whitehouse
Hi,
Quoted 14 lines · David Teigland
Quoted 6 lines · david m. richter
ah, so just to make sure i'm with you here: (1)
gfs_controldis generating this "id"-which-is-the-mountgroup-id, and (2)gfs_kernelwill no longer receive this in the hostdata string, so (3) i can just rip out my in-kernel hostdata-parsing gunk and instead send in the mountgroup id on my own (i have my own up/downcall channel)? if i've got it right, then everything's a cinch and i'll shut up :)Yep. Generally, the best way to uniquely identify and refer to a gfs filesystem is using the fsname string (specified during mkfs with -t and saved in the superblock). But, sometimes it's just a lot easier have a numerical identifier instead. I expect this is why you're using the id, and it's why we were using it for communicating about plocks.
Quoted 9 lines
In cluster1 and cluster2 the cluster infrastructure dynamically selected a unique id when needed, and it never worked great. In cluster3 the id is just a crc of the fsname string.
Now that I think about this a bit more, there may be a reason to keep the id in the string. There was some interest on linux-kernel about better using the statfs fsid field, and this id is what gfs should be putting there.
In that case gfs2 should be able to generate the id itself from the fsname and it still doesn't need it passed in, even if it continues to expose the id in sysfs.
Perhaps better still, it should be possible for David to generate the id directly if he really needs it from the fsname.
Since we also have a UUID now, for recently created filesystems, it might be worth exposing that via sysfs and/or uevents too.
Quoted 12 lines
Quoted 11 lines
say, one tangential question (i won't be offended if you skip it - heh): is there a particular reason that you folks went with the uevent mechanism for doing upcalls? i'm just curious, given the seeming-complexity and possible overhead of using the whole layered netlink apparatus vs. something like Trond Myklebust's
rpc_pipefs(don't let the "rpc" fool you; it's a barebones, dead-simple pipe). -- and no, i'm not selling anything :) my boss was asking for a list of differences betweenrpc_pipefsand uevents and the best i could come up with is the former's bidirectional. Trond mentioned the netlink overhead and i wondered if that was actually a significant factor or just lost in the noise in most cases.Quoted 8 lines
The uevents looked pretty simple when I was initially designing how the kernel/user interactions would work, and they fit well with sysfs files which I was using too. I don't think the overhead of using uevents is too bad. Sysfs files and uevents definately don't work great if you need any kind of sophisticated bi-directional interface.
Dave
I think uevents are a reasonable choice as they are easy enough to parse that it could be done by scripts, etc and easy to extend as well. We do intend to use netlink in the future (bz #337691) for quota messages, but in that case we would be using an existing standard for sending those messages.
Quoted 7 lines
Netlink can be extended fairly easily, but you do have to be careful when designing the message format. I've not come across
rpc_pipefsbefore, so I can't comment on that yet. I don't think we need to worry about overhead on sending the messages (if you have so much recovery message traffic that its a problem, you probably have bigger things to worry about!), and I don't see that netlink should have any more overhead than any other method of sending messages.
thanks! again, i appreciate learning from other peoples' experiences.
fyi, the rpc_pipefs stuff is only currently used in two places, i
believe -- by rpc.idmapd and rpc.gssd; just another of a surprisingly wide variety of ways to do kernel<->userland communication.
thanks again, d.
Quoted 5 lines
Steve.
Quoted 8 lines · David Teigland
Quoted 6 lines · david m. richter
ah, so just to make sure i'm with you here: (1)
gfs_controldis generating this "id"-which-is-the-mountgroup-id, and (2)gfs_kernelwill no longer receive this in the hostdata string, so (3) i can just rip out my in-kernel hostdata-parsing gunk and instead send in the mountgroup id on my own (i have my own up/downcall channel)? if i've got it right, then everything's a cinch and i'll shut up :)
Quoted 5 lines
Yep. Generally, the best way to uniquely identify and refer to a gfs filesystem is using the fsname string (specified during mkfs with -t and saved in the superblock). But, sometimes it's just a lot easier have a numerical identifier instead. I expect this is why you're using the id, and it's why we were using it for communicating about plocks.
yes, the numerical id gets used a lot in my pNFS stuff, where the kernel needs to make upcalls, of which some then get relayed over multicast -- so, I've just been stashing that in the superblock. thanks for clearing up my questions.
Quoted 8 lines
In cluster1 and cluster2 the cluster infrastructure dynamically selected a unique id when needed, and it never worked great. In cluster3 the id is just a crc of the fsname string.
Now that I think about this a bit more, there may be a reason to keep the id in the string. There was some interest on linux-kernel about better using the statfs fsid field, and this id is what gfs should be putting there.
interesting; that'd be cool. i've been meaning to look at statfs more often in my stuff anyway.
Quoted 12 lines
Quoted 11 lines
say, one tangential question (i won't be offended if you skip it - heh): is there a particular reason that you folks went with the uevent mechanism for doing upcalls? i'm just curious, given the seeming-complexity and possible overhead of using the whole layered netlink apparatus vs. something like Trond Myklebust's
rpc_pipefs(don't let the "rpc" fool you; it's a barebones, dead-simple pipe). -- and no, i'm not selling anything :) my boss was asking for a list of differences betweenrpc_pipefsand uevents and the best i could come up with is the former's bidirectional. Trond mentioned the netlink overhead and i wondered if that was actually a significant factor or just lost in the noise in most cases.
Quoted 5 lines
The uevents looked pretty simple when I was initially designing how the kernel/user interactions would work, and they fit well with sysfs files which I was using too. I don't think the overhead of using uevents is too bad. Sysfs files and uevents definately don't work great if you need any kind of sophisticated bi-directional interface.
great, thanks -- always good to get folks' anecdotal advice and keep it in my toolbag for later.
cheers,
d
.
Quoted 4 lines
Dave