fs/smb/smbdirect/accept.c

Source file repositories/reference/linux-study-clean/fs/smb/smbdirect/accept.c

File Facts

System
Linux kernel
Corpus path
fs/smb/smbdirect/accept.c
Extension
.c
Size
25834 bytes
Lines
858
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

if (timeo == 0) {
			arg->err = -EAGAIN;
			return NULL;
		}

		ret = smbdirect_socket_wait_for_accept(lsc, timeo);
		if (ret) {
			arg->err = ret;
			return NULL;
		}
	}

	spin_lock_irqsave(&lsc->listen.lock, flags);
	nsc = list_first_entry_or_null(&lsc->listen.ready,
				       struct smbdirect_socket,
				       accept.list);
	if (nsc) {
		nsc->accept.listener = NULL;
		list_del_init_careful(&nsc->accept.list);
		arg->is_empty = list_empty_careful(&lsc->listen.ready);
	}
	spin_unlock_irqrestore(&lsc->listen.lock, flags);
	if (!nsc) {
		arg->err = -EAGAIN;
		return NULL;
	}

	/*
	 * We did not send the negotiation response
	 * yet, so we did not grant any credits to the client,
	 * so it didn't grant any credits to us.
	 *
	 * The caller expects a connected socket
	 * now as there are no credits anyway.
	 *
	 * Then we send the negotiation response in
	 * order to grant credits to the peer.
	 */
	nsc->status = SMBDIRECT_SOCKET_CONNECTED;
	smbdirect_accept_negotiate_finish(nsc, 0);

	return nsc;
}
EXPORT_SYMBOL_GPL(smbdirect_socket_accept);

Annotation

Implementation Notes