lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200928073028.GA16536@lst.de>
Date:   Mon, 28 Sep 2020 09:30:28 +0200
From:   Christoph Hellwig <hch@....de>
To:     Ming Lei <ming.lei@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
        Song Liu <song@...nel.org>, Jens Axboe <axboe@...nel.dk>,
        Veronika Kabatova <vkabatov@...hat.com>,
        linux-raid@...r.kernel.org, Sagi Grimberg <sagi@...mberg.me>,
        Tejun Heo <tj@...nel.org>, Christoph Hellwig <hch@....de>,
        Bart Van Assche <bvanassche@....org>
Subject: Re: [PATCH V5 1/3] percpu_ref: add percpu_ref_is_initialized for MD

On Sun, Sep 27, 2020 at 02:26:52PM +0800, Ming Lei wrote:
> MD code uses perpcu-refcount internal to check if this percpu-refcount
> variable is initialized, this way is a hack.
> 
> Add percpu_ref_is_initialized for MD so that the hack can be avoided.
> 
> Acked-by: Song Liu <song@...nel.org>
> Suggested-by: Jens Axboe <axboe@...nel.dk>
> Tested-by: Veronika Kabatova <vkabatov@...hat.com>
> Cc: Song Liu <song@...nel.org>
> Cc: linux-raid@...r.kernel.org
> Cc: Sagi Grimberg <sagi@...mberg.me>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Jens Axboe <axboe@...nel.dk>
> Cc: Bart Van Assche <bvanassche@....org>
> Signed-off-by: Ming Lei <ming.lei@...hat.com>
> ---
>  drivers/md/md.c                 | 2 +-
>  include/linux/percpu-refcount.h | 1 +
>  lib/percpu-refcount.c           | 6 ++++++
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index de8419b7ae98..241ff618d84e 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -5631,7 +5631,7 @@ static void no_op(struct percpu_ref *r) {}
>  
>  int mddev_init_writes_pending(struct mddev *mddev)
>  {
> -	if (mddev->writes_pending.percpu_count_ptr)
> +	if (percpu_ref_is_initialized(&mddev->writes_pending))
>  		return 0;

I'd much rather use a flag in the containing mddev structure then
exposing this new "API".  That mddev code is pretty gross to be honest,
we should just initialize the percpu_ref once instea of such a hack.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ