Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ad53eee authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds
Browse files

afs: add afs_wq and use it instead of the system workqueue



flush_scheduled_work() is going away.  afs needs to make sure all the
works it has queued have finished before being unloaded and there can
be arbitrary number of pending works.  Add afs_wq and use it as the
flush domain instead of the system workqueue.

Also, convert cancel_delayed_work() + flush_scheduled_work() to
cancel_delayed_work_sync() in afs_mntpt_kill_timer().

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e1fcc7e2
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -289,7 +289,7 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb,
	call->server = server;

	INIT_WORK(&call->work, SRXAFSCB_CallBack);
	schedule_work(&call->work);
	queue_work(afs_wq, &call->work);
	return 0;
}

@@ -336,7 +336,7 @@ static int afs_deliver_cb_init_call_back_state(struct afs_call *call,
	call->server = server;

	INIT_WORK(&call->work, SRXAFSCB_InitCallBackState);
	schedule_work(&call->work);
	queue_work(afs_wq, &call->work);
	return 0;
}

@@ -367,7 +367,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call,
	call->server = server;

	INIT_WORK(&call->work, SRXAFSCB_InitCallBackState);
	schedule_work(&call->work);
	queue_work(afs_wq, &call->work);
	return 0;
}

@@ -400,7 +400,7 @@ static int afs_deliver_cb_probe(struct afs_call *call, struct sk_buff *skb,
	call->state = AFS_CALL_REPLYING;

	INIT_WORK(&call->work, SRXAFSCB_Probe);
	schedule_work(&call->work);
	queue_work(afs_wq, &call->work);
	return 0;
}

@@ -496,7 +496,7 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call, struct sk_buff *skb,
	call->state = AFS_CALL_REPLYING;

	INIT_WORK(&call->work, SRXAFSCB_ProbeUuid);
	schedule_work(&call->work);
	queue_work(afs_wq, &call->work);
	return 0;
}

@@ -580,6 +580,6 @@ static int afs_deliver_cb_tell_me_about_yourself(struct afs_call *call,
	call->state = AFS_CALL_REPLYING;

	INIT_WORK(&call->work, SRXAFSCB_TellMeAboutYourself);
	schedule_work(&call->work);
	queue_work(afs_wq, &call->work);
	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -577,6 +577,7 @@ extern int afs_drop_inode(struct inode *);
/*
 * main.c
 */
extern struct workqueue_struct *afs_wq;
extern struct afs_uuid afs_uuid;

/*
+11 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ module_param(rootcell, charp, 0);
MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");

struct afs_uuid afs_uuid;
struct workqueue_struct *afs_wq;

/*
 * get a client UUID
@@ -87,10 +88,16 @@ static int __init afs_init(void)
	if (ret < 0)
		return ret;

	/* create workqueue */
	ret = -ENOMEM;
	afs_wq = alloc_workqueue("afs", 0, 0);
	if (!afs_wq)
		return ret;

	/* register the /proc stuff */
	ret = afs_proc_init();
	if (ret < 0)
		return ret;
		goto error_proc;

#ifdef CONFIG_AFS_FSCACHE
	/* we want to be able to cache */
@@ -140,6 +147,8 @@ static int __init afs_init(void)
error_cache:
#endif
	afs_proc_cleanup();
error_proc:
	destroy_workqueue(afs_wq);
	rcu_barrier();
	printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
	return ret;
@@ -163,7 +172,7 @@ static void __exit afs_exit(void)
	afs_purge_servers();
	afs_callback_update_kill();
	afs_vlocation_purge();
	flush_scheduled_work();
	destroy_workqueue(afs_wq);
	afs_cell_purge();
#ifdef CONFIG_AFS_FSCACHE
	fscache_unregister_netfs(&afs_cache_netfs);
+5 −6
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
		path_put(&nd->path);
		nd->path.mnt = newmnt;
		nd->path.dentry = dget(newmnt->mnt_root);
		schedule_delayed_work(&afs_mntpt_expiry_timer,
		queue_delayed_work(afs_wq, &afs_mntpt_expiry_timer,
				   afs_mntpt_expiry_timeout * HZ);
		break;
	case -EBUSY:
@@ -295,7 +295,7 @@ static void afs_mntpt_expiry_timed_out(struct work_struct *work)

	if (!list_empty(&afs_vfsmounts)) {
		mark_mounts_for_expiry(&afs_vfsmounts);
		schedule_delayed_work(&afs_mntpt_expiry_timer,
		queue_delayed_work(afs_wq, &afs_mntpt_expiry_timer,
				   afs_mntpt_expiry_timeout * HZ);
	}

@@ -310,6 +310,5 @@ void afs_mntpt_kill_timer(void)
	_enter("");

	ASSERT(list_empty(&afs_vfsmounts));
	cancel_delayed_work(&afs_mntpt_expiry_timer);
	flush_scheduled_work();
	cancel_delayed_work_sync(&afs_mntpt_expiry_timer);
}
+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ static void afs_rx_interceptor(struct sock *sk, unsigned long user_call_ID,
	if (!call) {
		/* its an incoming call for our callback service */
		skb_queue_tail(&afs_incoming_calls, skb);
		schedule_work(&afs_collect_incoming_call_work);
		queue_work(afs_wq, &afs_collect_incoming_call_work);
	} else {
		/* route the messages directly to the appropriate call */
		skb_queue_tail(&call->rx_queue, skb);
Loading