Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2832711ybg; Thu, 24 Oct 2019 16:13:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHE7pxB67qvlaNCK3X54deUD/mTxw2mpxRe7NGhAaJC2X2/SmC4t+LmddVSJ4A50HfmuLy X-Received: by 2002:a17:906:244a:: with SMTP id a10mr594521ejb.15.1571958814404; Thu, 24 Oct 2019 16:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571958814; cv=none; d=google.com; s=arc-20160816; b=OrpUHowiZ2fmfs+eBGFMTZsYeaU/OwLrHofYFrL5i2LjZDy3DESgCi3FyZce/x5DP5 SrKuoyWcJN/PHGn1d6TBtrvQ1sKjJCwIxP/GhV7cJzfk+GFMjZzv7k50rdddMgu4kSk/ mVmeRCCZpZM9YMvU4MmEoVi22SR4B3xrNYaqxPDSCKfkx0Lrx3kbf74S6TfJQcI0704W JzrCY1SYDjfJNJ0RG3budGQR2DebLolX0Vj3MDIx6w1n0qt6P9mhx2reL9Fxz9ns3K5q BdJDJbXdMwkplqfGYzOm6STYXyJUFaN8el1P4Y81RzQ/1pjy389X/0JoUZAiXuvQ5uds +fhw== 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; bh=FEbmLua8Oh4k+iLyvlY2QSAFzpm5PEE9tHR7zp4MDpY=; b=eOapBjfyB9SQNyPVRAGpPtYEkzqJeLKBMGlMwZw+hohT6J5legrn7yq98Cs1BP8P/R o4dL5q7SSKQrwus+5aUjTw6SdbFgovgQfYmO/WcrcKJ6PkdmnqQaFWBpqg2Eh55pWcjK zRmzTUj2d1doSTz79fPHuy6WNFwPt12KeuBbhX2ZrLJ/T3JwJWUDeAHR7EIyd9436d9o yqKO5D5vbRKPlsjj7IcIY5O+ZyiYMIvx/9hKNGvnsJvkmTxBAQGUsjZPhgtoS9Hw8Qhf bW15qnzwROafDyeIing+LDADtsm8tyo1AFf0eDBG0pVcRa1VLESgDxHoGeh5D6zXBR/I XgYA== ARC-Authentication-Results: i=1; mx.google.com; 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 e15si121776ejq.269.2019.10.24.16.13.09; Thu, 24 Oct 2019 16:13:34 -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; 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 S1731922AbfJXIzS (ORCPT + 99 others); Thu, 24 Oct 2019 04:55:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:54374 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730100AbfJXIzS (ORCPT ); Thu, 24 Oct 2019 04:55:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 69814B75B; Thu, 24 Oct 2019 08:55:16 +0000 (UTC) Date: Thu, 24 Oct 2019 10:55:14 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Christoph Hellwig 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: <20191024085514.GI938@kitsune.suse.cz> References: <20191024022232.GB11485@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191024022232.GB11485@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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 07:22:32PM -0700, Christoph Hellwig wrote: > 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. If you have ideas how to do this better then share them. Thanks Michal