Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756146AbcKVRf0 (ORCPT ); Tue, 22 Nov 2016 12:35:26 -0500 Received: from latin.grep.be ([46.4.76.168]:57495 "EHLO latin.grep.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754238AbcKVRfY (ORCPT ); Tue, 22 Nov 2016 12:35:24 -0500 X-Greylist: delayed 967 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 Nov 2016 12:35:24 EST Date: Tue, 22 Nov 2016 18:19:11 +0100 From: Wouter Verhelst To: Josef Bacik Cc: axboe@fb.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, alex@alex.org.uk, nbd-general@lists.sourceforge.net Subject: Re: [PATCH][V4] nbd: add multi-connection support Message-ID: <20161122171911.bvzlhli24lscbqa3@grep.be> References: <1479414450-7999-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479414450-7999-1-git-send-email-jbacik@fb.com> X-Speed: Gates' Law: Every 18 months, the speed of software halves. Organization: none User-Agent: NeoMutt/20161104 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2017 Lines: 50 Hi Josef, [cc to nbd-general added] On Thu, Nov 17, 2016 at 03:27:30PM -0500, Josef Bacik wrote: > NBD can become contended on its single connection. We have to serialize all > writes and we can only process one read response at a time. Fix this by > allowing userspace to provide multiple connections to a single nbd device. This > coupled with block-mq drastically increases performance in multi-process cases. > Thanks, > > Signed-off-by: Josef Bacik > --- > V3->V4: > -Fixed a problem where fast completes (or early completes) would crash because > we were still accessing the bio's on the submit side. > -Added a flag to disallow multi-connection support if the server doesn't > explicitly allow for them. [...] > + if (num_connections > 1 && > + !(nbd->flags & NBD_FLAG_CAN_MULTI_CONN)) { > + dev_err(disk_to_dev(nbd->disk), "server does not support multiple connections per device.\n"); > + goto out_err; > + } I'm not sure whether the kernel needs to check this. I agree that the flag can be useful, but it's probably something for userspace to check, rather than for the kernel; I could imagine a --force parameter to be useful in some corner cases. Having said that, implementing such a parameter could also be done by artificially adding particular flags, so I'm certainly not opposed to this. [...] > +#define NBD_FLAG_CAN_MULTI_CONN (1 << 6) /* Server supports multiple connections per export. */ NAK, that is already specified in the protocol spec at https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md to be NBD_FLAG_SEND_WRITE_ZEROES. Bit 7 is also taken already, so please use bit 8 instead. (I'll reserve that bit in that document to be "export is multi-conn safe" in a minute) -- < ron> I mean, the main *practical* problem with C++, is there's like a dozen people in the world who think they really understand all of its rules, and pretty much all of them are just lying to themselves too. -- #debian-devel, OFTC, 2016-02-12