Skip to contentSkip to conversation

udf regression: broken directory handling

DISCUSSION Marcin Slusarz 3 participants 7 messages Feb 10, 2008 – Feb 14, 2008 UDF filesystem

lore
Share & tools
lore
#0 lore raw

Hi
Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Marcin

#1 lore raw

Hi,

Quoted 4 lines · Marcin Slusarz

Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Thanks for testing! Do you have a way to create such UDF filesystem? For
the filesystems I've created it seems to work just fine...

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#2 lore raw
Quoted 9 lines · Jan Kara

Hi,

Quoted 4 lines · Marcin Slusarz

Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Thanks for testing! Do you have a way to create such UDF filesystem? For
the filesystems I've created it seems to work just fine...

with patch applied:
joi tmp # dd if=/dev/zero of=./test.udf count=102400 102400+0 records in
102400+0 records out
52428800 bytes (52 MB) copied, 1.08618 s, 48.3 MB/s joi tmp # mkudffs ./test.udf
start=0, blocks=16, type=RESERVED
start=16, blocks=3, type=VRS
start=19, blocks=237, type=USPACE
start=256, blocks=1, type=ANCHOR
start=257, blocks=16, type=PVDS
start=273, blocks=1, type=LVID
start=274, blocks=25069, type=PSPACE start=25343, blocks=1, type=ANCHOR start=25344, blocks=239, type=USPACE start=25583, blocks=16, type=RVDS start=25599, blocks=1, type=ANCHOR
joi tmp # mount -t udf -o loop ./test.udf ./udf/ joi tmp # cd udf/
joi udf # ls -l
total 0
joi udf # touch q w e r t y u i o p
joi udf # ls -l
total 0
drwxr-xr-x 2 root root 40 Feb 11 19:03 lost+found -rw-r--r-- 1 root root 0 Feb 11 20:03 q
joi udf # cd ../
joi tmp # umount udf/
joi tmp # #(reverting patch)
joi tmp # rmmod udf
joi tmp # rm test.udf
joi tmp # dd if=/dev/zero of=./test.udf count=102400 102400+0 records in
102400+0 records out
52428800 bytes (52 MB) copied, 1.0559 s, 49.7 MB/s joi tmp # mkudffs ./test.udf
start=0, blocks=16, type=RESERVED
start=16, blocks=3, type=VRS
start=19, blocks=237, type=USPACE
start=256, blocks=1, type=ANCHOR
start=257, blocks=16, type=PVDS
start=273, blocks=1, type=LVID
start=274, blocks=25069, type=PSPACE start=25343, blocks=1, type=ANCHOR start=25344, blocks=239, type=USPACE start=25583, blocks=16, type=RVDS start=25599, blocks=1, type=ANCHOR
joi tmp # mount -t udf -o loop ./test.udf ./udf/ joi tmp # cd udf/
joi udf # touch q w e r t y u i o p
joi udf # ls -l
total 0
-rw-r--r-- 1 root root 0 Feb 11 20:06 e -rw-r--r-- 1 root root 0 Feb 11 20:06 i drwxr-xr-x 2 root root 40 Feb 11 19:05 lost+found

-rw-r--r-- 1 root root  0 Feb 11 20:06 o
-rw-r--r-- 1 root root  0 Feb 11 20:06 p
-rw-r--r-- 1 root root  0 Feb 11 20:06 q
-rw-r--r-- 1 root root  0 Feb 11 20:06 r
-rw-r--r-- 1 root root  0 Feb 11 20:06 t
-rw-r--r-- 1 root root  0 Feb 11 20:06 u
-rw-r--r-- 1 root root  0 Feb 11 20:06 w
-rw-r--r-- 1 root root  0 Feb 11 20:06 y

joi udf # cd ../
joi tmp # umount udf/
joi tmp # #(applying patch again)
joi tmp # rmmod udf
joi tmp # mount -t udf -o loop ./test.udf ./udf/
joi tmp # ls -l udf/
total 0
drwxr-xr-x 2 root root 40 Feb 11 19:05 lost+found
-rw-r--r-- 1 root root 0 Feb 11 20:06 q
joi tmp #

#3 lore raw
Quoted 4 lines · Marcin Slusarz
Quoted 3 lines · Jan Kara

Hi,

On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Thanks for testing! Do you have a way to create such UDF filesystem? For
the filesystems I've created it seems to work just fine...

with patch applied:

<snip testing>

Argh, I've submitted an old version of the patch missing changes in
dir.c. Below is the missing hunk. Does UDF work for you with it?

Honza

Signature · 8 lines
Jan Kara <[email protected]>
SUSE Labs, CR
---

Patch cleaning up UDF directory offset handling missed modifications in dir.c
(because I've submitted an old version :(). Fix it.

Signed-off-by: Jan Kara <[email protected]>
fs/udf/dir.c +7 -7
index 4b44e23..8d8643a 100644
@@ -43,13 +43,13 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
 	struct fileIdentDesc *fi = NULL;
 	struct fileIdentDesc cfi;
 	int block, iblock;
-	loff_t nf_pos = filp->f_pos - 1;
+	loff_t nf_pos = (filp->f_pos - 1) << 2;
 	int flen;
 	char fname[UDF_NAME_LEN];
 	char *nameptr;
 	uint16_t liu;
 	uint8_t lfi;
-	loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
+	loff_t size = udf_ext0_offset(dir) + dir->i_size;
 	struct buffer_head *tmp, *bha[16];
 	kernel_lb_addr eloc;
 	uint32_t elen;
@@ -63,13 +63,13 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
 		return 0;
 
 	if (nf_pos == 0)
-		nf_pos = (udf_ext0_offset(dir) >> 2);
+		nf_pos = udf_ext0_offset(dir);
 
-	fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
+	fibh.soffset = fibh.eoffset = nf_pos & (dir->i_sb->s_blocksize - 1);
 	iinfo = UDF_I(dir);
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
 		fibh.sbh = fibh.ebh = NULL;
-	} else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
+	} else if (inode_bmap(dir, nf_pos >> dir->i_sb->s_blocksize_bits,
 			      &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
 		block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
 		if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
@@ -111,7 +111,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
 	}
 
 	while (nf_pos < size) {
-		filp->f_pos = nf_pos + 1;
+		filp->f_pos = (nf_pos >> 2) + 1;
 
 		fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
 					&elen, &offset);
@@ -178,7 +178,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
 		}
 	} /* end while */
 
-	filp->f_pos = nf_pos + 1;
+	filp->f_pos = (nf_pos >> 2) + 1;
 
 	if (fibh.sbh != fibh.ebh)
 		brelse(fibh.ebh);
#4 lore raw
Quoted 9 lines · Jan Kara
Quoted 8 lines · Marcin Slusarz
Quoted 7 lines · Jan Kara

Hi,

Quoted 4 lines · Marcin Slusarz

Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thanks for testing! Do you have a way to create such UDF filesystem? For
the filesystems I've created it seems to work just fine...

with patch applied:

<snip testing>

Argh, I've submitted an old version of the patch missing changes in
dir.c. Below is the missing hunk. Does UDF work for you with it?

Yes.

Marcin

#5 lore raw
Quoted 13 lines · Marcin Slusarz
Quoted 12 lines · Jan Kara
Quoted 11 lines · Marcin Slusarz
Quoted 9 lines · Jan Kara

Hi,

Quoted 4 lines · Marcin Slusarz

Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Thanks for testing! Do you have a way to create such UDF filesystem? For
the filesystems I've created it seems to work just fine...

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

with patch applied:

<snip testing>

Argh, I've submitted an old version of the patch missing changes in
dir.c. Below is the missing hunk. Does UDF work for you with it?

Yes.

Has the issue been fixed in the mainline?

Rafael

#6 lore raw
Quoted 14 lines · Rafael J. Wysocki
Quoted 13 lines · Marcin Slusarz
Quoted 12 lines · Jan Kara
Quoted 11 lines · Marcin Slusarz
Quoted 9 lines · Jan Kara

Hi,

Quoted 4 lines · Marcin Slusarz

Current mainline has a problem with reading file list. Simple ls prints only 2 out of 8 files on my testing DVD. Reverting your patch "udf: cleanup directory offset handling" (af793295bf9ee92660f5e77d337b0493cea3f9b9) fixes the problem.

Thanks for testing! Do you have a way to create such UDF filesystem? For
the filesystems I've created it seems to work just fine...

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

with patch applied:

<snip testing>

Argh, I've submitted an old version of the patch missing changes in
dir.c. Below is the missing hunk. Does UDF work for you with it?

Yes.

Has the issue been fixed in the mainline?

Andrew has the fix in his queue so it'll get to mainline soon.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR