[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081001231150.c1cd67b0.akpm@linux-foundation.org>
Date: Wed, 1 Oct 2008 23:11:50 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Mark Fasheh <mfasheh@...e.com>
Cc: linux-kernel@...r.kernel.org, joel.becker@...cle.com,
ocfs2-devel@....oracle.com, linux-fsdevel@...r.kernel.org,
mfasheh@...e.com
Subject: Re: [PATCH 03/39] ocfs2: throttle back local alloc when low on disk
space
> On Wed, 24 Sep 2008 15:00:44 -0700 Mark Fasheh <mfasheh@...e.com> wrote:
> +void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb,
> + unsigned int num_clusters)
> +{
> + spin_lock(&osb->osb_lock);
> + if (osb->local_alloc_state == OCFS2_LA_DISABLED ||
> + osb->local_alloc_state == OCFS2_LA_THROTTLED)
> + if (num_clusters >= osb->local_alloc_default_bits) {
> + cancel_delayed_work(&osb->la_enable_wq);
> + osb->local_alloc_state = OCFS2_LA_ENABLED;
> + }
> + spin_unlock(&osb->osb_lock);
> +}
> +
> +void ocfs2_la_enable_worker(struct work_struct *work)
> +{
> + struct ocfs2_super *osb =
> + container_of(work, struct ocfs2_super,
> + la_enable_wq.work);
> + spin_lock(&osb->osb_lock);
> + osb->local_alloc_state = OCFS2_LA_ENABLED;
> + spin_unlock(&osb->osb_lock);
> +}
cacnel_delayed_work() is a pretty risky function. The work handler
(ocfs2_la_enable_worker) can execute an arbitrarily long time after
cancel_delayed_work() has returned. Can all the code here cope with such a
surprise alteration of ->local_alloc_state()?
And you canot use cancel_delayed_work_sync() here due to a deadlock on
->osb_lock().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists