Commit 8fc7813c authored by Paul Serice's avatar Paul Serice Committed by Linus Torvalds

[PATCH] iso9660: NFS fix

Make all inode numbers unique for images less than 128GB in size.  Required
for knfsd.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9210c204
......@@ -106,7 +106,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
{
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
unsigned char bufbits = ISOFS_BUFFER_BITS(inode);
unsigned long block, offset;
unsigned long block, offset, block_saved, offset_saved;
unsigned long inode_number = 0; /* Quiet GCC */
struct buffer_head *bh = NULL;
int len;
......@@ -129,8 +129,6 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
}
de = (struct iso_directory_record *) (bh->b_data + offset);
if (first_de)
inode_number = isofs_get_ino(de);
de_len = *(unsigned char *) de;
......@@ -147,6 +145,8 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
continue;
}
block_saved = block;
offset_saved = offset;
offset += de_len;
/* Make sure we have a full directory entry */
......@@ -166,6 +166,15 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
de = tmpde;
}
if (first_de) {
isofs_normalize_block_and_offset(de,
&block_saved,
&offset_saved);
inode_number = isofs_get_ino(block_saved,
offset_saved,
bufbits);
}
if (de->flags[-sbi->s_high_sierra] & 0x80) {
first_de = 0;
filp->f_pos += de_len;
......
......@@ -7,7 +7,7 @@
* 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs.
* 1997 Gordon Chaffee - Joliet CDs
* 1998 Eric Lammerts - ISO 9660 Level 3
* 2004 Paul Serice - Comprehensive Inode Scheme
* 2004 Paul Serice - Inode Support pushed out from 4GB to 128GB
* 2004 Paul Serice - NFS Export Operations
*/
......@@ -1228,7 +1228,9 @@ static void isofs_read_inode(struct inode * inode)
de = tmpde;
}
inode->i_ino = isofs_get_ino(de);
inode->i_ino = isofs_get_ino(ei->i_iget5_block,
ei->i_iget5_offset,
ISOFS_BUFFER_BITS(inode));
/* Assume it is a normal-format file unless told otherwise */
ei->i_file_format = isofs_file_normal;
......
......@@ -237,19 +237,13 @@ extern struct inode *isofs_iget(struct super_block *sb,
/* Because the inode number is no longer relevant to finding the
* underlying meta-data for an inode, we are free to choose a more
* convenient 32-bit number as the inode number. Because directories
* and files are block aligned (except in a few very unusual cases)
* and because blocks are limited to 32-bits, I've chosen the starting
* block that holds the file or directory data as the inode number.
*
* One nice side effect of this is that you can use "ls -i" to get the
* inode number which will tell you exactly where you need to start a
* hex dump if you want to see the contents of the directory or
* file. */
static inline unsigned long isofs_get_ino(struct iso_directory_record *d)
* convenient 32-bit number as the inode number. The inode numbering
* scheme was recommended by Sergey Vlasov and Eric Lammerts. */
static inline unsigned long isofs_get_ino(unsigned long block,
unsigned long offset,
unsigned long bufbits)
{
return (unsigned long)isonum_733(d->extent)
+ (unsigned long)isonum_711(d->ext_attr_length);
return (block << (bufbits - 5)) | (offset >> 5);
}
/* Every directory can have many redundant directory entries scattered
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment