Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177580261
D20519.1794792809.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D20519.1794792809.diff
View Options
Index: sys/kern/vfs_subr.c
===================================================================
--- sys/kern/vfs_subr.c
+++ sys/kern/vfs_subr.c
@@ -339,6 +339,62 @@
SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW,
&vnlru_nowhere, 0, "Number of times the vnlru process ran without success");
+static int
+sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS)
+{
+ struct vnode *vp;
+ struct nameidata nd;
+ char *buf;
+ unsigned long ndflags;
+ int error;
+
+ if (req->newptr == NULL)
+ return (EINVAL);
+
+ if (req->newlen > PATH_MAX)
+ return (E2BIG);
+
+ buf = malloc(PATH_MAX + 1, M_TEMP, M_WAITOK);
+ error = SYSCTL_IN(req, buf, req->newlen);
+ if (error != 0)
+ goto out;
+
+ buf[req->newlen] = '\0';
+
+ /*
+ * XXX It would be nice if there were a flag that could restrict namei
+ * from doing real I/O and limit it to just searching the cache.
+ */
+ ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | NOCACHE | SAVENAME;
+ NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf, curthread);
+ if ((error = namei(&nd)) != 0)
+ goto out;
+ vp = nd.ni_vp;
+
+ if ((vp->v_iflag & VI_DOOMED) != 0) {
+ /*
+ * This vnode is being recycled. Return != 0 to let the caller
+ * know that the sysctl had no effect. Return EAGAIN because a
+ * subsequent call will likely succeed (since namei will create
+ * a new vnode if necessary)
+ */
+ error = EAGAIN;
+ goto putvnode;
+ }
+
+ counter_u64_add(recycles_count, 1);
+ vgone(vp);
+putvnode:
+ NDFREE(&nd, 0);
+out:
+ free(buf, M_TEMP);
+ return (error);
+}
+
+SYSCTL_PROC(_debug, OID_AUTO, try_reclaim_vnode,
+ CTLTYPE_STRING | CTLFLAG_MPSAFE | CTLFLAG_WR, NULL, 0,
+ sysctl_try_reclaim_vnode, "A", "Try to reclaim a vnode by its pathname");
+
/* Shift count for (uintptr_t)vp to initialize vp->v_hash. */
static int vnsz2log;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 16, 1:33 AM (23 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41754218
Default Alt Text
D20519.1794792809.diff (1 KB)
Attached To
Mode
D20519: Add a debugging facility to manually reclaim a vnode
Attached
Detach File
Event Timeline