Lines Matching full:mp
73 static int vfs_hang_addrlist(struct mount *mp, struct netexport *nep,
102 vfs_hang_addrlist(struct mount *mp, struct netexport *nep,
128 if (mp->mnt_flag & MNT_DEFEXPORTED) {
129 vfs_mount_error(mp,
130 "MNT_DEFEXPORTED already set for mount %p", mp);
144 MNT_ILOCK(mp);
145 mp->mnt_flag |= MNT_DEFEXPORTED;
146 MNT_IUNLOCK(mp);
152 vfs_mount_error(mp, "ex_addrlen %d is greater than %d",
165 vfs_mount_error(mp, "Invalid saddr->sa_family: %d");
199 vfs_mount_error(mp, "%s %s %d",
209 vfs_mount_error(mp,
297 * The do_exjail argument should be true if *mp is in the mountlist
302 vfs_export(struct mount *mp, struct export_args *argp, bool do_exjail)
320 lockmgr(&mp->mnt_explock, LK_EXCLUSIVE, NULL);
321 nep = mp->mnt_export;
327 MNT_ILOCK(mp);
328 if (mp->mnt_exjail != NULL && mp->mnt_exjail->cr_prison != pr &&
330 MNT_IUNLOCK(mp);
334 } else if (mp->mnt_exjail != NULL &&
335 mp->mnt_exjail->cr_prison != pr) {
336 MNT_IUNLOCK(mp);
341 MNT_IUNLOCK(mp);
342 if (mp->mnt_flag & MNT_EXPUBLIC) {
344 MNT_ILOCK(mp);
345 mp->mnt_flag &= ~MNT_EXPUBLIC;
346 MNT_IUNLOCK(mp);
349 mp->mnt_export = NULL;
352 MNT_ILOCK(mp);
353 cr = mp->mnt_exjail;
354 mp->mnt_exjail = NULL;
355 mp->mnt_flag &= ~(MNT_EXPORTED | MNT_DEFEXPORTED);
356 MNT_IUNLOCK(mp);
364 MNT_ILOCK(mp);
365 if (mp->mnt_exjail == NULL) {
366 MNT_IUNLOCK(mp);
372 } else if (mp->mnt_exjail->cr_prison != pr) {
373 MNT_IUNLOCK(mp);
377 MNT_IUNLOCK(mp);
381 mp->mnt_export = nep;
385 if ((error = vfs_setpublicfs(mp, nep, argp)) != 0) {
387 mp->mnt_export = NULL;
393 MNT_ILOCK(mp);
394 if (do_exjail && mp->mnt_exjail == NULL) {
395 mp->mnt_exjail = crhold(curthread->td_ucred);
398 mp->mnt_flag |= MNT_EXPUBLIC;
399 MNT_IUNLOCK(mp);
405 if ((error = vfs_hang_addrlist(mp, nep, argp))) {
407 mp->mnt_export = NULL;
412 MNT_ILOCK(mp);
413 if (do_exjail && mp->mnt_exjail == NULL) {
414 mp->mnt_exjail = crhold(curthread->td_ucred);
417 mp->mnt_flag |= MNT_EXPORTED;
418 MNT_IUNLOCK(mp);
422 lockmgr(&mp->mnt_explock, LK_RELEASE, NULL);
428 * mp->mnt_export, so we can safely delete the "export" mount option
431 vfs_deleteopt(mp->mnt_optnew, "export");
432 vfs_deleteopt(mp->mnt_opt, "export");
442 struct mount *mp;
463 TAILQ_FOREACH(mp, &mountlist, mnt_list) {
464 MNT_ILOCK(mp);
465 if (mp->mnt_exjail != NULL &&
466 mp->mnt_exjail->cr_prison == pr) {
467 MNT_IUNLOCK(mp);
468 error = vfs_busy(mp, MBF_MNTLSTLOCK | MBF_NOWAIT);
482 MNT_ILOCK(mp);
483 if (mp->mnt_exjail != NULL &&
484 mp->mnt_exjail->cr_prison == pr) {
485 cr = mp->mnt_exjail;
486 mp->mnt_exjail = NULL;
488 MNT_IUNLOCK(mp);
498 lockmgr(&mp->mnt_explock, LK_EXCLUSIVE, NULL);
499 MNT_ILOCK(mp);
500 if (mp->mnt_exjail != NULL &&
501 mp->mnt_exjail->cr_prison == pr) {
502 cr = mp->mnt_exjail;
503 mp->mnt_exjail = NULL;
504 mp->mnt_flag &= ~(MNT_EXPORTED | MNT_DEFEXPORTED);
505 MNT_IUNLOCK(mp);
506 vfs_free_addrlist(mp->mnt_export);
507 free(mp->mnt_export, M_MOUNT);
508 mp->mnt_export = NULL;
510 MNT_IUNLOCK(mp);
511 lockmgr(&mp->mnt_explock, LK_RELEASE, NULL);
517 vfs_unbusy(mp);
522 MNT_IUNLOCK(mp);
532 vfs_setpublicfs(struct mount *mp, struct netexport *nep,
540 * mp == NULL -> invalidate the current info, the FS is
544 if (mp == NULL) {
558 if (nfs_pub.np_valid != 0 && mp != nfs_pub.np_mount)
565 nfs_pub.np_handle.fh_fsid = mp->mnt_stat.f_fsid;
567 if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp)))
602 nfs_pub.np_mount = mp;
614 vfs_export_lookup(struct mount *mp, struct sockaddr *nam)
622 nep = mp->mnt_export;
625 if ((mp->mnt_flag & MNT_EXPORTED) == 0)
654 if (np == NULL && (mp->mnt_flag & MNT_DEFEXPORTED) != 0)
670 vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam, uint64_t *extflagsp,
675 lockmgr(&mp->mnt_explock, LK_SHARED, NULL);
676 np = vfs_export_lookup(mp, nam);
678 lockmgr(&mp->mnt_explock, LK_RELEASE, NULL);
695 lockmgr(&mp->mnt_explock, LK_RELEASE, NULL);