Re: Missing 2.0.31 patches?

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Thu, 14 Aug 1997 11:18:03 +0200


On Aug 13, Linus Torvalds wrote:

> Resend. Pre-patch#5 has everything I had queued, and if people are missing
> pieces they should _not_ assume that I have the patch but haven't had time
> to apply it.

here is one more isofs patch which I've sent to you before but can't find it
in Pre-patch#5.

if you think this shouldn't go into 2.0.31 please let me know [why]
and I'll shut up (but pls keep in mind that this bug broke a number of CDRs
we mastered/burned and which can't be used now due to this bug...)

here is one more isofs patch which I got from Eric Youngdale and which
has been accepted by Dave after his pre-2.0.31-2 to fix the following
problem:

when mapping filenames from upper to lower case, it will modify the file names
in original data from CDROM blocks.

even when the filesystem gets unmounted, this changed data still stick
in the buffers and when you try to make a copy of this isofs now,
ISO9660 file name is corrupt (lower case) and as a result e.g. you can't
read these files anymore in MSDOS.

trashing memory/buffer cache or running "flushb" on the device before
reading the isofs data seems to fix this but I don't think this should
be necessary.

at least after umount, these modified buffers should be flushed IMHO.
otherwise, e.g. mounting a freshly mastered isofs to do some last
minutes checks will trash the data and if you're trying to burn
a CDR afterwards, data will be broken :-(

please try the following:

cd /tmp
mkisofs /usr/src/linux/fs > iso.orig

swapoff /dev/swap2 # (or use any other spare partition...)
cp iso.orig /dev/swap2
mount -t iso9660 /dev/swap2 /mnt
ls -lR /mnt > /dev/null
umount /mnt
dd if=/dev/swap2 bs=`wc -c < iso.orig` count=1 of=iso.copy1
mount -t iso9660 /dev/swap2 /mnt
umount /mnt
dd if=/dev/swap2 bs=`wc -c < iso.orig` count=1 of=iso.copy2
cmp -l iso.orig iso.copy1 | wc
cmp -l iso.orig iso.copy2 | wc

why does `mount -o map=off ...' flush buffers (as iso.copy2 isn't corrupted anymore) ?
instead of using `cmp' for comparison you can also do

cp iso.orig /dev/swap2
mount -o map=off -t iso9660 /dev/swap2 /mnt
ls -l /mnt
umount /mnt

cp iso.copy1 /dev/swap2
mount -o map=off -t iso9660 /dev/swap2 /mnt
ls -l /mnt
umount /mnt

and this is Eric's patch which fixes this problem for us:

diff -u /soft/linux/fs/isofs/namei.c linux/fs/isofs/namei.c
--- /soft/linux/fs/isofs/namei.c Sat Apr 13 18:18:07 1996
+++ linux/fs/isofs/namei.c Mon May 19 01:29:14 1997
@@ -69,6 +69,7 @@
unsigned int old_offset;
unsigned int backlink;
int dlen, rrflag, match;
+ char *lcname = NULL;
char * dpnt;
struct iso_directory_record * de;
char c;
@@ -85,6 +86,11 @@

if (!block || !(bh = bread(dir->i_dev,block,bufsize))) return NULL;

+ if(dir->i_sb->u.isofs_sb.s_mapping == 'n')
+ {
+ lcname = kmalloc(32+1+32+1+5+1, GFP_KERNEL);
+ }
+
while (f_pos < dir->i_size) {
de = (struct iso_directory_record *) (bh->b_data + offset);
backlink = dir->i_ino;
@@ -166,12 +172,13 @@
break;
}
if (c == ';') c = '.';
- de->name[i] = c;
+ lcname[i] = c;
}
/* This allows us to match with and without a trailing
period. */
- if(dpnt[dlen-1] == '.' && namelen == dlen-1)
+ if(lcname[dlen-1] == '.' && namelen == dlen-1)
dlen--;
+ dpnt = lcname;
}
}
/*
@@ -207,12 +214,20 @@
}
*ino = inode_number;
*ino_back = backlink;
+ if( lcname != NULL )
+ {
+ kfree(lcname);
+ }
return bh;
}
}
out:
if (cpnt)
kfree(cpnt);
+ if( lcname != NULL )
+ {
+ kfree(lcname);
+ }
brelse(bh);
return NULL;
}

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^