Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7548464ybh; Thu, 8 Aug 2019 18:26:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDLEMTAvwxgZ2YdlwE7olgbQqfunj0tdHdI3LEscDfv7t8/iGtjzxrgB899p7KHogkmhtj X-Received: by 2002:a65:5144:: with SMTP id g4mr15295694pgq.202.1565313975537; Thu, 08 Aug 2019 18:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565313975; cv=none; d=google.com; s=arc-20160816; b=OrEEc3me2PcqAwoYhOyOOOJWPHc3K/Y8TcDdT1O/gl7V52mU1NeG5PuCmoQyJ2H1ok BFZZ9zQth6T/ZWbf/l5ZHNZ04yYDMY2O6fQjL3s9Ap9M+F6MjjxSl1RwWwthq+WsfkYG BA72qFfloF1caxrk+0rV3eUux0HPVOqbJf3OH88VilSnK5IEYfWeaMwR2L6Uz33CbESq AbhEKSAOjOLhmlQXM/3pzriqKgmZ6Q6C4/8gRq0c3bjDASejoY2FIj0JQOn8tUzdju/a 2fecZA3tBl1X4hmEWZ03KNPsXBO+2iY4X3wsCZGdNSSblhDMGw7Gv7/+iKDJoUcoprw3 ibUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=q1VDmvy5H5V/lcQDElMHgpagqDBHRV5q2PlN+0yp058=; b=PGhmfQegK0V93Yqm/Kd5HLOrpGJA5DB2sBirBYODsRE+enijyDxXOiQKs2ftJ1rN3l N8fGosi+61HumgEU1HRHDGkduhS244d/jK2DrC43ryRrDYsEUENZNvKKo8Yx7n4jHzzq pNFVqB9AmffIXDdHmtLo7PGEbsvit07jhEsasifYaAGQABaGoMdmMjc4PuO7QrS+Y21d WJDAUQKdQ08E+U42CdStj7r9lflCMVAEMBAf5Caf2MYWbBx3w2MgBHEymr5romQn0ZAn e1miIJ7JTManE21gqyeUWr5H5SDj6EF0IesAXKG7VHwKuSSDC0zVtdoQy+ivjcLPYYRq UwVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ap3AA5Q7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144si20877967pgh.176.2019.08.08.18.25.57; Thu, 08 Aug 2019 18:26:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ap3AA5Q7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405258AbfHIBMQ (ORCPT + 99 others); Thu, 8 Aug 2019 21:12:16 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36568 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404550AbfHIBMQ (ORCPT ); Thu, 8 Aug 2019 21:12:16 -0400 Received: by mail-ed1-f68.google.com with SMTP id k21so93084685edq.3; Thu, 08 Aug 2019 18:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=q1VDmvy5H5V/lcQDElMHgpagqDBHRV5q2PlN+0yp058=; b=ap3AA5Q7qTtE00hxn3S74U63HIxZRuOIEAkqJtskyVa1jNpnNvhKUvDrT3dAGsl5SF h2/RDfNHPRr5jvA8f6B8NXM6HB02DfY+BP/8ghY3TDNi1E4A+9px3gb2AWH8EVgw6UWR 5dKfp34zFQ2H1rLuXMNlFRuIVPEVt1gWvaRQdkB+rmgNXZPrMxnMrkunvkhKFoqjPcCv Dwrzw1Kt5tlCv0D2XXpTb9ueZanzUxnqkS1xdp9MK3eHxRebHwIBUF6xH07LUxddrU32 95wwhu60FOS1kgOLv3zM+npKW+J94/3fxc84boCfaA3Y2puUH5U6GxfSjl1rwe5Hrjq4 iBEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=q1VDmvy5H5V/lcQDElMHgpagqDBHRV5q2PlN+0yp058=; b=ZXAZxqasuxJOQGf/QK5MMecDd4sGl44k0D1SnQkInTITjCcsETm6CaBsltFwyEVzi7 dzEoQFpPl1wpYIAD2NalB5LeUPSzBqEJax8WqXWMwgiV77xaCbhlJw3Fa2T8D/iJg+g4 zynFAWxRsh/BRrUdqjFbr0Gc/JevulMDLXwxGlewmSn9ECTFEI+yS457EfIw4NjlX1nM Q/gdKDemYTr+h7xZKs1AjoAuw1/VzHXNnUgV6wW5FtXvdONNtqi8PYdoyaWC14YkahnR o12urW0QQ2ZtKl1V0yc0vryhoU5C3YAL+ssK7s5aBTrj9rvmk2xM2uXedR36VCnvYNLp WC8g== X-Gm-Message-State: APjAAAXubARfIRy+mr0x5ILMsIqYtGBVZJuIAXgJu/hXFMyJAjXYOLUa +kAIZQQnxcAw8OTVtgNurAIKG3lbmVl6AdvCFQE= X-Received: by 2002:a17:906:7cd6:: with SMTP id h22mr16154601ejp.254.1565313134395; Thu, 08 Aug 2019 18:12:14 -0700 (PDT) MIME-Version: 1.0 References: <20190808131100.24751-1-hslester96@gmail.com> <20190808133510.tre6twn764pv3e7m@Air-de-Roger> In-Reply-To: <20190808133510.tre6twn764pv3e7m@Air-de-Roger> From: Chuhong Yuan Date: Fri, 9 Aug 2019 09:12:04 +0800 Message-ID: Subject: Re: [PATCH 3/3] xen/blkback: Use refcount_t for refcount To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Cc: Konrad Rzeszutek Wilk , Jens Axboe , xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 8, 2019 at 9:35 PM Roger Pau Monn=C3=A9 = wrote: > > On Thu, Aug 08, 2019 at 09:11:00PM +0800, Chuhong Yuan wrote: > > Reference counters are preferred to use refcount_t instead of > > atomic_t. > > This is because the implementation of refcount_t can prevent > > overflows and detect possible use-after-free. > > So convert atomic_t ref counters to refcount_t. > > Thanks! > > I think there are more reference counters in blkback than > the one you fixed. There's also an inflight field in xen_blkif_ring, > and a pendcnt in pending_req which look like possible candidates to > switch to use refcount_t, have you looked into switching those two > also? > I will switch those two in next version. > Roger.