ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] Add dlm_recover_callback_support in sysfs
@ 2014-02-25 15:28 Goldwyn Rodrigues
  2014-02-25 20:21 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Goldwyn Rodrigues @ 2014-02-25 15:28 UTC (permalink / raw)
  To: ocfs2-devel

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.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

--- 
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 1324e66..c12927f 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -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,
 };
 

-- 
Goldwyn

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH] Add dlm_recover_callback_support in sysfs
  2014-02-25 15:28 [Ocfs2-devel] [PATCH] Add dlm_recover_callback_support in sysfs Goldwyn Rodrigues
@ 2014-02-25 20:21 ` Andrew Morton
  2014-02-26 13:01   ` Goldwyn Rodrigues
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2014-02-25 20:21 UTC (permalink / raw)
  To: ocfs2-devel

On Tue, 25 Feb 2014 09:28:44 -0600 Goldwyn Rodrigues <rgoldwyn@suse.de> 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.
> 
> ...
>
> +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");
}

?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH] Add dlm_recover_callback_support in sysfs
  2014-02-25 20:21 ` Andrew Morton
@ 2014-02-26 13:01   ` Goldwyn Rodrigues
  0 siblings, 0 replies; 4+ messages in thread
From: Goldwyn Rodrigues @ 2014-02-26 13:01 UTC (permalink / raw)
  To: ocfs2-devel

On 02/25/2014 02:21 PM, Andrew Morton wrote:
> On Tue, 25 Feb 2014 09:28:44 -0600 Goldwyn Rodrigues <rgoldwyn@suse.de> 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.
>>
>> ...
>>
>> +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");
> }
>
> ?
>

Nothing. Rather, it is much better.

Thanks for the review.

-- 
Goldwyn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH] Add dlm_recover_callback_support in sysfs
@ 2014-02-26 13:19 Goldwyn Rodrigues
  0 siblings, 0 replies; 4+ messages in thread
From: Goldwyn Rodrigues @ 2014-02-26 13:19 UTC (permalink / raw)
  To: ocfs2-devel

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.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
--- 
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 1324e66..526e4bc 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -601,11 +601,23 @@ 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)
+{
+	return snprintf(buf, PAGE_SIZE, "1\n");
+}
+
+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,
 };
 

-- 
Goldwyn

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-26 13:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25 15:28 [Ocfs2-devel] [PATCH] Add dlm_recover_callback_support in sysfs Goldwyn Rodrigues
2014-02-25 20:21 ` Andrew Morton
2014-02-26 13:01   ` Goldwyn Rodrigues
  -- strict thread matches above, loose matches on Subject: below --
2014-02-26 13:19 Goldwyn Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).