svn commit: r246472 - in head/sys: fs/devfs kern

Konstantin Belousov kib at FreeBSD.org
Thu Feb 7 14:53:34 UTC 2013


Author: kib
Date: Thu Feb  7 14:53:33 2013
New Revision: 246472
URL: http://svnweb.freebsd.org/changeset/base/246472

Log:
  Stop translating the ERESTART error from the open(2) into EINTR.
  Posix requires that open(2) is restartable for SA_RESTART.
  
  For non-posix objects, in particular, devfs nodes, still disable
  automatic restart of the opens. The open call to a driver could have
  significant side effects for the hardware.
  
  Noted and reviewed by:	jilles
  Discussed with:	bde
  MFC after:	2 weeks

Modified:
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Thu Feb  7 14:49:55 2013	(r246471)
+++ head/sys/fs/devfs/devfs_vnops.c	Thu Feb  7 14:53:33 2013	(r246472)
@@ -1089,8 +1089,11 @@ devfs_open(struct vop_open_args *ap)
 
 	vn_lock(vp, vlocked | LK_RETRY);
 	dev_relthread(dev, ref);
-	if (error)
+	if (error != 0) {
+		if (error == ERESTART)
+			error = EINTR;
 		return (error);
+	}
 
 #if 0	/* /dev/console */
 	KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp"));

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Thu Feb  7 14:49:55 2013	(r246471)
+++ head/sys/kern/vfs_syscalls.c	Thu Feb  7 14:53:33 2013	(r246472)
@@ -1106,8 +1106,6 @@ kern_openat(struct thread *td, int fd, c
 				goto success;
 		}
 
-		if (error == ERESTART)
-			error = EINTR;
 		goto bad;
 	}
 	td->td_dupfd = 0;


More information about the svn-src-all mailing list