From: Greg KH <greg@kroah.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH v2 1/2] staging: lustre: check result of register_shrinker
Date: Wed, 6 Dec 2017 09:51:57 +0100 [thread overview]
Message-ID: <20171206085157.GA17896@kroah.com> (raw)
In-Reply-To: <20171204192157.4140-1-akaraliou.dev@gmail.com>
On Mon, Dec 04, 2017 at 10:21:56PM +0300, Aliaksei Karaliou wrote:
> Lustre code lacks checking the result of register_shrinker()
> in several places. register_shrinker() was tagged __must_check
> recently so that sparse has started reporting it.
>
> Signed-off-by: Aliaksei Karaliou <akaraliou.dev@gmail.com>
> ---
> drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 12 +++++++++---
> drivers/staging/lustre/lustre/obdclass/lu_object.c | 5 +++--
> drivers/staging/lustre/lustre/osc/osc_request.c | 4 +++-
> drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 8 +++++++-
> 4 files changed, 22 insertions(+), 7 deletions(-)
>
> v2: Style fixes, as suggested by Cheers, Andreas and Dan Carpenter.
> Added one more patch to address resource cleanup, suggested by Dan Carpenter.
>
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
> index da65d00a7811..9fef2d52d6c2 100644
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
> @@ -1086,10 +1086,16 @@ int ldlm_pools_init(void)
> int rc;
>
> rc = ldlm_pools_thread_start();
> - if (rc == 0)
> - register_shrinker(&ldlm_pools_cli_shrinker);
> + if (rc)
> + return rc;
>
> - return rc;
> + rc = register_shrinker(&ldlm_pools_cli_shrinker);
> + if (rc) {
> + ldlm_pools_thread_stop();
> + return rc;
> + }
> +
> + return 0;
> }
>
> void ldlm_pools_fini(void)
> diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
> index b938a3f9d50a..9e0256ca2079 100644
> --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
> +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
> @@ -1951,7 +1951,7 @@ int lu_global_init(void)
> * inode, one for ea. Unfortunately setting this high value results in
> * lu_object/inode cache consuming all the memory.
> */
> - register_shrinker(&lu_site_shrinker);
> + result = register_shrinker(&lu_site_shrinker);
>
> return result;
return register_shrinker()?
> - register_shrinker(&pools_shrinker);
> + rc = register_shrinker(&pools_shrinker);
> + if (rc) {
> + enc_pools_free();
> + return rc;
Drop the return rc, and then just do:
> + }
>
> return 0;
return rc;
there. Makes the patch smaller.
thanks,
greg k-h
next prev parent reply other threads:[~2017-12-06 8:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20171202184046.4338-1-akaraliou.dev@gmail.com>
2017-12-03 0:47 ` [lustre-devel] [PATCH] staging: lustre: check result of register_shrinker Dilger, Andreas
2017-12-04 8:35 ` Dan Carpenter
[not found] ` <babc0c09-2384-e277-1c68-e07457c6e5fd@gmail.com>
2017-12-04 8:40 ` Dan Carpenter
[not found] ` <908ca41a-4fba-1f0f-ddc5-c5e5e3fd1142@gmail.com>
2017-12-04 19:16 ` Dan Carpenter
[not found] ` <20171204192157.4140-1-akaraliou.dev@gmail.com>
2017-12-06 8:51 ` Greg KH [this message]
[not found] ` <dac170c9-86d2-ba08-3865-4240a426eacc@gmail.com>
2017-12-06 18:40 ` [lustre-devel] [PATCH v2 1/2] " Greg KH
2017-12-05 0:50 ` [lustre-devel] [PATCH] " Dilger, Andreas
2017-12-05 9:33 ` Dan Carpenter
2017-12-04 8:33 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171206085157.GA17896@kroah.com \
--to=greg@kroah.com \
--cc=lustre-devel@lists.lustre.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.