PERFORCE change 85318 for review
soc-chenk
soc-chenk at FreeBSD.org
Fri Oct 14 16:41:15 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=85318
Change 85318 by soc-chenk at soc-chenk_leavemealone on 2005/10/14 23:40:32
Attempt to fix some known non-privilegedly accessible crash schemes
- tried to fix:
- forced unmount when being busy
- deadlocks by null mounts
Submitted by: soc-chenk
Affected files ...
.. //depot/projects/soc2005/fuse4bsd2/fuse_module/fuse.c#17 edit
Differences ...
==== //depot/projects/soc2005/fuse4bsd2/fuse_module/fuse.c#17 (text+ko) ====
@@ -333,8 +333,18 @@
out:
mtx_unlock(&caliban->answer_mtx);
- KASSERT(err || fuse_callbn_answered(caliban),
- ("fuse requester was woken up but still no answer"));
+ if (! (err || fuse_callbn_answered(caliban))) {
+ /*
+ * Some deadlocky scenarios can get us here, like SIGKILLing
+ * the fusexmp daemon after a fuse dir has been null mounted
+ * over its original copy in the "normal" fs
+ *
+ * (I guess there is no need of kicking the daemon at this
+ * point...)
+ */
+ DEBUG2G("fuse requester was woken up but still no answer");
+ err = ENXIO;
+ }
return (err);
}
@@ -3520,6 +3530,16 @@
panic("non-fat file passed to read routine");
vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY, td);
+
+ if (fp->f_vnode->v_type == VBAD) {
+#if _DEBUG2G
+ DEBUG2G("bad file\n");
+ vn_printf(fp->f_vnode, " * ");
+#endif
+ VOP_UNLOCK(fp->f_vnode, 0, td);
+ return (EBADF);
+ }
+
if ((flags & FOF_OFFSET) == 0)
uio->uio_offset = fp->f_offset;
@@ -4845,6 +4865,16 @@
return (0);
vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY, td);
+
+ if (fp->f_vnode->v_type == VBAD) {
+#if _DEBUG2G
+ DEBUG2G("bad file\n");
+ vn_printf(fp->f_vnode, " * ");
+#endif
+ VOP_UNLOCK(fp->f_vnode, 0, td);
+ return (EBADF);
+ }
+
if (fp->f_flag & O_APPEND) {
VOP_GETATTR(fp->f_vnode, &va, cred, td);
uio->uio_offset = va.va_size;
More information about the p4-projects
mailing list