gfs2: fix to detect failure of register_shrinker
PATCH 1/1 gfs2: fix to detect failure of register_shrinker
From: Chao Yu <[email protected]>
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 <[email protected]>
--- fs/gfs2/glock.c | 8 +++++++- fs/gfs2/main.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-)
fs/gfs2/glock.c +7 -1
@@ -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 ; }
fs/gfs2/main.c +3 -1
@@ -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)
Signature · 1 line
2.7.2
----- Original Message -----
| From: Chao Yu <[email protected]> | | 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 <[email protected]> | --- | 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