/* We make this a static variable rather than a part of the superblock; it *isbetterifwedon'treassignnumberseasilyevenacrossfilesystems
*/ static autofs_wqt_t autofs_next_wait_queue = 1;
mutex_lock(&sbi->pipe_mutex); while (bytes) {
wr = __kernel_write(file, data, bytes, NULL); if (wr <= 0) break;
data += wr;
bytes -= wr;
}
mutex_unlock(&sbi->pipe_mutex);
/* Keep the currently executing process from receiving a *SIGPIPEunlessitwasalreadysupposedtogetone
*/ if (wr == -EPIPE && !sigpipe) {
spin_lock_irqsave(¤t->sighand->siglock, flags);
sigdelset(¤t->pending.signal, SIGPIPE);
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
/* if 'wr' returned 0 (impossible) we assume -EIO (safe) */ return bytes == 0 ? 0 : wr < 0 ? wr : -EIO;
}
staticvoid autofs_notify_daemon(struct autofs_sb_info *sbi, struct autofs_wait_queue *wq, int type)
{ union { struct autofs_packet_hdr hdr; union autofs_packet_union v4_pkt; union autofs_v5_packet_union v5_pkt;
} pkt; struct file *pipe = NULL;
size_t pktsz; int ret;
pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n",
(unsignedlong) wq->wait_queue_token,
wq->name.len, wq->name.name, type);
memset(&pkt, 0, sizeof(pkt)); /* For security reasons */
if (d_really_is_negative(dentry)) { /* *Awaitforanegativedentryisinvalidforcertain *cases.Adirectoroffsetmount"always"hasitsmount *pointdirectorycreatedandsotherequestdentrymust *bepositiveorthemapkeydoesn'texist.Thesituation *isverysimilarforindirectmountsexceptonlydentrys *intherootoftheautofsfilesystemmaybenegative.
*/ if (autofs_type_trigger(sbi->type)) return -ENOENT; elseif (!IS_ROOT(dentry->d_parent)) return -ENOENT;
}
name = kmalloc(NAME_MAX + 1, GFP_KERNEL); if (!name) return -ENOMEM;
/* If this is a direct mount request create a dummy name */ if (IS_ROOT(dentry) && autofs_type_trigger(sbi->type)) {
qstr.name = name;
qstr.len = sprintf(name, "%p", dentry);
} else { char *p = dentry_path_raw(dentry, name, NAME_MAX); if (IS_ERR(p)) {
kfree(name); return -ENOENT;
}
qstr.name = ++p; // skip the leading slash
qstr.len = strlen(p);
offset = p - name;
}
qstr.hash = full_name_hash(dentry, qstr.name, qstr.len);
if (mutex_lock_interruptible(&sbi->wq_mutex)) {
kfree(name); return -EINTR;
}
ret = validate_request(&wq, sbi, &qstr, path, notify); if (ret <= 0) { if (ret != -EINTR)
mutex_unlock(&sbi->wq_mutex);
kfree(name); return ret;
}
if (!wq) { /* Create a new wait queue */
wq = kmalloc(sizeof(struct autofs_wait_queue), GFP_KERNEL); if (!wq) {
kfree(name);
mutex_unlock(&sbi->wq_mutex); return -ENOMEM;
}
/* direct mount or browsable map */
ino = autofs_dentry_ino(dentry); if (!ino) { /* If not lookup actual dentry used */
de = d_lookup(dentry->d_parent, &dentry->d_name); if (de)
ino = autofs_dentry_ino(de);
}
/* Set mount requester */ if (ino) {
spin_lock(&sbi->fs_lock);
ino->uid = wq->uid;
ino->gid = wq->gid;
spin_unlock(&sbi->fs_lock);
}
if (de)
dput(de);
}
/* Are we the last process to need status? */
mutex_lock(&sbi->wq_mutex); if (!--wq->wait_ctr)
kfree(wq);
mutex_unlock(&sbi->wq_mutex);
return status;
}
int autofs_wait_release(struct autofs_sb_info *sbi,
autofs_wqt_t wait_queue_token, int status)
{ struct autofs_wait_queue *wq, **wql;
mutex_lock(&sbi->wq_mutex); for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { if (wq->wait_queue_token == wait_queue_token) break;
}
if (!wq) {
mutex_unlock(&sbi->wq_mutex); return -EINVAL;
}
*wql = wq->next; /* Unlink from chain */
kfree(wq->name.name - wq->offset);
wq->name.name = NULL; /* Do not wait on this queue */
wq->status = status;
wake_up(&wq->queue); if (!--wq->wait_ctr)
kfree(wq);
mutex_unlock(&sbi->wq_mutex);
return0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.23 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.