Date: Mon, 4 Feb 2013 20:31:17 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: jilles@freebsd.org Cc: standards@freebsd.org Subject: ERESTART translation in kern_openat() Message-ID: <20130204183117.GD2522@kib.kiev.ua>
next in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130204183117.GD2522>