cluster/gfs-kernel/src/gfs daemon.c glock.c in ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: rpeterso at sourceware.org 2006-12-21 20:58:38
Modified files:
gfs-kernel/src/gfs: daemon.c glock.c incore.h ops_fstype.c
ops_super.c unlinked.c
Log message:
Resolves: bz 219876: mount.gfs hangs if there are insufficient journals configured in the filesystem
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/daemon.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.7&r2=1.7.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glock.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.29&r2=1.29.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/incore.h.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.30&r2=1.30.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_fstype.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.28.4.1&r2=1.28.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_super.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.24.4.2&r2=1.24.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/unlinked.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.8&r2=1.8.4.1
gfs-kernel/src/gfs/daemon.c +15 -106
@@ -11,12 +11,11 @@******************************************************************************* ******************************************************************************/ +#include <linux/kthread.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/smp_lock.h> #include <linux/spinlock.h> -#include <asm/semaphore.h> -#include <linux/completion.h> #include <linux/buffer_head.h> #include "gfs.h"
@@ -41,26 +40,11 @@ {struct gfs_sbd *sdp = (struct gfs_sbd *)data; -daemonize ("gfs_scand" ); - sdp->sd_scand_process = current; -set_bit (SDF_SCAND_RUN , &sdp->sd_flags); -complete (&sdp->sd_thread_completion); - -for (;;) { +while (!kthread_should_stop ()) {gfs_scand_internal (sdp); - -if (!test_bit (SDF_SCAND_RUN , &sdp->sd_flags)) -break ; - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (gfs_tune_get (sdp, gt_scand_secs) *HZ ); +schedule_timeout_interruptible (gfs_tune_get (sdp, gt_scand_secs) *HZ ); } -down (&sdp->sd_thread_lock); -up (&sdp->sd_thread_lock); - -complete (&sdp->sd_thread_completion); -return 0 ; }
@@ -79,31 +63,15 @@ {struct gfs_sbd *sdp = (struct gfs_sbd *)data; -daemonize ("gfs_glockd" ); -set_bit (SDF_GLOCKD_RUN , &sdp->sd_flags); -complete (&sdp->sd_thread_completion); - -for (;;) { +while (!kthread_should_stop ()) {while (atomic_read (&sdp->sd_reclaim_count))gfs_reclaim_glock (sdp); -if (!test_bit (SDF_GLOCKD_RUN , &sdp->sd_flags)) -break ; - - { -DECLARE_WAITQUEUE (__wait_chan, current); -set_current_state (TASK_INTERRUPTIBLE ); -add_wait_queue (&sdp->sd_reclaim_wchan, &__wait_chan); -if (!atomic_read (&sdp->sd_reclaim_count) - &&test_bit (SDF_GLOCKD_RUN , &sdp->sd_flags)) -schedule (); -remove_wait_queue (&sdp->sd_reclaim_wchan, &__wait_chan); -set_current_state (TASK_RUNNING ); - } +wait_event_interruptible (sdp->sd_reclaim_wchan, + (atomic_read (&sdp->sd_reclaim_count) || +kthread_should_stop ())); } -complete (&sdp->sd_thread_completion); -return 0 ; }
@@ -118,26 +86,11 @@ {struct gfs_sbd *sdp = (struct gfs_sbd *)data; -daemonize ("gfs_recoverd" ); - sdp->sd_recoverd_process = current; -set_bit (SDF_RECOVERD_RUN , &sdp->sd_flags); -complete (&sdp->sd_thread_completion); - -for (;;) { +while (!kthread_should_stop ()) {gfs_check_journals (sdp); - -if (!test_bit (SDF_RECOVERD_RUN , &sdp->sd_flags)) -break ; - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (gfs_tune_get (sdp, gt_recoverd_secs) *HZ ); +schedule_timeout_interruptible (gfs_tune_get (sdp, gt_recoverd_secs) *HZ ); } -down (&sdp->sd_thread_lock); -up (&sdp->sd_thread_lock); - -complete (&sdp->sd_thread_completion); -return 0 ; }
@@ -155,12 +108,7 @@struct gfs_sbd *sdp = (struct gfs_sbd *)data;struct gfs_holder ji_gh; -daemonize ("gfs_logd" ); - sdp->sd_logd_process = current; -set_bit (SDF_LOGD_RUN , &sdp->sd_flags); -complete (&sdp->sd_thread_completion); - -for (;;) { +while (!kthread_should_stop ()) {/* Advance the log tail */ gfs_ail_empty (sdp);
@@ -174,18 +122,9 @@ sdp->sd_jindex_refresh_time = jiffies; } -if (!test_bit (SDF_LOGD_RUN , &sdp->sd_flags)) -break ; - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (gfs_tune_get (sdp, gt_logd_secs) *HZ ); +schedule_timeout_interruptible (gfs_tune_get (sdp, gt_logd_secs) *HZ ); } -down (&sdp->sd_thread_lock); -up (&sdp->sd_thread_lock); - -complete (&sdp->sd_thread_completion); -return 0 ; }
@@ -201,12 +140,7 @@struct gfs_sbd *sdp = (struct gfs_sbd *)data;int error; -daemonize ("gfs_quotad" ); - sdp->sd_quotad_process = current; -set_bit (SDF_QUOTAD_RUN , &sdp->sd_flags); -complete (&sdp->sd_thread_completion); - -for (;;) { +while (!kthread_should_stop ()) {/* Update quota file */ if (time_after_eq(jiffies, sdp->sd_quota_sync_time +
@@ -222,19 +156,9 @@/* Clean up */ gfs_quota_scan (sdp); - -if (!test_bit (SDF_QUOTAD_RUN , &sdp->sd_flags)) -break ; - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (gfs_tune_get (sdp, gt_quotad_secs) *HZ ); +schedule_timeout_interruptible (gfs_tune_get (sdp, gt_quotad_secs) *HZ ); } -down (&sdp->sd_thread_lock); -up (&sdp->sd_thread_lock); - -complete (&sdp->sd_thread_completion); -return 0 ; }
@@ -249,25 +173,10 @@ {struct gfs_sbd *sdp = (struct gfs_sbd *)data; -daemonize ("gfs_inoded" ); - sdp->sd_inoded_process = current; -set_bit (SDF_INODED_RUN , &sdp->sd_flags); -complete (&sdp->sd_thread_completion); - -for (;;) { +while (!kthread_should_stop ()) {gfs_unlinked_dealloc (sdp); - -if (!test_bit (SDF_INODED_RUN , &sdp->sd_flags)) -break ; - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (gfs_tune_get (sdp, gt_inoded_secs) *HZ ); +schedule_timeout_interruptible (gfs_tune_get (sdp, gt_inoded_secs) *HZ ); } -down (&sdp->sd_thread_lock); -up (&sdp->sd_thread_lock); - -complete (&sdp->sd_thread_completion); -return 0 ; }
gfs-kernel/src/gfs/glock.c +2 -3
@@ -19,7 +19,6 @@#include <linux/completion.h> #include <linux/buffer_head.h> #include <asm/uaccess.h> -#include <linux/lm_interface.h> #include "gfs.h" #include "dio.h"
@@ -2242,7 +2241,7 @@case LM_CB_NEED_RECOVERY :gfs_add_dirty_j (sdp, *(unsigned int *)data); -if (test_bit (SDF_RECOVERD_RUN , &sdp->sd_flags)) +if (sdp->sd_recoverd_process)wake_up_process (sdp->sd_recoverd_process);return ;
@@ -2710,7 +2709,7 @@ }invalidate_inodes (sdp->sd_vfs); -yield (); +schedule_timeout_interruptible (HZ /10 ); } }
gfs-kernel/src/gfs/incore.h +0 -12
@@ -930,14 +930,6 @@#define SDF_JOURNAL_LIVE (0)/* Journaling is active (journal is writeable)*/ #define SDF_SHUTDOWN (1)/* FS abnormaly shutdown */ -/* Run (1) / stop (0) flags for various daemons */ -#define SDF_SCAND_RUN (2)/* Put unused glocks on reclaim queue */ -#define SDF_GLOCKD_RUN (3)/* Reclaim (dealloc) unused glocks */ -#define SDF_RECOVERD_RUN (4)/* Recover journal of a crashed node */ -#define SDF_LOGD_RUN (5)/* Update log tail after AIL flushed */ -#define SDF_QUOTAD_RUN (6)/* Sync quota changes to file, cleanup */ -#define SDF_INODED_RUN (7)/* Deallocate unlinked inodes */ -/* (Re)mount options from Linux VFS */ #define SDF_NOATIME (8)/* Don't change access time */ #define SDF_ROFS (9)/* Read-only mode */
@@ -1077,10 +1069,6 @@/* Clean up unused inode structures */ struct task_struct *sd_inoded_process; -/* Support for starting/stopping daemons */ -struct semaphore sd_thread_lock; -struct completion sd_thread_completion; -/* Log stuff */ /* Transaction lock protects the following from one another:
gfs-kernel/src/gfs/ops_fstype.c +50 -22
177 lines not on this page · raw message
gfs-kernel/src/gfs/ops_super.c +7 -29
@@ -11,12 +11,12 @@******************************************************************************* ******************************************************************************/ +#include <linux/kthread.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/smp_lock.h> #include <linux/spinlock.h> #include <asm/semaphore.h> -#include <linux/completion.h> #include <linux/buffer_head.h> #include <linux/vmalloc.h> #include <linux/statfs.h>
@@ -112,45 +112,23 @@up (&sdp->sd_freeze_lock);/* Kill off the inode thread */ -down (&sdp->sd_thread_lock); -clear_bit (SDF_INODED_RUN , &sdp->sd_flags); -wake_up_process (sdp->sd_inoded_process); -up (&sdp->sd_thread_lock); -wait_for_completion (&sdp->sd_thread_completion); +kthread_stop (sdp->sd_inoded_process);/* Kill off the quota thread */ -down (&sdp->sd_thread_lock); -clear_bit (SDF_QUOTAD_RUN , &sdp->sd_flags); -wake_up_process (sdp->sd_quotad_process); -up (&sdp->sd_thread_lock); -wait_for_completion (&sdp->sd_thread_completion); +kthread_stop (sdp->sd_quotad_process);/* Kill off the log thread */ -down (&sdp->sd_thread_lock); -clear_bit (SDF_LOGD_RUN , &sdp->sd_flags); -wake_up_process (sdp->sd_logd_process); -up (&sdp->sd_thread_lock); -wait_for_completion (&sdp->sd_thread_completion); +kthread_stop (sdp->sd_logd_process);/* Kill off the recoverd thread */ -down (&sdp->sd_thread_lock); -clear_bit (SDF_RECOVERD_RUN , &sdp->sd_flags); -wake_up_process (sdp->sd_recoverd_process); -up (&sdp->sd_thread_lock); -wait_for_completion (&sdp->sd_thread_completion); +kthread_stop (sdp->sd_recoverd_process);/* Kill off the glockd threads */ -clear_bit (SDF_GLOCKD_RUN , &sdp->sd_flags); -wake_up (&sdp->sd_reclaim_wchan);while (sdp->sd_glockd_num--) -wait_for_completion (&sdp->sd_thread_completion); +kthread_stop (sdp->sd_glockd_process[sdp->sd_glockd_num]);/* Kill off the scand thread */ -down (&sdp->sd_thread_lock); -clear_bit (SDF_SCAND_RUN , &sdp->sd_flags); -wake_up_process (sdp->sd_scand_process); -up (&sdp->sd_thread_lock); -wait_for_completion (&sdp->sd_thread_completion); +kthread_stop (sdp->sd_scand_process);if (!test_bit (SDF_ROFS , &sdp->sd_flags)) { error =gfs_make_fs_ro (sdp);
gfs-kernel/src/gfs/unlinked.c +2 -1
@@ -11,6 +11,7 @@******************************************************************************* ******************************************************************************/ +#include <linux/kthread.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/smp_lock.h>
@@ -429,7 +430,7 @@ goto out; } -if (!hits || !test_bit (SDF_INODED_RUN , &sdp->sd_flags)) +if (!hits ||kthread_should_stop ())break ;cond_resched ();