lkml.org 
[lkml]   [2002]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: s390 is totally broken in 2.4.18
From
Date

Hi Pete,

>Certainly, I do. I worked around the partitions part with "obvious"
>fixup:
>
>- if (ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo);
>+ if (ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo))
>- data = read_dev_sector(bdev, inode->label_block*blocksize, &sect);
>+ data = read_dev_sector(bdev, info->label_block*blocksize, &sect);
>
>But that code did not look too good, in particular it was
>not checking return codes. So, it was on my TODO list to
>clean it up.

This won't work. The trouble we have is that a partition detection can be
done in two completely different situations. First the "normal" detection
with a builtin dasd driver. ibm_partition is called with no locks held and
with a non-open block device. Second the detection can be done as part of
a block device open with an automated module load. In this case the
get_blkfops functions requests the module which in turn calls the partition
detection. That is done with the bd_sem semaphore of the block device held.
The call to ioctl_by_bdev with the builtin dasd driver fails because the
block device is not open. So we would need to add an open to the partition
detection but we can't do that because then the automated module load
would dead-lock.
Your hack to get it running only works by chance. The first ioctl_by_bdev
that is supposed to get the block number of the label block will fail as
well. So normally you'll end up loading the wrong block. The hack we are
currently using looks like this:

diff -urN linux-2.4.18/fs/block_dev.c linux-2.4.18-s390/fs/block_dev.c
--- linux-2.4.18/fs/block_dev.c Mon Feb 25 20:38:08 2002
+++ linux-2.4.18-s390/fs/block_dev.c Fri Mar 1 15:47:25 2002
@@ -530,11 +530,18 @@
{
int res;
mm_segment_t old_fs = get_fs();
+ struct block_device_operations *bd_op;

- if (!bdev->bd_op->ioctl)
+ bd_op = bdev->bd_op;
+ if (bd_op == NULL) {
+ bd_op = blkdevs[MAJOR(to_kdev_t(bdev->bd_dev))].bdops;
+ if (bd_op == NULL)
+ return -EINVAL;
+ }
+ if (!bd_op->ioctl)
return -EINVAL;
set_fs(KERNEL_DS);
- res = bdev->bd_op->ioctl(bdev->bd_inode, NULL, cmd, arg);
+ res = bd_op->ioctl(bdev->bd_inode, NULL, cmd, arg);
set_fs(old_fs);
return res;
}
The idea is to get ioctl_by_bdev to work for non-open devices. But it is
a hack because I do not safe-guard against module unloading.

blue skies,
Martin

P.S. I will sent you the patches I sent Marcelo in a private mail.

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:24    [W:0.043 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site