| 388 | &vnlru_nowhere, 0, "Number of times the vnlru process ran without success"); |
| 389 | |
| 390 | static int |
| 391 | sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS) |
| 392 | { |
| 393 | struct vnode *vp; |
| 394 | struct nameidata nd; |
| 395 | char *buf; |
| 396 | unsigned long ndflags; |
| 397 | int error; |
| 398 | |
| 399 | if (req->newptr == NULL) |
| 400 | return (EINVAL); |
| 401 | if (req->newlen >= PATH_MAX) |
| 402 | return (E2BIG); |
| 403 | |
| 404 | buf = malloc(PATH_MAX, M_TEMP, M_WAITOK); |
| 405 | error = SYSCTL_IN(req, buf, req->newlen); |
| 406 | if (error != 0) |
| 407 | goto out; |
| 408 | |
| 409 | buf[req->newlen] = '\0'; |
| 410 | |
| 411 | ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | SAVENAME; |
| 412 | NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf, curthread); |
| 413 | if ((error = namei(&nd)) != 0) |
| 414 | goto out; |
| 415 | vp = nd.ni_vp; |
| 416 | |
| 417 | if (VN_IS_DOOMED(vp)) { |
| 418 | /* |
| 419 | * This vnode is being recycled. Return != 0 to let the caller |
| 420 | * know that the sysctl had no effect. Return EAGAIN because a |
| 421 | * subsequent call will likely succeed (since namei will create |
| 422 | * a new vnode if necessary) |
| 423 | */ |
| 424 | error = EAGAIN; |
| 425 | goto putvnode; |
| 426 | } |
| 427 | |
| 428 | counter_u64_add(recycles_count, 1); |
| 429 | vgone(vp); |
| 430 | putvnode: |
| 431 | NDFREE(&nd, 0); |
| 432 | out: |
| 433 | free(buf, M_TEMP); |
| 434 | return (error); |
| 435 | } |
| 436 | |
| 437 | static int |
| 438 | sysctl_ftry_reclaim_vnode(SYSCTL_HANDLER_ARGS) |