summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-11-06 09:10:25 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-11-06 09:10:25 -0800
commit64651309a1f0de3da131c8dc1d279c932fa979c7 (patch)
treeee90f6a40fc8c731963eb459124fb32753f20113 /fs
parentb7651030a56b9aa80e9cb43b4c8bb28b89c42359 (diff)
parente2de7f565521a76fbbb927f701c5a1d381c71a93 (diff)
downloadlinux-64651309a1f0de3da131c8dc1d279c932fa979c7.tar.gz
linux-64651309a1f0de3da131c8dc1d279c932fa979c7.tar.bz2
linux-64651309a1f0de3da131c8dc1d279c932fa979c7.zip
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.c14
-rw-r--r--fs/gfs2/inode.c3
-rw-r--r--fs/gfs2/main.c4
-rw-r--r--fs/gfs2/ops_super.c44
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)
ssize_t ret = len;
int n = simple_strtol(buf, NULL, 0);
+ ls = dlm_find_lockspace_local(ls->ls_local_handle);
+ if (!ls)
+ return -EINVAL;
+
switch (n) {
case 0:
dlm_ls_stop(ls);
@@ -53,6 +57,7 @@ static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len)
default:
ret = -EINVAL;
}
+ dlm_put_lockspace(ls);
return ret;
}
@@ -143,6 +148,12 @@ static ssize_t dlm_attr_store(struct kobject *kobj, struct attribute *attr,
return a->store ? a->store(ls, buf, len) : len;
}
+static void lockspace_kobj_release(struct kobject *k)
+{
+ struct dlm_ls *ls = container_of(k, struct dlm_ls, ls_kobj);
+ kfree(ls);
+}
+
static struct sysfs_ops dlm_attr_ops = {
.show = dlm_attr_show,
.store = dlm_attr_store,
@@ -151,6 +162,7 @@ static struct sysfs_ops dlm_attr_ops = {
static struct kobj_type dlm_ktype = {
.default_attrs = dlm_attrs,
.sysfs_ops = &dlm_attr_ops,
+ .release = lockspace_kobj_release,
};
static struct kset dlm_kset = {
@@ -678,7 +690,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)
dlm_clear_members_gone(ls);
kfree(ls->ls_node_array);
kobject_unregister(&ls->ls_kobj);
- kfree(ls);
+ /* The ls structure will be freed when the kobject is done with */
mutex_lock(&ls_lock);
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,
struct gfs2_glock *io_gl;
int error;
+ if (!inode)
+ return ERR_PTR(-ENOBUFS);
+
if (inode->i_state & I_NEW) {
struct gfs2_sbd *sdp = GFS2_SB(inode);
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)
gfs2_inode_cachep = kmem_cache_create("gfs2_inode",
sizeof(struct gfs2_inode),
- 0, (SLAB_RECLAIM_ACCOUNT|
- SLAB_PANIC|SLAB_MEM_SPREAD),
+ 0, SLAB_RECLAIM_ACCOUNT|
+ SLAB_MEM_SPREAD,
gfs2_init_inode_once, NULL);
if (!gfs2_inode_cachep)
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)
}
/**
- * gfs2_write_super - disk commit all incore transactions
- * @sb: the filesystem
+ * gfs2_write_super
+ * @sb: the superblock
*
- * This function is called every time sync(2) is called.
- * After this exits, all dirty buffers are synced.
*/
static void gfs2_write_super(struct super_block *sb)
{
+ sb->s_dirt = 0;
+}
+
+/**
+ * gfs2_sync_fs - sync the filesystem
+ * @sb: the superblock
+ *
+ * Flushes the log to disk.
+ */
+static int gfs2_sync_fs(struct super_block *sb, int wait)
+{
+ sb->s_dirt = 0;
gfs2_log_flush(sb->s_fs_info, NULL);
+ return 0;
}
/**
@@ -452,17 +463,18 @@ static void gfs2_destroy_inode(struct inode *inode)
}
struct super_operations gfs2_super_ops = {
- .alloc_inode = gfs2_alloc_inode,
- .destroy_inode = gfs2_destroy_inode,
- .write_inode = gfs2_write_inode,
- .delete_inode = gfs2_delete_inode,
- .put_super = gfs2_put_super,
- .write_super = gfs2_write_super,
- .write_super_lockfs = gfs2_write_super_lockfs,
- .unlockfs = gfs2_unlockfs,
- .statfs = gfs2_statfs,
- .remount_fs = gfs2_remount_fs,
- .clear_inode = gfs2_clear_inode,
- .show_options = gfs2_show_options,
+ .alloc_inode = gfs2_alloc_inode,
+ .destroy_inode = gfs2_destroy_inode,
+ .write_inode = gfs2_write_inode,
+ .delete_inode = gfs2_delete_inode,
+ .put_super = gfs2_put_super,
+ .write_super = gfs2_write_super,
+ .sync_fs = gfs2_sync_fs,
+ .write_super_lockfs = gfs2_write_super_lockfs,
+ .unlockfs = gfs2_unlockfs,
+ .statfs = gfs2_statfs,
+ .remount_fs = gfs2_remount_fs,
+ .clear_inode = gfs2_clear_inode,
+ .show_options = gfs2_show_options,
};