From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs-kernel/src/gfs ops_fstype.c ops_su ...
Date: 21 Dec 2006 20:50:45 -0000 [thread overview]
Message-ID: <20061221205045.9443.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-12-21 20:50:44
Modified files:
gfs-kernel/src/gfs: ops_fstype.c ops_super.c incore.h glock.c
daemon.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/ops_fstype.c.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_super.c.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/incore.h.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glock.c.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/daemon.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/unlinked.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
--- cluster/gfs-kernel/src/gfs/ops_fstype.c 2006/12/19 20:06:44 1.29
+++ cluster/gfs-kernel/src/gfs/ops_fstype.c 2006/12/21 20:50:43 1.30
@@ -86,9 +86,6 @@
init_MUTEX(&sdp->sd_freeze_lock);
- init_MUTEX(&sdp->sd_thread_lock);
- init_completion(&sdp->sd_thread_completion);
-
spin_lock_init(&sdp->sd_log_seg_lock);
INIT_LIST_HEAD(&sdp->sd_log_seg_list);
init_waitqueue_head(&sdp->sd_log_seg_wait);
@@ -279,11 +276,10 @@
struct super_block *sb = sdp->sd_vfs;
struct gfs_holder sb_gh;
int error = 0;
- int super = TRUE;
+ struct inode *inode;
- if (undo) {
- return 0;
- }
+ if (undo)
+ goto fail_dput;
/* Read the SuperBlock from disk, get enough info to enable us
to read-in the journal index and replay all journals. */
@@ -312,13 +308,13 @@
if (sdp->sd_sb.sb_bsize < bdev_hardsect_size(sb->s_bdev)) {
printk("GFS: fsid=%s: FS block size (%u) is too small for device block size (%u)\n",
sdp->sd_fsname, sdp->sd_sb.sb_bsize, bdev_hardsect_size(sb->s_bdev));
- goto out;
+ goto fail;
}
if (sdp->sd_sb.sb_bsize > PAGE_SIZE) {
printk("GFS: fsid=%s: FS block size (%u) is too big for machine page size (%u)\n",
sdp->sd_fsname, sdp->sd_sb.sb_bsize,
(unsigned int)PAGE_SIZE);
- goto out;
+ goto fail;
}
/* Get rid of buffers from the original block size */
@@ -333,7 +329,7 @@
if (error) {
printk("GFS: fsid=%s: can't get resource index inode: %d\n",
sdp->sd_fsname, error);
- goto out;
+ goto fail;
}
/* Get the root inode */
@@ -341,12 +337,22 @@
if (error) {
printk("GFS: fsid=%s: can't read in root inode: %d\n",
sdp->sd_fsname, error);
- goto out;
+ goto fail_ri_free;
+ }
+ /* Get the root inode/dentry */
+
+ inode = gfs_iget(sdp->sd_rooti, CREATE);
+ if (!inode) {
+ printk("GFS: fsid=%s: can't get root inode\n", sdp->sd_fsname);
+ error = -ENOMEM;
+ goto fail_ri_free;
}
- sb->s_root = d_alloc_root(gfs_iget(sdp->sd_rooti, TRUE));
+ sb->s_root = d_alloc_root(inode);
if (!sb->s_root) {
- printk("GFS: can't get root dentry\n");
+ iput(inode);
+ printk("GFS: fsid=%s: can't get root dentry\n", sdp->sd_fsname);
error = -ENOMEM;
+ goto fail_root_free;
}
sb->s_root->d_op = &gfs_dops;
@@ -355,13 +361,28 @@
if (error) {
printk("GFS: fsid=%s: can't get quota file inode: %d\n",
sdp->sd_fsname, error);
- goto out;
+ goto fail_root_free;
}
/* We're through with the superblock lock */
out:
gfs_glock_dq_uninit(&sb_gh);
- super = FALSE;
+ return error;
+
+fail_dput:
+ if (sb->s_root) {
+ dput(sb->s_root);
+ sb->s_root = NULL;
+ }
+ gfs_inode_put(sdp->sd_qinode);
+fail_root_free:
+ gfs_inode_put(sdp->sd_rooti);
+fail_ri_free:
+ gfs_inode_put(sdp->sd_riinode);
+ gfs_clear_rgrpd(sdp);
+fail:
+ if (!undo)
+ gfs_glock_dq_uninit(&sb_gh);
return error;
}
@@ -386,7 +407,7 @@
error = gfs_glock_get(sdp, GFS_TRANS_LOCK, &gfs_trans_glops,
CREATE, &sdp->sd_trans_gl);
if (error)
- goto fail;
+ return error;
set_bit(GLF_STICKY, &sdp->sd_trans_gl->gl_flags);
/* Load in the journal index special file */
@@ -395,7 +416,7 @@
if (error) {
printk("GFS: fsid=%s: can't read journal index: %d\n",
sdp->sd_fsname, error);
- goto fail_jindex;
+ goto fail_jhold;
}
if (sdp->sd_args.ar_spectator) {
@@ -469,7 +490,7 @@
if (error) {
printk("GFS: fsid=%s: can't make file system RW: %d\n",
sdp->sd_fsname, error);
- goto fail;
+ goto fail_journal_gh;
}
}
@@ -497,7 +518,9 @@
fail_jindex:
if (jindex)
gfs_glock_dq_uninit(&ji_gh);
-fail:
+
+fail_jhold:
+ gfs_glock_put(sdp->sd_trans_gl);
return error;
}
@@ -533,7 +556,7 @@
/* Start up the inoded thread */
- error = kernel_thread(gfs_inoded, sdp, 0);
+ p = kthread_run(gfs_inoded, sdp, "gfs_inoded");
if (error < 0) {
printk("GFS: fsid=%s: can't start inoded thread: %d\n",
sdp->sd_fsname, error);
@@ -543,7 +566,7 @@
return 0;
fail_logd:
- kthread_stop(sdp->sd_logd_process);
+ kthread_stop(sdp->sd_inoded_process);
fail_inoded:
kthread_stop(sdp->sd_quotad_process);
fail_quotad:
@@ -663,7 +686,7 @@
if (error) {
printk("GFS: fsid=%s: can't get journal index inode: %d\n",
sdp->sd_fsname, error);
- goto fail_sb;
+ goto fail_jiinode;
}
error = init_journal(sdp, DO);
@@ -689,13 +712,18 @@
init_journal(sdp, UNDO);
fail_sb:
+ gfs_inode_put(sdp->sd_jiinode);
+
+fail_jiinode:
init_sb(sdp, 0, UNDO);
fail_locking:
init_locking(sdp, &mount_gh, UNDO);
fail_lm:
+ gfs_gl_hash_clear(sdp, TRUE);
gfs_lm_unmount(sdp);
+ gfs_clear_dirty_j(sdp);
while (invalidate_inodes(sb))
yield();
--- cluster/gfs-kernel/src/gfs/ops_super.c 2006/12/05 22:29:43 1.26
+++ cluster/gfs-kernel/src/gfs/ops_super.c 2006/12/21 20:50:43 1.27
@@ -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);
--- cluster/gfs-kernel/src/gfs/incore.h 2006/10/23 20:15:28 1.30
+++ cluster/gfs-kernel/src/gfs/incore.h 2006/12/21 20:50:43 1.31
@@ -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:
--- cluster/gfs-kernel/src/gfs/glock.c 2006/09/20 18:48:56 1.29
+++ cluster/gfs-kernel/src/gfs/glock.c 2006/12/21 20:50:43 1.30
@@ -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);
}
}
--- cluster/gfs-kernel/src/gfs/daemon.c 2006/07/10 23:22:34 1.7
+++ cluster/gfs-kernel/src/gfs/daemon.c 2006/12/21 20:50:43 1.8
@@ -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;
}
--- cluster/gfs-kernel/src/gfs/unlinked.c 2006/07/10 23:22:34 1.8
+++ cluster/gfs-kernel/src/gfs/unlinked.c 2006/12/21 20:50:43 1.9
@@ -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();
next reply other threads:[~2006-12-21 20:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-21 20:50 rpeterso [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-06-19 21:06 [Cluster-devel] cluster/gfs-kernel/src/gfs ops_fstype.c ops_su wcheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061221205045.9443.qmail@sourceware.org \
--to=rpeterso@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.