Add dlm_recover_callback_support in sysfs
PATCH 1/1 Add dlm_recover_callback_support in sysfs
This is a part of the nocontrold feature which was incorporated sometime back.
This is required for backward compatibility of the tools, specifically the scenario where the tools with recovery callback is used with a kernel not using the recovery callbacks (older kernel + newer tools). The tools look for this file to understand if the kernel supports DLM recovery callbacks.
For kernels which support recovery callbacks but will miss this patch, ocfs2 will continue to use the older API and would still be able to mount the filesystem.
---
fs/ocfs2/stackglue.c +16 -0
@@ -601,11 +601,27 @@ static struct kobj_attribute ocfs2_attr_cluster_stack = ocfs2_cluster_stack_show, ocfs2_cluster_stack_store); + + +static ssize_t ocfs2_dlm_recover_show (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) +{ +ssize_t ret; + ret =snprintf (buf,PAGE_SIZE ,"1\n" ); +return ret; +} + +static struct kobj_attribute ocfs2_attr_dlm_recover_support = +__ATTR (dlm_recover_callback_support,S_IFREG |S_IRUGO , + ocfs2_dlm_recover_show,NULL ); +static struct attribute *ocfs2_attrs[] = { &ocfs2_attr_max_locking_protocol.attr, &ocfs2_attr_loaded_cluster_plugins.attr, &ocfs2_attr_active_cluster_plugin.attr, &ocfs2_attr_cluster_stack.attr, + &ocfs2_attr_dlm_recover_support.attr,NULL , };
Signature · 1 line
Goldwyn
PATCH 1/1 Add dlm_recover_callback_support in sysfs
Quoted 15 lines · On Tue, 25 Feb 2014 09:28:44 -0600 Goldwyn Rodrigues <[email protected]> wrote:
This is a part of the nocontrold feature which was incorporated sometime back.
This is required for backward compatibility of the tools, specifically the scenario where the tools with recovery callback is used with a kernel not using the recovery callbacks (older kernel + newer tools). The tools look for this file to understand if the kernel supports DLM recovery callbacks.
For kernels which support recovery callbacks but will miss this patch, ocfs2 will continue to use the older API and would still be able to mount the filesystem.
...
fs/ocfs2/stackglue.c static struct kobj_attribute ocfs2_attr_cluster_stack = · line 613
Quoted 8 lines
fs/ocfs2/stackglue.c +8
-0+static ssize_t ocfs2_dlm_recover_show (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) +{ +ssize_t ret; + ret =snprintf (buf,PAGE_SIZE ,"1\n" ); +return ret; +}
That's a bit long-winded. What's wrong with
static ssize_t ocfs2_dlm_recover_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "1\n");
}?
PATCH 1/1 Add dlm_recover_callback_support in sysfs
Quoted 28 lines · Andrew Morton
Quoted 15 lines · On Tue, 25 Feb 2014 09:28:44 -0600 Goldwyn Rodrigues <[email protected]> wrote:
This is a part of the nocontrold feature which was incorporated sometime back.
This is required for backward compatibility of the tools, specifically the scenario where the tools with recovery callback is used with a kernel not using the recovery callbacks (older kernel + newer tools). The tools look for this file to understand if the kernel supports DLM recovery callbacks.
For kernels which support recovery callbacks but will miss this patch, ocfs2 will continue to use the older API and would still be able to mount the filesystem.
...
fs/ocfs2/stackglue.c static struct kobj_attribute ocfs2_attr_cluster_stack = · line 613
Quoted 8 lines
fs/ocfs2/stackglue.c +8
-0+static ssize_t ocfs2_dlm_recover_show (struct kobject *kobj, +struct kobj_attribute *attr, +char *buf) +{ +ssize_t ret; + ret =snprintf (buf,PAGE_SIZE ,"1\n" ); +return ret; +}That's a bit long-winded. What's wrong with
Quoted 9 lines
static
ssize_tocfs2_dlm_recover_show(struct kobject *kobj,
structkobj_attribute*attr, char *buf){ return snprintf(buf, PAGE_SIZE, "1\n"); }?
Nothing. Rather, it is much better.
Thanks for the review.
Signature · 1 line
Goldwyn