From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755880AbbAaPAk (ORCPT ); Sat, 31 Jan 2015 10:00:40 -0500 Received: from metis.ext.pengutronix.de ([92.198.50.35]:33510 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753841AbbAaPAj (ORCPT ); Sat, 31 Jan 2015 10:00:39 -0500 Date: Sat, 31 Jan 2015 16:00:31 +0100 From: Markus Pargmann To: Paul Clements Cc: Wouter Verhelst , "nbd-general@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" Subject: Re: [RFC 4/4] nbd: Add support for nbd as root device Message-ID: <20150131150031.GJ16879@pengutronix.de> References: <1421156665-27318-1-git-send-email-mpa@pengutronix.de> <1421156665-27318-5-git-send-email-mpa@pengutronix.de> <20150129234254.GD15853@grep.be> <20150130080400.GD16879@pengutronix.de> <20150130173014.GA16754@grep.be> <20150131123821.GI16879@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1BdFSKqAqVdu8k/" Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 15:52:06 up 10 days, 4:59, 30 users, load average: 2.12, 1.89, 1.88 User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mpa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --k1BdFSKqAqVdu8k/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 31, 2015 at 08:52:18AM -0500, Paul Clements wrote: > On Saturday, January 31, 2015, Markus Pargmann wrote: >=20 > > On Fri, Jan 30, 2015 at 06:30:14PM +0100, Wouter Verhelst wrote: > > > On Fri, Jan 30, 2015 at 09:04:00AM +0100, Markus Pargmann wrote: > > > > Hi, > > > > > > > > On Fri, Jan 30, 2015 at 12:42:54AM +0100, Wouter Verhelst wrote: > > > > > Not that I'm opposed to this, but you do realize that doing > > nbd-client > > > > > from initramfs or similar is possible, right? Most initramfs > > > > > implementations these days support it. > > > > > > > > Yes, that was the first idea how to implement a complete netboot fo= r an > > > > embedded ARM device. However, an initramfs is at least around 1MB in > > > > size which has to be loaded using tftp. As the essential nbd-client > > > > connection setup and negotiation is quite small I decided to go with > > > > nbd-root support. > > > > > > > > Also it is quite useful to have nbd-root support much like nfsroot > > > > directly built-in for debugging purposes. It has the big advantage = of > > > > booting/testing read-only filesystem images for embedded systems > > without > > > > the need for an initramfs. > > > > > > Fair enough, just thought I'd point it out. > > > > > > When looking at your patch set, two things pop out which you should > > > probably look at: > > > - What will happen if someone boots with root-on-NBD in your scheme a= nd > > > later does a pivot_root() followed by an NBD_DISCONNECT ioctl on the > > > device? > > > > Good point. I will look if it works or fix it otherwise. > > > > > - When a connection is started by nbd-client, the kernel creates a "p= id" > > > file in sysfs, which contains the PID of the client and which the > > > client (when called with -c, or in other cases) uses to verify whet= her > > > a device is connected. At first glance, your patch does not do this, > > > which could cause confusion. > > > > I am actually not quite happy to expose the pid of the task that is > > doing the receive handling through sysfs. As it is already in the code, > > we can't simply remove it. But I think this should be managed by > > userspace if it is necessary at some point. It seems like the pid is > > only used for the connection status? > > > > > The pid is also used to break a hung connection. See nbd_xmit_timeout. I think nbd_xmit_timeout only uses task structs and is within the kernel. There is only a printk which uses the pid. > Also, see Michal Belcyk's patch for a further improvement to this. They a= re > both using pids to kill the hung threads. Yes there are some occurances of the nbd->pid field, but it seems it is not essential for the patch. The timeout issues are still on my todo to reproduce and fix them. Thanks, Markus --=20 Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --k1BdFSKqAqVdu8k/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUzO4PAAoJEEpcgKtcEGQQE68QAIoix7/U6bvHn/GtvP7zb+/3 vOPEphEeIhuQnC6k9907roIll3Y3iAFbTMLNfHFZcedEDEQelnc/hpXf67og9Qb3 05KNWWX6Dv3fNxNmILU1GFwZdyrttR0XjyMYdQLgFIVqom9aGIF/5kJ9TrolX/i4 acts8k+XYm7mBcuHKEEO5WMUSsE53FoBim5Kzue2gk7b44rGT4UgwdmMTo/ohty4 /SwsvOGycO0sw9dSY1fDogv+odd34bONzmo7SoqvzDqt/3ILRyw8qiGKk22gGxPC 5dIqkBkCXh79cJGQtt3xlzenN0J80gE2GED1b2n+hk2kYr6vubjUdcso0tG6MqmC oUtzDprvXjtWcjBXuLWrv1NCXevc5GO8+glQ+5kZcM58S8C1W3Xnf85fIh3EWZGz jZqM58Bk2BbfYxQhA7a4coK6PuxGNduvgom4IGzwVrdHaVxyLThZFy5uGB+KcIvD 3fwn3kDO0HCL56vcaIn+qpTm14cMtTxtxRSDxtF2qXun5+bT7t+qFwmoeERoKULK 5XpuwoWhk5f5FwnqspKVpFqWzY5CA+H3/2XXWHNUVwZGtNcQUcI+TXiMOlqrNsBH g+8AHP3S4cC/ftnLeZLcJ/Q5HtFpgxYQt/Wxi28yWGZj9Niia72iWCpVLBFYMYzW CPHLeNimhXU+S298maKA =CTOE -----END PGP SIGNATURE----- --k1BdFSKqAqVdu8k/--