Details
Description
We've begun testing the Lustre 2.1 client on our BlueGene P development system.
It immediately panicked on the first mount attempt. This turns out to be related to a patch landed for LU-163. lustre_get_sb() conditionally calls get_sb_nodev() with a struct lustre_mount_data2 * for kernels 2.6.18 and newer, and a void * data pointer for older kernels:
2196 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) 2197 struct super_block * lustre_get_sb(struct file_system_type *fs_type, int flags, 2198 const char *devname, void * data) 2199 { 2200 return get_sb_nodev(fs_type, flags, data, lustre_fill_super); 2201 } 2202 #else 2203 int lustre_get_sb(struct file_system_type *fs_type, int flags, 2204 const char *devname, void * data, struct vfsmount *mnt) 2205 { 2206 struct lustre_mount_data2 lmd2 = {data, mnt}; 2207 2208 return get_sb_nodev(fs_type, flags, &lmd2, lustre_fill_super, mnt); 2209 } 2210 #endif
However, lustre_fill_super() unconditionally casts its void *data argument to a struct lustre_mount_data2 *, which causes a crash when we deference into it on older kernels.
1945 /** Parse mount line options 1946 * e.g. mount -v -t lustre -o abort_recov uml1:uml2:/lustre-client /mnt/lustre 1947 * dev is passed as device=uml1:/lustre by mount.lustre 1948 */ 1949 static int lmd_parse(char *options, struct lustre_mount_data *lmd) 1950 { 1951 char *s1, *s2, *devname = NULL; 1952 struct lustre_mount_data *raw = (struct lustre_mount_data *)options; ... 1963 /* Options should be a string - try to detect old lmd data */ 1964 if ((raw->lmd_magic & 0xffffff00) == (LMD_MAGIC & 0xffffff00)) { <--- crashes here ... 2102 int lustre_fill_super(struct super_block *sb, void *data, int silent) 2103 { 2104 struct lustre_mount_data *lmd; 2105 struct lustre_mount_data2 *lmd2 = data; ... 2122 2123 /* Figure out the lmd from the mount options */ 2124 if (lmd_parse((char *)(lmd2->lmd2_data), lmd)) {