Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Make sure perfused exit when the filesystem crashed, so that...
details: https://anonhg.NetBSD.org/src/rev/b0e1075cf3ec
branches: trunk
changeset: 773486:b0e1075cf3ec
user: manu <manu%NetBSD.org@localhost>
date: Fri Feb 03 15:54:15 2012 +0000
description:
Make sure perfused exit when the filesystem crashed, so that unmount
is done. Failure to do so caused deadlocks, with operation that
held a lock on the root vnode and got stuck in perfused forever.
Approved by releng.
diffstat:
lib/libperfuse/perfuse.c | 4 +++-
usr.sbin/perfused/msg.c | 25 ++++++++++++++++---------
usr.sbin/perfused/perfused.c | 12 +++++++++++-
usr.sbin/perfused/perfused.h | 4 +++-
4 files changed, 33 insertions(+), 12 deletions(-)
diffs (139 lines):
diff -r 39c724198461 -r b0e1075cf3ec lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c Fri Feb 03 15:42:46 2012 +0000
+++ b/lib/libperfuse/perfuse.c Fri Feb 03 15:54:15 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfuse.c,v 1.24 2011/12/28 17:33:53 manu Exp $ */
+/* $NetBSD: perfuse.c,v 1.25 2012/02/03 15:54:15 manu Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -242,6 +242,7 @@
/* NOTREACHED */
break;
case 0:
+ (void)close(sv[0]);
(void)execve(argv[0], argv, environ);
#ifdef PERFUSE_DEBUG
DWARN("%s:%d: execve failed", __func__, __LINE__);
@@ -253,6 +254,7 @@
break;
}
+ (void)close(sv[1]);
return sv[0];
}
diff -r 39c724198461 -r b0e1075cf3ec usr.sbin/perfused/msg.c
--- a/usr.sbin/perfused/msg.c Fri Feb 03 15:42:46 2012 +0000
+++ b/usr.sbin/perfused/msg.c Fri Feb 03 15:54:15 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.c,v 1.18 2012/01/30 22:49:03 christos Exp $ */
+/* $NetBSD: msg.c,v 1.19 2012/02/03 15:54:15 manu Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -488,14 +488,13 @@
switch (readen = recv(fd, data, len, MSG_NOSIGNAL|MSG_PEEK)) {
case 0:
- DWARNX("%s: recv retunred 0", __func__);
- return ECONNRESET;
+ perfused_panic();
/* NOTREACHED */
break;
case -1:
if (errno == EAGAIN)
return 0;
- DWARN("%s: recv retunred -1", __func__);
+ DWARN("%s: recv returned -1", __func__);
return errno;
/* NOTREACHED */
break;
@@ -535,14 +534,15 @@
switch (readen = recv(fd, data, len, MSG_NOSIGNAL)) {
case 0:
- DWARNX("%s: recv retunred 0", __func__);
- return ECONNRESET;
+ DWARNX("%s: recv returned 0", __func__);
+ perfused_panic();
+
/* NOTREACHED */
break;
case -1:
if (errno == EAGAIN)
return 0;
- DWARN("%s: recv retunred -1", __func__);
+ DWARN("%s: recv returned -1", __func__);
return errno;
/* NOTREACHED */
break;
@@ -574,18 +574,25 @@
switch (written = send(fd, data, len, MSG_NOSIGNAL)) {
case 0:
- DWARNX("%s: send retunred 0", __func__);
+#ifdef PERFUSE_DEBUG
+ DERRX(EX_SOFTWARE, "%s: send returned 0", __func__);
+#else
return ECONNRESET;
+#endif
/* NOTREACHED */
break;
case -1:
- DWARN("%s: send retunred -1, errno = %d", __func__, errno);
+ DWARN("%s: send returned -1, errno = %d", __func__, errno);
switch(errno) {
case EAGAIN:
case ENOBUFS:
case EMSGSIZE:
return 0;
break;
+ case EPIPE:
+ perfused_panic();
+ /* NOTREACHED */
+ break;
default:
return errno;
break;
diff -r 39c724198461 -r b0e1075cf3ec usr.sbin/perfused/perfused.c
--- a/usr.sbin/perfused/perfused.c Fri Feb 03 15:42:46 2012 +0000
+++ b/usr.sbin/perfused/perfused.c Fri Feb 03 15:54:15 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfused.c,v 1.20 2012/01/30 22:49:03 christos Exp $ */
+/* $NetBSD: perfused.c,v 1.21 2012/02/03 15:54:15 manu Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -481,3 +481,13 @@
/* NOTREACHED */
return 0;
}
+
+void
+perfused_panic(void)
+{
+ DWARNX("filesystem crashed");
+ exit(EX_OK);
+
+ /* NOTREACHED */
+ return;
+}
diff -r 39c724198461 -r b0e1075cf3ec usr.sbin/perfused/perfused.h
--- a/usr.sbin/perfused/perfused.h Fri Feb 03 15:42:46 2012 +0000
+++ b/usr.sbin/perfused/perfused.h Fri Feb 03 15:54:15 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfused.h,v 1.8 2012/01/30 22:49:03 christos Exp $ */
+/* $NetBSD: perfused.h,v 1.9 2012/02/03 15:54:15 manu Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -66,6 +66,8 @@
int perfused_xchg_pb(struct puffs_usermount *, perfuse_msg_t *, size_t,
enum perfuse_xchg_pb_reply);
+void perfused_panic(void);
+
__END_DECLS
#endif /* _PERFUSED_H_ */
Home |
Main Index |
Thread Index |
Old Index