diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-06 12:10:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-06 12:10:25 -0500 |
commit | 64651309a1f0de3da131c8dc1d279c932fa979c7 (patch) | |
tree | ee90f6a40fc8c731963eb459124fb32753f20113 /fs | |
parent | b7651030a56b9aa80e9cb43b4c8bb28b89c42359 (diff) | |
parent | e2de7f565521a76fbbb927f701c5a1d381c71a93 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
[DLM] fix oops in kref_put when removing a lockspace
[DLM] Fix kref_put oops
[GFS2] Fix OOM error handling
[GFS2] Fix incorrect fs sync behaviour.
[GFS2] don't panic needlessly
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dlm/lockspace.c | 14 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 3 | ||||
-rw-r--r-- | fs/gfs2/main.c | 4 | ||||
-rw-r--r-- | fs/gfs2/ops_super.c | 44 |
4 files changed, 46 insertions, 19 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 109333c8ecb9..f8842ca443c2 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -43,6 +43,10 @@ static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len) | |||
43 | ssize_t ret = len; | 43 | ssize_t ret = len; |
44 | int n = simple_strtol(buf, NULL, 0); | 44 | int n = simple_strtol(buf, NULL, 0); |
45 | 45 | ||
46 | ls = dlm_find_lockspace_local(ls->ls_local_handle); | ||
47 | if (!ls) | ||
48 | return -EINVAL; | ||
49 | |||
46 | switch (n) { | 50 | switch (n) { |
47 | case 0: | 51 | case 0: |
48 | dlm_ls_stop(ls); | 52 | dlm_ls_stop(ls); |
@@ -53,6 +57,7 @@ static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len) | |||
53 | default: | 57 | default: |
54 | ret = -EINVAL; | 58 | ret = -EINVAL; |
55 | } | 59 | } |
60 | dlm_put_lockspace(ls); | ||
56 | return ret; | 61 | return ret; |
57 | } | 62 | } |
58 | 63 | ||
@@ -143,6 +148,12 @@ static ssize_t dlm_attr_store(struct kobject *kobj, struct attribute *attr, | |||
143 | return a->store ? a->store(ls, buf, len) : len; | 148 | return a->store ? a->store(ls, buf, len) : len; |
144 | } | 149 | } |
145 | 150 | ||
151 | static void lockspace_kobj_release(struct kobject *k) | ||
152 | { | ||
153 | struct dlm_ls *ls = container_of(k, struct dlm_ls, ls_kobj); | ||
154 | kfree(ls); | ||
155 | } | ||
156 | |||
146 | static struct sysfs_ops dlm_attr_ops = { | 157 | static struct sysfs_ops dlm_attr_ops = { |
147 | .show = dlm_attr_show, | 158 | .show = dlm_attr_show, |
148 | .store = dlm_attr_store, | 159 | .store = dlm_attr_store, |
@@ -151,6 +162,7 @@ static struct sysfs_ops dlm_attr_ops = { | |||
151 | static struct kobj_type dlm_ktype = { | 162 | static struct kobj_type dlm_ktype = { |
152 | .default_attrs = dlm_attrs, | 163 | .default_attrs = dlm_attrs, |
153 | .sysfs_ops = &dlm_attr_ops, | 164 | .sysfs_ops = &dlm_attr_ops, |
165 | .release = lockspace_kobj_release, | ||
154 | }; | 166 | }; |
155 | 167 | ||
156 | static struct kset dlm_kset = { | 168 | static struct kset dlm_kset = { |
@@ -678,7 +690,7 @@ static int release_lockspace(struct dlm_ls *ls, int force) | |||
678 | dlm_clear_members_gone(ls); | 690 | dlm_clear_members_gone(ls); |
679 | kfree(ls->ls_node_array); | 691 | kfree(ls->ls_node_array); |
680 | kobject_unregister(&ls->ls_kobj); | 692 | kobject_unregister(&ls->ls_kobj); |
681 | kfree(ls); | 693 | /* The ls structure will be freed when the kobject is done with */ |
682 | 694 | ||
683 | mutex_lock(&ls_lock); | 695 | mutex_lock(&ls_lock); |
684 | ls_count--; | 696 | ls_count--; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 57c43ac47925..d470e5286ecd 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -157,6 +157,9 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum *inum, | |||
157 | struct gfs2_glock *io_gl; | 157 | struct gfs2_glock *io_gl; |
158 | int error; | 158 | int error; |
159 | 159 | ||
160 | if (!inode) | ||
161 | return ERR_PTR(-ENOBUFS); | ||
162 | |||
160 | if (inode->i_state & I_NEW) { | 163 | if (inode->i_state & I_NEW) { |
161 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 164 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
162 | umode_t mode = DT2IF(type); | 165 | umode_t mode = DT2IF(type); |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 21508a13bb78..9889c1eacec1 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -84,8 +84,8 @@ static int __init init_gfs2_fs(void) | |||
84 | 84 | ||
85 | gfs2_inode_cachep = kmem_cache_create("gfs2_inode", | 85 | gfs2_inode_cachep = kmem_cache_create("gfs2_inode", |
86 | sizeof(struct gfs2_inode), | 86 | sizeof(struct gfs2_inode), |
87 | 0, (SLAB_RECLAIM_ACCOUNT| | 87 | 0, SLAB_RECLAIM_ACCOUNT| |
88 | SLAB_PANIC|SLAB_MEM_SPREAD), | 88 | SLAB_MEM_SPREAD, |
89 | gfs2_init_inode_once, NULL); | 89 | gfs2_init_inode_once, NULL); |
90 | if (!gfs2_inode_cachep) | 90 | if (!gfs2_inode_cachep) |
91 | goto fail; | 91 | goto fail; |
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c index 06f06f7773d0..b47d9598c047 100644 --- a/fs/gfs2/ops_super.c +++ b/fs/gfs2/ops_super.c | |||
@@ -138,16 +138,27 @@ static void gfs2_put_super(struct super_block *sb) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * gfs2_write_super - disk commit all incore transactions | 141 | * gfs2_write_super |
142 | * @sb: the filesystem | 142 | * @sb: the superblock |
143 | * | 143 | * |
144 | * This function is called every time sync(2) is called. | ||
145 | * After this exits, all dirty buffers are synced. | ||
146 | */ | 144 | */ |
147 | 145 | ||
148 | static void gfs2_write_super(struct super_block *sb) | 146 | static void gfs2_write_super(struct super_block *sb) |
149 | { | 147 | { |
148 | sb->s_dirt = 0; | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * gfs2_sync_fs - sync the filesystem | ||
153 | * @sb: the superblock | ||
154 | * | ||
155 | * Flushes the log to disk. | ||
156 | */ | ||
157 | static int gfs2_sync_fs(struct super_block *sb, int wait) | ||
158 | { | ||
159 | sb->s_dirt = 0; | ||
150 | gfs2_log_flush(sb->s_fs_info, NULL); | 160 | gfs2_log_flush(sb->s_fs_info, NULL); |
161 | return 0; | ||
151 | } | 162 | } |
152 | 163 | ||
153 | /** | 164 | /** |
@@ -452,17 +463,18 @@ static void gfs2_destroy_inode(struct inode *inode) | |||
452 | } | 463 | } |
453 | 464 | ||
454 | struct super_operations gfs2_super_ops = { | 465 | struct super_operations gfs2_super_ops = { |
455 | .alloc_inode = gfs2_alloc_inode, | 466 | .alloc_inode = gfs2_alloc_inode, |
456 | .destroy_inode = gfs2_destroy_inode, | 467 | .destroy_inode = gfs2_destroy_inode, |
457 | .write_inode = gfs2_write_inode, | 468 | .write_inode = gfs2_write_inode, |
458 | .delete_inode = gfs2_delete_inode, | 469 | .delete_inode = gfs2_delete_inode, |
459 | .put_super = gfs2_put_super, | 470 | .put_super = gfs2_put_super, |
460 | .write_super = gfs2_write_super, | 471 | .write_super = gfs2_write_super, |
461 | .write_super_lockfs = gfs2_write_super_lockfs, | 472 | .sync_fs = gfs2_sync_fs, |
462 | .unlockfs = gfs2_unlockfs, | 473 | .write_super_lockfs = gfs2_write_super_lockfs, |
463 | .statfs = gfs2_statfs, | 474 | .unlockfs = gfs2_unlockfs, |
464 | .remount_fs = gfs2_remount_fs, | 475 | .statfs = gfs2_statfs, |
465 | .clear_inode = gfs2_clear_inode, | 476 | .remount_fs = gfs2_remount_fs, |
466 | .show_options = gfs2_show_options, | 477 | .clear_inode = gfs2_clear_inode, |
478 | .show_options = gfs2_show_options, | ||
467 | }; | 479 | }; |
468 | 480 | ||