spin_lock(&nlm_blocked_lock);
list_del(&block->b_list);
status = block->b_status;
spin_unlock(&nlm_blocked_lock); return status;
}
/* *Blockonalock
*/ int nlmclnt_wait(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
{ long ret;
/* A borken server might ask us to block even if we didn't *requestit.Justsayno!
*/ if (block == NULL) return -EAGAIN;
/* Go to sleep waiting for GRANT callback. Some servers seem *tolosecallbacks,however,sowe'regoingtopollfrom *timetotimejusttomakesure. * *Fornow,theretryfrequencyisprettyhigh;normally *a1minutetimeoutwoulddo.Seethecommentbefore *nlmclnt_lockforanexplanation.
*/
ret = wait_event_interruptible_timeout(block->b_wait,
block->b_status != nlm_lck_blocked,
timeout); if (ret < 0) return -ERESTARTSYS; /* Reset the lock status after a server reboot so we resend */ if (block->b_status == nlm_lck_denied_grace_period)
block->b_status = nlm_lck_blocked; return0;
}
if (fl_blocked->fl_start != fl->fl_start) continue; if (fl_blocked->fl_end != fl->fl_end) continue; /* *Careful!TheNLMserverwillreturnthe32-bit"pid"that *weputonthewire:inthiscasethelockowner"pid".
*/ if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid) continue; if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) continue; if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->c.flc_file)), fh) != 0) continue; /* Alright, we found a lock. Set the return status *andwakeupthecaller
*/
block->b_status = nlm_granted;
wake_up(&block->b_wait);
res = nlm_granted;
}
spin_unlock(&nlm_blocked_lock);
trace_nlmclnt_grant(lock, addr, svc_addr_len(addr), res); return res;
}
req = kmalloc(sizeof(*req), GFP_KERNEL); if (!req) return0;
allow_signal(SIGKILL);
down_write(&host->h_rwsem);
lockd_up(net, NULL); /* note: this cannot fail as lockd is already running */
dprintk("lockd: reclaiming locks for host %s\n", host->h_name);
restart:
nsmstate = host->h_nsmstate;
/* Force a portmap getport - the peer's lockd will *mostlikelyenduponadifferentport.
*/
host->h_nextrebind = jiffies;
nlm_rebind_host(host);
/* First, reclaim all locks that have been granted. */
list_splice_init(&host->h_granted, &host->h_reclaim);
list_for_each_entry_safe(fl, next, &host->h_reclaim, fl_u.nfs_fl.list) {
list_del_init(&fl->fl_u.nfs_fl.list);
/* *sendingthisthreadaSIGKILLwillresultinanyunreclaimed *locksbeingremovedfromtheh_grantedlist.Thismeansthat *thekernelwillnotattempttoreclaimthemagainifanew *reclaimerthreadisspawnedforthishost.
*/ if (signalled()) continue; if (nlmclnt_reclaim(host, fl, req) != 0) continue;
list_add_tail(&fl->fl_u.nfs_fl.list, &host->h_granted); if (host->h_nsmstate != nsmstate) { /* Argh! The server rebooted again! */ goto restart;
}
}
/* Now, wake up all processes that sleep on a blocked lock */
spin_lock(&nlm_blocked_lock);
list_for_each_entry(block, &nlm_blocked, b_list) { if (block->b_host == host) {
block->b_status = nlm_lck_denied_grace_period;
wake_up(&block->b_wait);
}
}
spin_unlock(&nlm_blocked_lock);
/* Release host handle after use */
nlmclnt_release_host(host);
lockd_down(net);
kfree(req); return0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-09-29)
¤
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.