Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2543234ybg; Thu, 24 Oct 2019 11:16:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2x4TPiXfvr+amgkKAZQMgeE9qjcGmjDQa6NDCkKfPZ2+PeaCAG7ztAy9/J2L9lkoUohdN X-Received: by 2002:a50:aad2:: with SMTP id r18mr24009682edc.44.1571940971985; Thu, 24 Oct 2019 11:16:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571940971; cv=none; d=google.com; s=arc-20160816; b=GUzOyy7DyeCg5U4LYIoLZy90+Ofz+y45VA4W+1ldo0nwgLMi+PfsQR+hSh0nuHIlbF 1xcNJNbwNIL+hnlCfTVYM1JLjMQ5l4DmtZ/pLM45cZKvBJ5+0wzEYCE4xNJQKamcrXZp FUq7Caqn52Dq1KkvpzHLVPI8SZkyevCFgWXbd1mIS2ZoU8uP0NulvO3QlZwM7kalmxO3 fgUIn7IllnpytIa35uxf5kbGyMjpI+7bp1pdQXsFw7+tpEWtI3g9S83wJCohpduPzZnC Wijoa28VOLRoLiO938nWVr9MI8X3OXg7ycmUlTYKo7sBd7bP1f6b1UIyypVydrcEVHwy BGKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VdqxphUBsAx8A35g/nQEXQbEGAO7hR3jrSxRZ6H7Ekw=; b=PNAkrRRyIYc76uvBFQodPalI/qLGCEZx3yMOjbUc6K7W0uA4qCXlPpO/VDsp5YXw++ uTOYm+M9TJR17vv0lt0HWXTCzgv7XP6h95VA8s+4nTHhmLnDNUH5mfxXaU3Xx7vBdkcA NXVqH486IkzSHAPYHh6ZM0od1M0DfM7iieZTyoSaV8i4MyOsDArWd+Ri0rhS3SgvEuxj RxkDsZdC6+W8Fo/EnI03/djzebhl6kN4Kg6+WWD3En/P3qieSU4SElnm0UICQkUJ+E2s d/WCANWtqoT3ma1GvKf0ENC65daNIP8hqEbZDEne7FCr6cGL4xnEKay4NiPACSk44Vza y4Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ao3aMKIz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si14940195ejp.157.2019.10.24.11.15.45; Thu, 24 Oct 2019 11:16:11 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ao3aMKIz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408195AbfJXCWd (ORCPT + 99 others); Wed, 23 Oct 2019 22:22:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42834 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406401AbfJXCWd (ORCPT ); Wed, 23 Oct 2019 22:22:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VdqxphUBsAx8A35g/nQEXQbEGAO7hR3jrSxRZ6H7Ekw=; b=Ao3aMKIz2ZC1ggbnQleeDHCrt cxahZc8hg8+ROHlAVa4TQhidj2Q3gxt0LlMbNjeGDZJT7jqYzR1Jgtnkbd9OWMdzgfoMuHPxcjHYN Wdl6Ko8Jsq04A6/VBvArxPLEwH1VigY/42xB0ADLEOxQktBGFcE7V0LIZ7Ofk1icwULvy90CQKYo4 TTNyY7h4wwPbhHkbtPiHhVAVb7VNpGrkz7q0Bhs0ZHJelBdtBuMf86+yYfFfgOwORVWx/kr6WVXZR jDwKxeAny62exBQODJdhZdh2b6AUW6UfTduB02V15Cu0n17naKKVLY/T8VHERi39NPulhjKI/q+7m eymCUMxtQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNSlk-0004Xk-IY; Thu, 24 Oct 2019 02:22:32 +0000 Date: Wed, 23 Oct 2019 19:22:32 -0700 From: Christoph Hellwig To: Michal Suchanek Cc: linux-scsi@vger.kernel.org, Jonathan Corbet , Jens Axboe , "James E.J. Bottomley" , "Martin K. Petersen" , Alexander Viro , Mauro Carvalho Chehab , Eric Biggers , "J. Bruce Fields" , Benjamin Coddington , Hannes Reinecke , Omar Sandoval , Ming Lei , Damien Le Moal , Bart Van Assche , Tejun Heo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 6/8] bdev: add open_finish. Message-ID: <20191024022232.GB11485@infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2019 at 02:52:45PM +0200, Michal Suchanek wrote: > Opening a block device may require a long operation such as waiting for > the cdrom tray to close. Performing this operation with locks held locks > out other attempts to open the device. These processes waiting to open > the device are not killable. > > To avoid this issue and still be able to perform time-consuming checks > at open() time the block device driver can provide open_finish(). If it > does opening the device proceeds even when an error is returned from > open(), bd_mutex is released and open_finish() is called. If > open_finish() succeeds the device is now open, if it fails release() is > called. > > When -ERESTARTSYS is returned from open() blkdev_get may loop without > calling open_finish(). On -ERESTARTSYS open_finish() is not called. > > Move a ret = 0 assignment up in the if/else branching to avoid returning > -ENXIO. Previously the return value was ignored on the unhandled branch. This just doesn't make much sense. There is no point in messing up the block API for ugly workarounds like that.