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.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,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 F0B97CA9EB9 for ; Thu, 24 Oct 2019 02:22:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C76B820684 for ; Thu, 24 Oct 2019 02:22:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ao3aMKIz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408191AbfJXCWd (ORCPT ); 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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.