Skip to contentSkip to conversation

2.6.24-rc6-mm1 - iget-stop-isofs-from-using-read_inode-fix-2.patch

DISCUSSION [email protected] 2 participants 2 messages Jan 29, 2008 – Feb 5, 2008 Isofs filesystem

lore
Share & tools
lore
#0 lore raw

Sorry for the late notice - I hit the original issue with this code, and I tested the *first* patch, which addressed my immediate problem, but didn't test the subsequent flurry of "better" patches due to time issues here.

I back up my laptop by doing one or more 'dump' commands into a $STAGE directory, and then doing a 'growisofs' onto a DVD. And of course, I eventually needed to restore something that got damaged by some misbehaving userspace, so I break out the disk, which had 8 dump images for smaller filesystems on it. Imagine my surprise when the disk was unreadable - so I went bisecting and eventually found it first in the -rc6-mm1 tree.

Under 2.6.4-rc6-mm1 quilted up to iget-stop-isofs-from-using-read_inode.patch, it's able to see all 8 dump images. When I quilt push the very next one (iget-stop-isofs-from-using-read_inode-fix-2.patch), all hell breaks loose:

[root@turing-police ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom [root@turing-police ~]# ls -la /mnt/cdrom
total 0
[root@turing-police ~]# umount /mnt/cdrom

It claims to mount correctly - but ls can't find anything.

*not even . and .. - how weird is that?*

Looking at the code, I don't see why inode-fix-2 breaks it, nor do I see why inode-fix-2-update or inode-fix-2-update-fix don't re-fix it...

#1 lore raw

How about this patch?

David
---
IGET: Fix isofs_get_block() to only return 0 on success.

From: David Howells <[email protected]>

Fix isofs_get_block() to return only 0 on success. It shouldn't return a +ve block count for example.

Also make sure that isofs_get_blocks() doesn't accidentally return an error if rv is 0 come the return statement.

---

 fs/isofs/inode.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
fs/isofs/inode.c +5 -1
index 0f5ed8c..875d37f 100644
@@ -1022,6 +1022,7 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
 		rv++;
 	}
 
+	error = 0;
 abort:
 	unlock_kernel();
 	return rv != 0 ? rv : error;
@@ -1033,12 +1034,15 @@ abort:
 static int isofs_get_block(struct inode *inode, sector_t iblock,
 		    struct buffer_head *bh_result, int create)
 {
+	int ret;
+
 	if (create) {
 		printk(KERN_DEBUG "%s: Kernel tries to allocate a block\n", __func__);
 		return -EROFS;
 	}
 
-	return isofs_get_blocks(inode, iblock, &bh_result, 1);
+	ret = isofs_get_blocks(inode, iblock, &bh_result, 1);
+	return ret < 0 ? ret : 0;
 }
 
 static int isofs_bmap(struct inode *inode, sector_t block)