537
538 return (error);
539 }
540
541 /*
542 * Loop in a file or directory into the namespace.
543 */
544 static int
545 hyprlofs_add_entry(vnode_t *vp, char *fspath, char *fsname,
546 cred_t *cr, caller_context_t *ct)
547 {
548 int error;
549 char *p, *pnm;
550 vnode_t *realvp, *dvp;
551 vattr_t va;
552
553 /*
554 * Get vnode for the real file/dir. We'll have a hold on realvp which
555 * we won't vn_rele until hyprlofs_inactive.
556 */
557 if (error = lookupname(fspath, UIO_SYSSPACE, FOLLOW, NULLVPP, &realvp))
558 return (error);
559
560 /* no devices allowed */
561 if (IS_DEVVP(realvp)) {
562 VN_RELE(realvp);
563 return (ENODEV);
564 }
565
566 /*
567 * realvp may be an AUTOFS node, in which case we perform a VOP_ACCESS
568 * to trigger the mount of the intended filesystem. This causes a
569 * loopback mount of the intended filesystem instead of the AUTOFS
570 * filesystem.
571 */
572 if ((error = VOP_ACCESS(realvp, 0, 0, cr, NULL)) != 0) {
573 VN_RELE(realvp);
574 return (error);
575 }
576
577 /*
578 * We're interested in the top most filesystem. This is specially
579 * important when fspath is a trigger AUTOFS node, since we're really
580 * interested in mounting the filesystem AUTOFS mounted as result of
581 * the VOP_ACCESS() call not the AUTOFS node itself.
582 */
583 if (vn_mountedvfs(realvp) != NULL) {
584 if (error = traverse(&realvp)) {
585 VN_RELE(realvp);
586 return (error);
587 }
588 }
589
590 va.va_type = VNON;
591 /*
592 * If the target name is a path, make sure we have all of the
593 * intermediate directories, creating them if necessary.
594 */
595 dvp = vp;
596 pnm = p = fsname;
597
598 /* path cannot be absolute */
599 if (*p == '/') {
600 VN_RELE(realvp);
601 return (EINVAL);
602 }
603
604 for (p = strchr(pnm, '/'); p != NULL; p = strchr(pnm, '/')) {
|
537
538 return (error);
539 }
540
541 /*
542 * Loop in a file or directory into the namespace.
543 */
544 static int
545 hyprlofs_add_entry(vnode_t *vp, char *fspath, char *fsname,
546 cred_t *cr, caller_context_t *ct)
547 {
548 int error;
549 char *p, *pnm;
550 vnode_t *realvp, *dvp;
551 vattr_t va;
552
553 /*
554 * Get vnode for the real file/dir. We'll have a hold on realvp which
555 * we won't vn_rele until hyprlofs_inactive.
556 */
557 if ((error = lookupname(fspath, UIO_SYSSPACE, FOLLOW, NULLVPP,
558 &realvp)) != 0)
559 return (error);
560
561 /* no devices allowed */
562 if (IS_DEVVP(realvp)) {
563 VN_RELE(realvp);
564 return (ENODEV);
565 }
566
567 /*
568 * realvp may be an AUTOFS node, in which case we perform a VOP_ACCESS
569 * to trigger the mount of the intended filesystem. This causes a
570 * loopback mount of the intended filesystem instead of the AUTOFS
571 * filesystem.
572 */
573 if ((error = VOP_ACCESS(realvp, 0, 0, cr, NULL)) != 0) {
574 VN_RELE(realvp);
575 return (error);
576 }
577
578 /*
579 * We're interested in the top most filesystem. This is specially
580 * important when fspath is a trigger AUTOFS node, since we're really
581 * interested in mounting the filesystem AUTOFS mounted as result of
582 * the VOP_ACCESS() call not the AUTOFS node itself.
583 */
584 if (vn_mountedvfs(realvp) != NULL) {
585 if ((error = traverse(&realvp)) != 0) {
586 VN_RELE(realvp);
587 return (error);
588 }
589 }
590
591 va.va_type = VNON;
592 /*
593 * If the target name is a path, make sure we have all of the
594 * intermediate directories, creating them if necessary.
595 */
596 dvp = vp;
597 pnm = p = fsname;
598
599 /* path cannot be absolute */
600 if (*p == '/') {
601 VN_RELE(realvp);
602 return (EINVAL);
603 }
604
605 for (p = strchr(pnm, '/'); p != NULL; p = strchr(pnm, '/')) {
|