From owner-freebsd-standards@FreeBSD.ORG Mon Feb 4 18:31:22 2013 Return-Path: Delivered-To: standards@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 626426AD; Mon, 4 Feb 2013 18:31:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id CDE4523C; Mon, 4 Feb 2013 18:31:21 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r14IVHAo024022; Mon, 4 Feb 2013 20:31:17 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r14IVHAo024022 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r14IVHRL024021; Mon, 4 Feb 2013 20:31:17 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 4 Feb 2013 20:31:17 +0200 From: Konstantin Belousov To: jilles@freebsd.org Subject: ERESTART translation in kern_openat() Message-ID: <20130204183117.GD2522@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6s9pT91Bd/NCe2Rx" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: standards@freebsd.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 18:31:22 -0000 --6s9pT91Bd/NCe2Rx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, you noted somewhere that the unconditional translation of the ERESTART to EINTR, performed by kern_openat(), is wrong. I mostly agree with your statement, e.g. it is definitely wrong for fifos, but translation itself is useful for devfs, in my opinion. E.g., you do not want the tape unwind to be restarted this way. I propose not to remove the translation, but limit it to devfs only. See the patch below. Any comments ? diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 9851229..7da9b11 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1089,8 +1089,11 @@ devfs_open(struct vop_open_args *ap) =20 vn_lock(vp, vlocked | LK_RETRY); dev_relthread(dev, ref); - if (error) + if (error !=3D 0) { + if (error =3D=3D ERESTART) + error =3D EINTR; return (error); + } =20 #if 0 /* /dev/console */ KASSERT(fp !=3D NULL, ("Could not vnode bypass device on NULL fp")); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 1a5f2ae..dd1232c 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1106,8 +1106,6 @@ kern_openat(struct thread *td, int fd, char *path, en= um uio_seg pathseg, goto success; } =20 - if (error =3D=3D ERESTART) - error =3D EINTR; goto bad; } td->td_dupfd =3D 0; --6s9pT91Bd/NCe2Rx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRD/50AAoJEJDCuSvBvK1B02QP/jo4u3aphkfNQWkzQxgfHoFa fuMkTlvcfJypIWj0JPHNzGFBq9UHDC6IV6glidr5vKzkeTznPQS9jHk+d5VFHR8c cKeHXFw4r/fBMqpsZXxfU4mNvJZnN5hmJIF+bkoO/LkSUkA1OaJGA/JW7sZ2KceU 67s+v15arnhKp7OR5Jy79ezhbNeA2t0QnqTTt1Z5AfMbj6oZoGV+H8fMBzjpvMT2 Er+9nQgZsEfRYKKdo4iSRGs1FRyiirs4KXb/CHXsnbEXZ6VubYS4xKnBepnN+1Ta /a4SvHQqcg30eGim8YmVXtl4G/DMZOtNvuueXYWpixb89rh7bUgO1HOAD88jsPQz y6cj5Gopyj1Nhh/hFsxKVwRyjdhyJDQ+AXDxBWPomGRYINgXwemXz8FbLPPP+0ur E+d3oqKEDuOBNB7CjWWWDWtu3ww7VqTs/r7r11RNPtaePvvqimKnYQYha9MOVshQ iHgvMneFMhIGRr3Q2MNBzcKyDBe6Hp2F6NGsIVkAUPovIRPR8UbY1itrJCegzKkd glDYRKuxBzw3Y0MV84SsRm9V6DIiottauFl22CMNP/GuBDj06vYSQLnnr6E/etYo 98NI+LB+uXMDmnJS/XDtJTYSoso9FJhWQMGzuv22uyqCOF34NfnCQ0zuQtCQJPD7 g2ISPFw8GdPdESk/+WBH =1zYv -----END PGP SIGNATURE----- --6s9pT91Bd/NCe2Rx--