Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 10-20-2017, 01:53 AM   #1
LQ Newbie
Registered: Oct 2017
Posts: 2

Rep: Reputation: Disabled
Unhappy how rcu list entry be protected in ip_vs_add_dest() & ip_vs_del_dest() [centos 7.2 kernel 3.10.327]

I was trying to learn ip_vs and linux rcu mechanism these days!and some codes related to rcu list confused me! How can svc list been protected if there is two task trying to del dest in the same svc list?
About __ip_vs_unlink_dest(), it doesn't protect svc destinations when it del dest from svc destination list

static void __ip_vs_unlink_dest(struct ip_vs_service *svc,
				struct ip_vs_dest *dest,
				int svcupd)
	dest->flags &= ~IP_VS_DEST_F_AVAILABLE;

	 *  Remove it from the d-linked destination list.

	if (svcupd) {
		struct ip_vs_scheduler *sched;

		sched = rcu_dereference_protected(svc->scheduler, 1);
		if (sched->del_dest)
			sched->del_dest(svc, dest);
when add dest in ip_vs_update_dest
tatic void
__ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
		    struct ip_vs_dest_user_kern *udest, int add)
	struct netns_ipvs *ipvs = net_ipvs(svc->net);
	struct ip_vs_scheduler *sched;
	int conn_flags;

	/* set the weight and the flags */
	atomic_set(&dest->weight, udest->weight);
	conn_flags = udest->conn_flags & IP_VS_CONN_F_DEST_MASK;
	conn_flags |= IP_VS_CONN_F_INACTIVE;

	/* set the IP_VS_CONN_F_NOOUTPUT flag if not masquerading/NAT */
	if ((conn_flags & IP_VS_CONN_F_FWD_MASK) != IP_VS_CONN_F_MASQ) {
		conn_flags |= IP_VS_CONN_F_NOOUTPUT;
	} else {
		 *    Put the real service in rs_table if not present.
		 *    For now only for NAT!
		ip_vs_rs_hash(ipvs, dest);
	atomic_set(&dest->conn_flags, conn_flags);

	/* bind the service */
	if (!dest->svc) {
		__ip_vs_bind_svc(dest, svc);
	} else {
		if (dest->svc != svc) {
			__ip_vs_bind_svc(dest, svc);

	/* set the dest status flags */
	dest->flags |= IP_VS_DEST_F_AVAILABLE;

	if (udest->u_threshold == 0 || udest->u_threshold > dest->u_threshold)
		dest->flags &= ~IP_VS_DEST_F_OVERLOAD;
	dest->u_threshold = udest->u_threshold;
	dest->l_threshold = udest->l_threshold;


	sched = rcu_dereference_protected(svc->scheduler, 1);
	if (add) {
		ip_vs_start_estimator(svc->net, &dest->stats);
		list_add_rcu(&dest->n_list, &svc->destinations);
		if (sched->add_dest)
			sched->add_dest(svc, dest);
	} else {
		if (sched->upd_dest)
			sched->upd_dest(svc, dest);


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Will not boot after update to kernel 3.10.0-327.13.1 Nick_C CentOS 2 07-20-2016 09:24 AM
Kernel 4.4.1-1 fails to boot - root volume “does not exist” - and 4.3.3-1 both continue to boot fine ifrazer Linux - General 7 03-03-2016 11:49 PM
Unable to remove generic kernel entry from LILO boot list Pinonoir Linux - Desktop 1 05-08-2014 02:56 PM
LXer: Linux 2.6.38 could improve kernel performance by 50 percent, thanks to new RCU lookup. LXer Syndicated Linux News 0 01-19-2011 10:20 PM
C++ password-protected entry into program J_K9 Programming 3 07-12-2005 01:11 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration