Skip to content

Commit

Permalink
gfs2: fix to detect failure of register_shrinker
Browse files Browse the repository at this point in the history
register_shrinker can fail after commit 1d3d443 ("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>
  • Loading branch information
Chao Yu authored and Bob Peterson committed Sep 21, 2016
1 parent 23e5671 commit e0d735c
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion fs/gfs2/glock.c
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 3 additions & 1 deletion fs/gfs2/main.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e0d735c

Please sign in to comment.