Re: [PATCH 15/24] Unionfs: Privileged operations workqueue

From: Andrew Morton
Date: Mon Jan 08 2007 - 16:29:01 EST


On Sun, 7 Jan 2007 23:13:07 -0500
"Josef 'Jeff' Sipek" <jsipek@xxxxxxxxxxxxx> wrote:

> From: Josef "Jeff" Sipek <jsipek@xxxxxxxxxxxxx>
>
> Workqueue & helper functions used to perform privileged operations on
> behalf of the user process.
>
> Signed-off-by: Josef "Jeff" Sipek <jsipek@xxxxxxxxxxxxx>
> Signed-off-by: David Quigley <dquigley@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Erez Zadok <ezk@xxxxxxxxxxxxx>
> +
>
> ...
>
> +#include "union.h"
> +
> +/* Super-user IO work Queue - sometimes we need to perform actions which
> + * would fail due to the unix permissions on the parent directory (e.g.,
> + * rmdir a directory which appears empty, but in reality contains
> + * whiteouts).
> + */
> +
> +struct workqueue_struct *sioq;

Rather a terse identifier for a global symbol.

> +int __init init_sioq(void)
> +{
> + int err;
> +
> + sioq = create_workqueue("unionfs_siod");
> + if (!IS_ERR(sioq))
> + return 0;
> +
> + err = PTR_ERR(sioq);
> + printk(KERN_ERR "create_workqueue failed %d\n", err);
> + sioq = NULL;
> + return err;
> +}
> +
> +void __exit stop_sioq(void)
> +{
> + if (sioq)
> + destroy_workqueue(sioq);
> +}
> +
> +void run_sioq(work_func_t func, struct sioq_args *args)
> +{
> + INIT_WORK(&args->work, func);
> +
> + init_completion(&args->comp);
> + while (!queue_work(sioq, &args->work)) {
> + /* TODO: do accounting if needed */
> + schedule();
> + }

That's a busywait.

> + wait_for_completion(&args->comp);
> +}
> +
>
> ...
>
> +void __delete_whiteouts(struct work_struct *work) {

Misplaced brace.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/