Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp86146ybx; Mon, 4 Nov 2019 16:19:25 -0800 (PST) X-Google-Smtp-Source: APXvYqw4mZ/UXzmd9yFa0p1xvRpcLmK6VBAXuVOWkSMdG58BiR3/wPckAAd2k3MgqrvL82lzcBbW X-Received: by 2002:a50:9713:: with SMTP id c19mr32660022edb.206.1572913165553; Mon, 04 Nov 2019 16:19:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572913165; cv=none; d=google.com; s=arc-20160816; b=rC5kcUw+hhfYz5pkFZkCqL0TP68jI7cT6PbSFPz4LFOSFOcKAs2mCafRNgv0B6OxqT aNR52ubCXKF+nx+ndCvzKVbOZgRYVrrSa+6ncN/bxMpV83xILRS8E6R2/tiy79lA0fhI e4tGLDf8yJyDk0NhyooRB6Si/mNTXIgEQ183+Z+tRuRz5xcup0tB/LCnSOR8CJzD7GBB 2ffU7RqS9JMiZw0+xQEKxYtOb+J1EHjIs5vH1Z0J4R3KDqeal4Xmld8J6AYaZuOv4KBZ Alebqq0P8QsrT8nTKEsLlGcft8qIdYLsmjVVxTQWfkAxLUHxJn2iJl980AzIHhbBGr2h Kvig== 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=rmotbuiJ0EOix30Si2XGpOoKC4o3ZoK8589mQ5Hds5I=; b=u53yMq0bknCAdSC7F5bVLn78Cz+rDiEY0ET3QaR61G1zVyNVcZG1n+TB9mGCyjr7Dn cj3qhyEVW0L7QrR0nBb/p0F/1rWLmoaQ5AYC+Sc1c+Dv7ktxYIAcRJ3/hx2f3SuMso0G QV1KE/5abxwHsih4g5CVwWAFHKeNcoAe7ob3yAeOvtuLFWppozDn743Esp/Bfflvr6Uy EhEkh1xTirK/nrusZ+yDXSeED1s2HlQoykVJq8A4Xj1tRHeTNSeRRAoe6JWCOhkSxUNK 6FeKupAyeI9Wyh1HtSwF51KFIL2266CNzP+mh6tIhGhGk7wFglfRFvhYG3mjL0sY7xRk aZ7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Z+Zg46Ed; 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 c8si9576208edf.79.2019.11.04.16.19.02; Mon, 04 Nov 2019 16:19:25 -0800 (PST) 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=Z+Zg46Ed; 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 S2387626AbfKEARb (ORCPT + 99 others); Mon, 4 Nov 2019 19:17:31 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:38718 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387415AbfKEARa (ORCPT ); Mon, 4 Nov 2019 19:17:30 -0500 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=rmotbuiJ0EOix30Si2XGpOoKC4o3ZoK8589mQ5Hds5I=; b=Z+Zg46Edx1IcEww0YGj1D014Y FAP0eWgSKwkaX082En4iPK1lkJ+QJtwwfyIMKmG9lPkKZOY+OclgDKegBaxvhmpLyhQ23jjLmFugA oLeq/gTRdbv1iobQhOgF6CK5YOZfYCteiEk1svh+/8LNHIrJgADgMOjXWcPB7q6wq4L8H+EFqPqCE HAevx5CCOKSk4Z1PTMBZs82iMD5dGMA5OSvNy2zEU+EQHavbOD9WQrwQ56n7a8fJrg1sJPeAB7hH4 ivlzDonGWMNApnCNtnkVouVVtvyh7SRwdWiS4fuapBmULFF/eaM3uZ8yV0Ypqz+N7VsYNP7cYPO3C Ui4wppx3w==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iRmXH-0007vi-Ay; Tue, 05 Nov 2019 00:17:27 +0000 Date: Mon, 4 Nov 2019 16:17:27 -0800 From: Christoph Hellwig To: Michal Suchanek Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Matthew Wilcox , "Ewan D. Milne" , Jonathan Corbet , Jens Axboe , "James E.J. Bottomley" , "Martin K. Petersen" , Alexander Viro , "J. Bruce Fields" , Mauro Carvalho Chehab , Eric Biggers , 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 v3 5/7] bdev: add open_finish. Message-ID: <20191105001727.GA29826@infradead.org> References: <31f640791d9cc20cdbbb3000dfcf8370cf3c6223.1572002144.git.msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31f640791d9cc20cdbbb3000dfcf8370cf3c6223.1572002144.git.msuchanek@suse.de> 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 Please make sure you CC linux-block if you add block device ops. On Fri, Oct 25, 2019 at 01:21:42PM +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. Still a complete nack for splitting a fundamental operation over two ops, especially just for working around a piece of buggy software.