From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7806C55191 for ; Sat, 25 Apr 2020 02:12:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A8A4B20748 for ; Sat, 25 Apr 2020 02:12:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8A4B20748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5358A8E0005; Fri, 24 Apr 2020 22:12:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E6138E0003; Fri, 24 Apr 2020 22:12:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FC878E0005; Fri, 24 Apr 2020 22:12:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 293FF8E0003 for ; Fri, 24 Apr 2020 22:12:49 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D1F48181AC9C6 for ; Sat, 25 Apr 2020 02:12:48 +0000 (UTC) X-FDA: 76744754016.29.mark33_6fd7afb20f62d X-HE-Tag: mark33_6fd7afb20f62d X-Filterd-Recvd-Size: 4044 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Sat, 25 Apr 2020 02:12:48 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id hi11so4646474pjb.3 for ; Fri, 24 Apr 2020 19:12:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VAwc1AKSp5B7UhF/0ecMczbgaQzkFJn5Nyd0M+l9aDw=; b=TcC9KTOMeWMvuLc5p5NvM+ZjhFsTCWAHoAPhMuSPvc+OCRrFQ3z2+sv+uC3oBaPNUE gJLpVUzOCWc6OO6Kr2y39UW7hqaHeWMxe37B5Va8hZydf6VQHWIA6sP175ir58feL1YO 6sG8nn9dMuXMmNSYdaQwCN/ARF/U8g1q+VpjVUFzVyJS7i1APnqYTF6/vx6mt/jo+w4t 0eGdPjrp37nCtpXKV+YI5MgByU3SCMiWkhaeVHGVTpjOKi5JTsrQxetMfLa4vQ3JWTIT 4+Jktnl2nRZr0M1Pz2cPtMUfALg0HmuF2kFJ7VQ2z41lw1hK9BpSXEuOhNHdDgrqnGc8 YfNQ== X-Gm-Message-State: AGi0PuZOfM32hygYNJj5RGIXKx6T7JU7x1SimzYR2la/4OqTTWRwNqOt GvxOfNswjtZiZXJkqmBjLwM= X-Google-Smtp-Source: APiQypJ6Xhv95ABdmHPLykZ9mxjB42z2LQ8WbeKbHCJrwPG+2THju9/ZzXNjNx28ihtiF5pgJ3dyIg== X-Received: by 2002:a17:90a:3327:: with SMTP id m36mr9760022pjb.116.1587780767473; Fri, 24 Apr 2020 19:12:47 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id x26sm6744265pfo.218.2020.04.24.19.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 19:12:46 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 2E3E1403AB; Sat, 25 Apr 2020 02:12:45 +0000 (UTC) Date: Sat, 25 Apr 2020 02:12:45 +0000 From: Luis Chamberlain To: Bart Van Assche Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, gregkh@linuxfoundation.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org, mhocko@suse.com, yukuai3@huawei.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 10/10] block: put_device() if device_add() fails Message-ID: <20200425021245.GF11244@42.do-not-panic.com> References: <20200419194529.4872-1-mcgrof@kernel.org> <20200419194529.4872-11-mcgrof@kernel.org> <85a18bcf-4bd0-a529-6c3c-46fcd23a350e@acm.org> <20200424223210.GD11244@42.do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Apr 24, 2020 at 06:58:23PM -0700, Bart Van Assche wrote: > On 2020-04-24 15:32, Luis Chamberlain wrote: > > On Sun, Apr 19, 2020 at 04:40:45PM -0700, Bart Van Assche wrote: > >> On 4/19/20 12:45 PM, Luis Chamberlain wrote: > >>> Through code inspection I've found that we don't put_device() if > >>> device_add() fails, and this must be done to decrement its refcount. > >> > >> Reviewed-by: Bart Van Assche > > > > Turns out this is wrong, as bdi needs it still, we have can only remove > > it once all users are done, which should be at the disk_release() path. > > > > I've found this while adding the errors paths missing. > > Hi Luis, > > I had a look at the comments above device_add() before I added my > Reviewed-by. Now that I've had another look at these comments and also > at the device_add() implementation I agree that we don't need this patch. Thanks for the confirmation. And just to note, we don't do then put_device() because we don't handle error paths properly. Once we do, we'll need to ensure we put_disk() just at the right place. I'm working on putting some final brush strokes on that now. Luis