]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[PATCH] ufs: fix oops with `ufs1' type
authorEvgeniy Dushistov <dushistov@mail.ru>
Fri, 3 Feb 2006 11:04:04 +0000 (03:04 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 3 Feb 2006 16:32:04 +0000 (08:32 -0800)
"rm" command, on file system with "ufs1" type cause system hang up.  This
is, in fact, not so bad as it seems to be, because of after that in "kernel
control path" there are 3-4 places which may cause "oops".

So the first patch fix oopses, and the second patch fix "kernel hang up".

"oops" appears because of reading of group's summary info partly wrong, and
access to not first group's summary info cause "oops".

Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/ufs/super.c
include/linux/ufs_fs.h
include/linux/ufs_fs_sb.h

index d4aacee593ffbb9a2daec491518ff9c4bf3dfec0..e9055ef7f5ac97dbe33791e0d5f9c227a06985f9 100644 (file)
@@ -388,7 +388,8 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
 /*
  * Read on-disk structures associated with cylinder groups
  */
-static int ufs_read_cylinder_structures (struct super_block *sb) {
+static int ufs_read_cylinder_structures (struct super_block *sb)
+{
        struct ufs_sb_info * sbi = UFS_SB(sb);
        struct ufs_sb_private_info * uspi;
        struct ufs_super_block *usb;
@@ -415,6 +416,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
        base = space = kmalloc(size, GFP_KERNEL);
        if (!base)
                goto failed; 
+       sbi->s_csp = (struct ufs_csum *)space;
        for (i = 0; i < blks; i += uspi->s_fpb) {
                size = uspi->s_bsize;
                if (i + uspi->s_fpb > blks)
@@ -430,7 +432,6 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
                        goto failed;
 
                ubh_ubhcpymem (space, ubh, size);
-               sbi->s_csp[ufs_fragstoblks(i)]=(struct ufs_csum *)space;
 
                space += size;
                ubh_brelse (ubh);
@@ -486,7 +487,8 @@ failed:
  * Put on-disk structures associated with cylinder groups and 
  * write them back to disk
  */
-static void ufs_put_cylinder_structures (struct super_block *sb) {
+static void ufs_put_cylinder_structures (struct super_block *sb)
+{
        struct ufs_sb_info * sbi = UFS_SB(sb);
        struct ufs_sb_private_info * uspi;
        struct ufs_buffer_head * ubh;
@@ -499,7 +501,7 @@ static void ufs_put_cylinder_structures (struct super_block *sb) {
 
        size = uspi->s_cssize;
        blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift;
-       base = space = (char*) sbi->s_csp[0];
+       base = space = (char*) sbi->s_csp;
        for (i = 0; i < blks; i += uspi->s_fpb) {
                size = uspi->s_bsize;
                if (i + uspi->s_fpb > blks)
index 7a6babeca25619fdadfe639f5c9696822c7341e0..f26118ea1c58c21605da3af6d5f3f45f0a8e9d84 100644 (file)
@@ -502,8 +502,7 @@ struct ufs_super_block {
 /*
  * Convert cylinder group to base address of its global summary info.
  */
-#define fs_cs(indx) \
-       s_csp[(indx) >> uspi->s_csshift][(indx) & ~uspi->s_csmask]
+#define fs_cs(indx) s_csp[(indx)]
 
 /*
  * Cylinder group block for a file system.
index c1be4c2264862e0f768b6d1cc129eab37bea3400..8ff13c160f3d6a6bcba70055ccbec0d26d882317 100644 (file)
@@ -25,7 +25,7 @@ struct ufs_csum;
 
 struct ufs_sb_info {
        struct ufs_sb_private_info * s_uspi;    
-       struct ufs_csum * s_csp[UFS_MAXCSBUFS];
+       struct ufs_csum * s_csp;
        unsigned s_bytesex;
        unsigned s_flags;
        struct buffer_head ** s_ucg;