cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2: fix to detect failure of register_shrinker
@ 2016-09-19 15:46 Chao Yu
  2016-09-21 17:36 ` Bob Peterson
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2016-09-19 15:46 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From: Chao Yu <yuchao0@huawei.com>

register_shrinker can fail after commit 1d3d4437eae1 ("vmscan: per-node
deferred work"), we should detect the failure of it, otherwise we may
fail to register shrinker after gfs2 module was been inited successfully.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/gfs2/glock.c | 8 +++++++-
 fs/gfs2/main.c  | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c8e2e7f..14cbf60 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1781,7 +1781,13 @@ int __init gfs2_glock_init(void)
 		return -ENOMEM;
 	}
 
-	register_shrinker(&glock_shrinker);
+	ret = register_shrinker(&glock_shrinker);
+	if (ret) {
+		destroy_workqueue(gfs2_delete_workqueue);
+		destroy_workqueue(glock_workqueue);
+		rhashtable_destroy(&gl_hash_table);
+		return ret;
+	}
 
 	return 0;
 }
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 74fd013..67d1fc4 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -145,7 +145,9 @@ static int __init init_gfs2_fs(void)
 	if (!gfs2_qadata_cachep)
 		goto fail;
 
-	register_shrinker(&gfs2_qd_shrinker);
+	error = register_shrinker(&gfs2_qd_shrinker);
+	if (error)
+		goto fail;
 
 	error = register_filesystem(&gfs2_fs_type);
 	if (error)
-- 
2.7.2



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

* [Cluster-devel] [PATCH] gfs2: fix to detect failure of register_shrinker
  2016-09-19 15:46 [Cluster-devel] [PATCH] gfs2: fix to detect failure of register_shrinker Chao Yu
@ 2016-09-21 17:36 ` Bob Peterson
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Peterson @ 2016-09-21 17:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
| From: Chao Yu <yuchao0@huawei.com>
| 
| register_shrinker can fail after commit 1d3d4437eae1 ("vmscan: per-node
| deferred work"), we should detect the failure of it, otherwise we may
| fail to register shrinker after gfs2 module was been inited successfully.
| 
| Signed-off-by: Chao Yu <yuchao0@huawei.com>
| ---
|  fs/gfs2/glock.c | 8 +++++++-
|  fs/gfs2/main.c  | 4 +++-
|  2 files changed, 10 insertions(+), 2 deletions(-)
| 

Hi,

Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=e0d735c1cc2749598f2d29f60f9a16658fd96ae9

Regards,

Bob Peterson
Red Hat File Systems



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

end of thread, other threads:[~2016-09-21 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 15:46 [Cluster-devel] [PATCH] gfs2: fix to detect failure of register_shrinker Chao Yu
2016-09-21 17:36 ` Bob Peterson

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).