Skip to contentSkip to conversation

Submitting patches for unmaintained areas (Solaris x86 UFS bug)

DISCUSSION Alex Kiernan 4 participants 10 messages Oct 13, 2004 – Oct 19, 2004

lore
Share & tools
lore
#0 lore raw

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

Signature · 1 line
Alex Kiernan
#1 lore raw
Quoted 8 lines · Alex Kiernan

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

After advice from Alan (thanks), here's the patch which addresses the problem I'm seeing. Specifically it appears that on x86 Solaris stores the major/minor device numbers in the 2nd indirect block, not the first.

Signature · 1 line
Alex Kiernan

===== namei.c 1.24 vs edited =====

namei.c renamed from fs/ufs/namei.c +3 -2
@@ -30,6 +30,7 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 #include "swab.h"	/* will go away - see comment in mknod() */
+#include "util.h"
 
 /*
 #undef UFS_NAMEI_DEBUG
@@ -125,8 +126,8 @@
 	if (!IS_ERR(inode)) {
 		init_special_inode(inode, mode, rdev);
 		/* NOTE: that'll go when we get wide dev_t */
-		UFS_I(inode)->i_u1.i_data[0] = cpu_to_fs32(inode->i_sb,
-							old_encode_dev(rdev));
+		ufs_set_inode_dev(inode->i_sb, UFS_I(inode),
+			old_encode_dev(rdev));
 		mark_inode_dirty(inode);
 		lock_kernel();
 		err = ufs_add_nondir(dentry, inode);

===== inode.c 1.24 vs edited =====

inode.c renamed from fs/ufs/inode.c +2 -2
@@ -629,7 +629,7 @@
 		}
 	} else
 		init_special_inode(inode, inode->i_mode,
-			old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
+			old_decode_dev(ufs_get_inode_dev(sb, ufsi)));
 
 	brelse (bh);
 
@@ -705,7 +705,7 @@
 		}
 	} else   /* TODO  : here ...*/
 		init_special_inode(inode, inode->i_mode,
-			old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
+			old_decode_dev(ufs_get_inode_dev(sb, ufsi)));
 
 	brelse(bh);
 

===== util.h 1.9 vs edited =====

util.h renamed from fs/ufs/util.h +18 -0
@@ -223,6 +223,24 @@
 	inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
 }
 
+static inline u32
+ufs_get_inode_dev(struct super_block *sb, struct ufs_inode_info *inode)
+{
+	if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86)
+		return fs32_to_cpu(sb, ufsi->i_u1.i_data[1]);
+	else
+		return fs32_to_cpu(sb, ufsi->i_u1.i_data[0]);
+}
+
+static inline void
+ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *inode, u32 value)
+{
+	if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86)
+		ufsi->i_u1.i_data[1] = cpu_to_fs32(sb, value);
+	else
+		ufsi->i_u1.i_data[0] = cpu_to_fs32(sb, value);
+}
+
 
 /*
  * These functions manipulate ufs buffers
#2 lore raw
Quoted 6 lines · Alex Kiernan
Quoted 5 lines · Alex Kiernan

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

Quoted 8 lines
Quoted 3 lines

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

After advice from Alan (thanks), here's the patch which addresses the problem I'm seeing. Specifically it appears that on x86 Solaris stores the major/minor device numbers in the 2nd indirect block, not the first.

1) please, move old_encode_dev()/old_decode_dev() into your helper functions.
2) we could do a bit better now that we have large dev_t. What are complete rules for
a) Solaris userland dev_t => on-disk data
b) major/minor => Solaris userland dev_t
on sparc and x86 Solaris?

#3 lore raw
Quoted 13 lines · On Wed, 13 Oct 2004 14:43:51 +0100, [email protected]…
Quoted 10 lines · Alex Kiernan
Quoted 8 lines · Alex Kiernan

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

Quoted 6 lines
Quoted 4 lines

After advice from Alan (thanks), here's the patch which addresses the problem I'm seeing. Specifically it appears that on x86 Solaris stores the major/minor device numbers in the 2nd indirect block, not the first.

1) please, move old_encode_dev()/old_decode_dev() into your helper functions.

Will do.

Quoted 6 lines

2) we could do a bit better now that we have large dev_t. What are complete rules for
a) Solaris userland dev_t => on-disk data
b) major/minor => Solaris userland dev_t
on sparc and x86 Solaris?

Assuming I've followed it right...

The kernel dev_t has 14 major device bits, 18 minor device bits (with the major as the most significant bits).

On disk there are 32 bits stored in host byte order, the device is in the [0] indirect offset on Sparc, [1] on x86.

Looking at an individual entry, if the top 16 bits are clear or 0xffff, then the bottom 16 bits are the device number, with 7 bits of major (most significant), 8 bits of minor (and the most significant bit unused). If the top 16 bits are some other pattern, the on disk mapping is the same as the kernel mapping.

Signature · 1 line
Alex Kiernan
#4 lore raw
Quoted 37 lines · Alex Kiernan
Quoted 13 lines · On Wed, 13 Oct 2004 14:43:51 +0100, [email protected]…
Quoted 10 lines · Alex Kiernan
Quoted 8 lines · Alex Kiernan

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

Quoted 6 lines
Quoted 4 lines

After advice from Alan (thanks), here's the patch which addresses the problem I'm seeing. Specifically it appears that on x86 Solaris stores the major/minor device numbers in the 2nd indirect block, not the first.

1) please, move old_encode_dev()/old_decode_dev() into your helper functions.

Will do.

Quoted 6 lines

2) we could do a bit better now that we have large dev_t. What are complete rules for
a) Solaris userland dev_t => on-disk data
b) major/minor => Solaris userland dev_t
on sparc and x86 Solaris?

Assuming I've followed it right...

The kernel dev_t has 14 major device bits, 18 minor device bits (with the major as the most significant bits).

Quoted 9 lines

On disk there are 32 bits stored in host byte order, the device is in the [0] indirect offset on Sparc, [1] on x86.

Looking at an individual entry, if the top 16 bits are clear or 0xffff, then the bottom 16 bits are the device number, with 7 bits of major (most significant), 8 bits of minor (and the most significant bit unused). If the top 16 bits are some other pattern, the on disk mapping is the same as the kernel mapping.

Attached is code to implement the code move of old_decode_dev and support for large dev_t (Solaris' own handling of this seems to be dodgy in the extreme). I've checked Solaris x86/sparc w/ both types of dev_t encoding for reading. I haven't checked writing as the code to detect clean filesystems seems to be bust for Solaris UFS filesystems. I'll have a look at whats wrong w/ it when I've a bit more time.

Because of the different Solaris/Linux large dev encodings, what should I be doing in get/set inode_dev when the required things won't fit?

Signature · 1 line
Alex Kiernan
fs/ufs/inode.c +2 -2
diff -xSCCS -x'*.cmd' -x'*.o' -ur linus-2.5/fs/ufs/inode.c linux-2.5/fs/ufs/inode.c
@@ -629,7 +629,7 @@
 		}
 	} else
 		init_special_inode(inode, inode->i_mode,
-			old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
+			ufs_get_inode_dev(sb, ufsi));
 
 	brelse (bh);
 
@@ -705,7 +705,7 @@
 		}
 	} else   /* TODO  : here ...*/
 		init_special_inode(inode, inode->i_mode,
-			old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
+			ufs_get_inode_dev(sb, ufsi));
 
 	brelse(bh);
 
fs/ufs/namei.c +2 -2
diff -xSCCS -x'*.cmd' -x'*.o' -ur linus-2.5/fs/ufs/namei.c linux-2.5/fs/ufs/namei.c
@@ -30,6 +30,7 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 #include "swab.h"	/* will go away - see comment in mknod() */
+#include "util.h"
 
 /*
 #undef UFS_NAMEI_DEBUG
@@ -125,8 +126,7 @@
 	if (!IS_ERR(inode)) {
 		init_special_inode(inode, mode, rdev);
 		/* NOTE: that'll go when we get wide dev_t */
-		UFS_I(inode)->i_u1.i_data[0] = cpu_to_fs32(inode->i_sb,
-							old_encode_dev(rdev));
+		ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
 		mark_inode_dirty(inode);
 		lock_kernel();
 		err = ufs_add_nondir(dentry, inode);

Only in linux-2.5/fs/ufs: ufs.ko
Only in linux-2.5/fs/ufs: ufs.mod.c

fs/ufs/util.h +52 -0

58 lines not on this page · raw message

#5 lore raw
Quoted 50 lines · Alex Kiernan
Quoted 37 lines · Alex Kiernan
Quoted 13 lines · On Wed, 13 Oct 2004 14:43:51 +0100, [email protected]…
Quoted 10 lines · Alex Kiernan
Quoted 8 lines · Alex Kiernan

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

Quoted 6 lines
Quoted 4 lines

After advice from Alan (thanks), here's the patch which addresses the problem I'm seeing. Specifically it appears that on x86 Solaris stores the major/minor device numbers in the 2nd indirect block, not the first.

1) please, move old_encode_dev()/old_decode_dev() into your helper functions.

Will do.

Quoted 6 lines

2) we could do a bit better now that we have large dev_t. What are complete rules for
a) Solaris userland dev_t => on-disk data
b) major/minor => Solaris userland dev_t
on sparc and x86 Solaris?

Assuming I've followed it right...

The kernel dev_t has 14 major device bits, 18 minor device bits (with the major as the most significant bits).

Quoted 9 lines

On disk there are 32 bits stored in host byte order, the device is in the [0] indirect offset on Sparc, [1] on x86.

Looking at an individual entry, if the top 16 bits are clear or 0xffff, then the bottom 16 bits are the device number, with 7 bits of major (most significant), 8 bits of minor (and the most significant bit unused). If the top 16 bits are some other pattern, the on disk mapping is the same as the kernel mapping.

Quoted 7 lines

Attached is code to implement the code move of old_decode_dev and support for large dev_t (Solaris' own handling of this seems to be dodgy in the extreme). I've checked Solaris x86/sparc w/ both types of dev_t encoding for reading. I haven't checked writing as the code to detect clean filesystems seems to be bust for Solaris UFS filesystems. I'll have a look at whats wrong w/ it when I've a bit more time.

The same functionality again:

Fix handling of device inodes on Solaris x86 filesystems, add support for large dev_t against Solaris UFS filesystems

but with the helper functions moved out of inline code.

Signature · 1 line
Alex Kiernan
fs/ufs/inode.c +2 -2
diff -xSCCS -x'*.cmd' -x'*.o' -ur linus-2.5/fs/ufs/inode.c linux-2.5/fs/ufs/inode.c
@@ -629,7 +629,7 @@
 		}
 	} else
 		init_special_inode(inode, inode->i_mode,
-			old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
+			ufs_get_inode_dev(sb, ufsi));
 
 	brelse (bh);
 
@@ -705,7 +705,7 @@
 		}
 	} else   /* TODO  : here ...*/
 		init_special_inode(inode, inode->i_mode,
-			old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
+			ufs_get_inode_dev(sb, ufsi));
 
 	brelse(bh);
 
fs/ufs/namei.c +2 -2
diff -xSCCS -x'*.cmd' -x'*.o' -ur linus-2.5/fs/ufs/namei.c linux-2.5/fs/ufs/namei.c
@@ -30,6 +30,7 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 #include "swab.h"	/* will go away - see comment in mknod() */
+#include "util.h"
 
 /*
 #undef UFS_NAMEI_DEBUG
@@ -125,8 +126,7 @@
 	if (!IS_ERR(inode)) {
 		init_special_inode(inode, mode, rdev);
 		/* NOTE: that'll go when we get wide dev_t */
-		UFS_I(inode)->i_u1.i_data[0] = cpu_to_fs32(inode->i_sb,
-							old_encode_dev(rdev));
+		ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
 		mark_inode_dirty(inode);
 		lock_kernel();
 		err = ufs_add_nondir(dentry, inode);

Only in linux-2.5/fs/ufs: ufs.ko
Only in linux-2.5/fs/ufs: ufs.mod.c

fs/ufs/util.c +53 -0

56 lines not on this page · raw message

fs/ufs/util.h +2 -0
diff -xSCCS -x'*.cmd' -x'*.o' -ur linus-2.5/fs/ufs/util.h linux-2.5/fs/ufs/util.h
@@ -223,6 +223,8 @@
 	inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
 }
 
+extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *);
+extern void ufs_set_inode_dev(struct super_block *, struct ufs_inode_info *, dev_t);
 
 /*
  * These functions manipulate ufs buffers
#6 lore raw
In reply to Alex Kiernan

I've done have done the same with http://bugzilla.kernel.org/show_bug.cgi?id=3330 and I have the same question!

Where do I go from now?

Haroldo Gamal

Quoted 10 lines · Alex Kiernan

I've run into a bug in the UFS reading code (on Solaris x86 the major/minor numbers are in 2nd indirect offset not the first), so I've patched it & bugzilled it
(http://bugzilla.kernel.org/show_bug.cgi?id=3475).

But where do I go from here? There doesn't seem to be a maintainer for UFS so I can't send it there.

#8 lore raw

I have mailed Mr. Urban Widmark ans answered the appropriate bugzilla bug - https://bugzilla.samba.org/show_bug.cgi?id=999. No response until now.

Maybe my patches do not apply for some reason, but I've got no response. I would like to get some feedback.

Quoted 17 lines · Randy.Dunlap
Quoted 3 lines · Haroldo Gamal

I've done have done the same with http://bugzilla.kernel.org/show_bug.cgi?id=3330 and I have the same question!

Where do I go from now?

Have you tried contacting the SMBfs maintainer?
from the MAINTAINERS file:

SMB FILESYSTEM

P:    Urban Widmark
M:    [email protected]
W:    http://samba.org/
L:    [email protected]
S:    Maintained
#9 lore raw
Quoted 3 lines · Haroldo Gamal

I have mailed Mr. Urban Widmark ans answered the appropriate bugzilla bug - https://bugzilla.samba.org/show_bug.cgi?id=999. No response until now.

Maybe my patches do not apply for some reason, but I've got no response. I would like to get some feedback.

Hm, if he is unresponsive, you can try any of (in no special order):

a.  VFS maintainer (Al Viro)
b.  2.6 maintainer (Andrew Morton)
c.  [email protected]
d.  [email protected]
Quoted 19 lines
Quoted 17 lines · Randy.Dunlap
Quoted 3 lines · Haroldo Gamal

I've done have done the same with http://bugzilla.kernel.org/show_bug.cgi?id=3330 and I have the same question!

Where do I go from now?

Have you tried contacting the SMBfs maintainer?
from the MAINTAINERS file:

SMB FILESYSTEM

P:    Urban Widmark
M:    [email protected]
W:    http://samba.org/
L:    [email protected]
S:    Maintained
Signature · 1 line
~Randy