lkml.org 
[lkml]   [2008]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@suse.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().



\
 
 \ /
  Last update: 2008-10-02 08:15    [W:1.290 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site