aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2016-09-21 13:09:40 -0400
committerBob Peterson <rpeterso@redhat.com>2016-09-21 13:09:40 -0400
commite0d735c1cc2749598f2d29f60f9a16658fd96ae9 (patch)
tree93baef2e9a3f8f250a230b916550742044ccdc72
parent23e5671a79be00b2f1c895aa93ff40fb75a4647e (diff)
gfs2: fix to detect failure of register_shrinker
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> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r--fs/gfs2/glock.c8
-rw-r--r--fs/gfs2/main.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c8e2e7f62051..14cbf60167a7 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1781,7 +1781,13 @@ int __init gfs2_glock_init(void)
1781 return -ENOMEM; 1781 return -ENOMEM;
1782 } 1782 }
1783 1783
1784 register_shrinker(&glock_shrinker); 1784 ret = register_shrinker(&glock_shrinker);
1785 if (ret) {
1786 destroy_workqueue(gfs2_delete_workqueue);
1787 destroy_workqueue(glock_workqueue);
1788 rhashtable_destroy(&gl_hash_table);
1789 return ret;
1790 }
1785 1791
1786 return 0; 1792 return 0;
1787} 1793}
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 74fd0139e6c2..67d1fc4668f7 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -145,7 +145,9 @@ static int __init init_gfs2_fs(void)
145 if (!gfs2_qadata_cachep) 145 if (!gfs2_qadata_cachep)
146 goto fail; 146 goto fail;
147 147
148 register_shrinker(&gfs2_qd_shrinker); 148 error = register_shrinker(&gfs2_qd_shrinker);
149 if (error)
150 goto fail;
149 151
150 error = register_filesystem(&gfs2_fs_type); 152 error = register_filesystem(&gfs2_fs_type);
151 if (error) 153 if (error)