2008-02-10 10:48:53

by Marcin Ślusarz

[permalink] [raw]
Subject: udf regression: broken directory handling

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


2008-02-11 11:09:21

by Jan Kara

[permalink] [raw]
Subject: Re: udf regression: broken directory handling

Hi,

On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:
> 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
--
Jan Kara <[email protected]>
SUSE Labs, CR

2008-02-11 19:14:34

by Marcin Ślusarz

[permalink] [raw]
Subject: Re: udf regression: broken directory handling

On Mon, Feb 11, 2008 at 12:09:10PM +0100, Jan Kara wrote:
> Hi,
>
> On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:
> > 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 #

2008-02-12 11:39:28

by Jan Kara

[permalink] [raw]
Subject: Re: udf regression: broken directory handling

On Mon 11-02-08 20:13:20, Marcin Slusarz wrote:
> On Mon, Feb 11, 2008 at 12:09:10PM +0100, Jan Kara wrote:
> > Hi,
> >
> > On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:
> > > 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
--
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]>

diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 4b44e23..8d8643a 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -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);

2008-02-12 18:27:53

by Marcin Ślusarz

[permalink] [raw]
Subject: Re: udf regression: broken directory handling

On Tue, Feb 12, 2008 at 12:39:17PM +0100, Jan Kara wrote:
> On Mon 11-02-08 20:13:20, Marcin Slusarz wrote:
> > On Mon, Feb 11, 2008 at 12:09:10PM +0100, Jan Kara wrote:
> > > Hi,
> > >
> > > On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:
> > > > 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?
Yes.

Marcin

2008-02-13 22:37:54

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: udf regression: broken directory handling

On Tuesday, 12 of February 2008, Marcin Slusarz wrote:
> On Tue, Feb 12, 2008 at 12:39:17PM +0100, Jan Kara wrote:
> > On Mon 11-02-08 20:13:20, Marcin Slusarz wrote:
> > > On Mon, Feb 11, 2008 at 12:09:10PM +0100, Jan Kara wrote:
> > > > Hi,
> > > >
> > > > On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:
> > > > > 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?
> Yes.

Has the issue been fixed in the mainline?

Rafael

2008-02-14 09:50:01

by Jan Kara

[permalink] [raw]
Subject: Re: udf regression: broken directory handling

On Wed 13-02-08 23:36:05, Rafael J. Wysocki wrote:
> On Tuesday, 12 of February 2008, Marcin Slusarz wrote:
> > On Tue, Feb 12, 2008 at 12:39:17PM +0100, Jan Kara wrote:
> > > On Mon 11-02-08 20:13:20, Marcin Slusarz wrote:
> > > > On Mon, Feb 11, 2008 at 12:09:10PM +0100, Jan Kara wrote:
> > > > > Hi,
> > > > >
> > > > > On Sun 10-02-08 11:48:17, Marcin Slusarz wrote:
> > > > > > 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?
> > Yes.
>
> Has the issue been fixed in the mainline?
Andrew has the fix in his queue so it'll get to mainline soon.

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR