Esempio n. 1
0
static int
smb_rq_enqueue(struct smb_rq *rqp)
{
    struct smb_share *ssp = rqp->sr_share;
    int error;

    if (ssp == NULL || rqp->sr_cred == &rqp->sr_vc->vc_iod->iod_scred) {
        return smb_iod_addrq(rqp);
    }
    for (;;) {
        SMBS_ST_LOCK(ssp);
        if (ssp->ss_flags & SMBS_RECONNECTING) {
            msleep(&ssp->ss_vcgenid, SMBS_ST_LOCKPTR(ssp),
                   PWAIT | PDROP, "90trcn", hz);
            if (smb_proc_intr(rqp->sr_cred->scr_p))
                return EINTR;
            continue;
        }
        if (smb_share_valid(ssp) || (ssp->ss_flags & SMBS_CONNECTED) == 0) {
            SMBS_ST_UNLOCK(ssp);
        } else {
            SMBS_ST_UNLOCK(ssp);
            error = smb_iod_request(rqp->sr_vc->vc_iod,
                                    SMBIOD_EV_TREECONNECT | SMBIOD_EV_SYNC, ssp);
            if (error)
                return error;
        }
        error = smb_iod_addrq(rqp);
        if (error != EXDEV)
            break;
    }
    return error;
}
Esempio n. 2
0
int
smb_rq_intr(struct smb_rq *rqp)
{
    struct proc *p = rqp->sr_cred->scr_p;

    if (rqp->sr_flags & SMBR_INTR)
        return EINTR;
    return smb_proc_intr(p);
}
Esempio n. 3
0
int
smb_rq_intr(struct smb_rq *rqp)
{
	struct thread *td = rqp->sr_cred->scr_td;

	if (rqp->sr_flags & SMBR_INTR)
		return EINTR;
	return smb_proc_intr(td);
}
Esempio n. 4
0
/*
 * Flush and invalidate all dirty buffers. If another process is already
 * doing the flush, just wait for completion.
 */
int
smbfs_vinvalbuf(struct vnode *vp, int flags, int intrflg)
{
	struct smbnode *np = VTOSMB(vp);
	int error = 0, slpflag, slptimeo;

	if (vp->v_flag & VRECLAIMED)
		return 0;
	if (intrflg) {
		slpflag = PCATCH;
		slptimeo = 2 * hz;
	} else {
		slpflag = 0;
		slptimeo = 0;
	}
	while (np->n_flag & NFLUSHINPROG) {
		np->n_flag |= NFLUSHWANT;
		error = tsleep((caddr_t)&np->n_flag, 0, "smfsvinv", slptimeo);
		error = smb_proc_intr(curthread);
		if (error == EINTR && intrflg)
			return EINTR;
	}
	np->n_flag |= NFLUSHINPROG;
	error = vinvalbuf(vp, flags, slpflag, 0);
	while (error) {
		if (intrflg && (error == ERESTART || error == EINTR)) {
			np->n_flag &= ~NFLUSHINPROG;
			if (np->n_flag & NFLUSHWANT) {
				np->n_flag &= ~NFLUSHWANT;
				wakeup((caddr_t)&np->n_flag);
			}
			return EINTR;
		}
		error = vinvalbuf(vp, flags, slpflag, 0);
	}
	np->n_flag &= ~(NMODIFIED | NFLUSHINPROG);
	if (np->n_flag & NFLUSHWANT) {
		np->n_flag &= ~NFLUSHWANT;
		wakeup((caddr_t)&np->n_flag);
	}
	return (error);
}