# Rsync: USB HD hangs after many hundred files / big files

## guldan

********

Problem:

********

I use the USB HD to sync my built in HD from time to time to have a backup. This by using:

```
rsync -av /src /dest
```

rsync ver2.6.0. When syncronizing larg files (around >200MB) or small but many (I guess over 1000) it nearly allways happend that the USB system hangs or gets blocked (the LED of the USB case does not stop glow anymore).

Syslog-ng shows the following:

Jul 26 21:20:42 router REISERFS: panic (device sda5): journal-601, buffer write failed

Jul 26 21:20:42 router

Jul 26 21:20:42 router ------------[ cut here ]------------

Jul 26 21:20:42 router kernel BUG at fs/reiserfs/prints.c:362!

Jul 26 21:20:42 router invalid operand: 0000 [#1]

Jul 26 21:20:42 router PREEMPT

Jul 26 21:20:42 router Modules linked in: sd_mod

Jul 26 21:20:42 router CPU:    0

Jul 26 21:20:42 router EIP:    0060:[<c0199b35>]    Not tainted

Jul 26 21:20:42 router EFLAGS: 00010246   (2.6.7-gentoo-r11)

Jul 26 21:20:42 router EIP is at reiserfs_panic+0x35/0x60

Jul 26 21:20:42 router eax: 00000044   ebx: ddfa3400   ecx: c03b24f0   edx: 00000282

Jul 26 21:20:42 router esi: ca84c9d8   edi: 00000000   ebp: ddfa3400   esp: d821ee1c

Jul 26 21:20:42 router ds: 007b   es: 007b   ss: 0068

Jul 26 21:20:42 router Process pdflush (pid: 16902, threadinfo=d821e000 task=c8b10dd0)

Jul 26 21:20:42 router Stack: c0373d0c ddfa352c c0478920 00001000 c01a5cf0 ddfa3400 c0374de0 dbcbb000

Jul 26 21:20:42 router deb39068 ca84c9f0 c8fcff2c ddfa3400 0000001e 00000004 00000000 c01aa391

Jul 26 21:20:42 router ddfa3400 ca84c9d8 00000001 ca84c9d8 d821e000 01bbf468 deb4110c c5eae26c

Jul 26 21:20:42 router Call Trace:

Jul 26 21:20:42 router [<c01a5cf0>] flush_commit_list+0x270/0x3b0

Jul 26 21:20:42 router [<c01aa391>] do_journal_end+0x831/0xb30

Jul 26 21:20:42 router [<c01a9206>] journal_end_sync+0x36/0x70

Jul 26 21:20:42 router [<c01967cd>] reiserfs_sync_fs+0x3d/0x80

Jul 26 21:20:42 router [<c0155b60>] sync_supers+0xc0/0xd0

Jul 26 21:20:42 router [<c013918f>] wb_kupdate+0x2f/0x100

Jul 26 21:20:42 router [<c0116d4d>] deactivate_task+0x1d/0x40

Jul 26 21:20:42 router [<c0139bc8>] __pdflush+0xc8/0x1f0

Jul 26 21:20:42 router [<c0139cf0>] pdflush+0x0/0x30

Jul 26 21:20:42 router [<c0139d0e>] pdflush+0x1e/0x30

Jul 26 21:20:42 router [<c0139160>] wb_kupdate+0x0/0x100

Jul 26 21:20:42 router [<c012bae3>] kthread+0xa3/0xb0

Jul 26 21:20:42 router [<c012ba40>] kthread+0x0/0xb0

Jul 26 21:20:42 router [<c0103265>] kernel_thread_helper+0x5/0x10

Jul 26 21:20:42 router

Jul 26 21:20:42 router Code: 0f 0b 6a 01 6b eb 36 c0 83 c4 0c 85 db b8 99 e6 36 c0 74 06

Jul 26 21:20:42 router <3>scsi1 (0:0): rejecting I/O to offline device

Jul 26 21:20:42 router scsi1 (0:0): rejecting I/O to offline device

Unmounting (even mit -f) of the USB HD ist not anymore possible still it's listed under "mount" => Reboot of the whole System.

All filesystems are reiserfs.

********

Sys spec

********

Using dev-kernel-2.6.7-r11 on a VIA PL with a 120GB Samsung HD at a USB 2.0 case. The USB drivers are all compiled directly into the kernel.

The HD is (usually) correct beeing identified:

Jul 26 20:41:01 router usb 1-1: new high speed USB device using address 2

Jul 26 20:41:01 router scsi0 : SCSI emulation for USB Mass Storage devices

Jul 26 20:41:01 router Vendor: Genesys   Model: USB to IDE Disk   Rev: 0002

Jul 26 20:41:01 router Type:   Direct-Access                      ANSI SCSI revision: 02

Jul 26 20:41:01 router Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0

Jul 26 20:41:01 router USB Mass Storage device found at 2

no device sda is beeing created under /dev/ but a /sg0 dev which I could not use to allocate the device. I was however able to partition it with:

```
cfdisk /dev/sda
```

After this, the device(s) sda, sda1, sda2,... are listed under /dev, no idea why ???... but that's not a killer.

Have tested the HD on the second IDE channel and there I never got any hang up,... even after synchronising the whole file system twice.

Any ideas ?Last edited by guldan on Sat Jul 31, 2004 10:46 am; edited 1 time in total

----------

## guldan

Found a thread dealing with USB1 - USB2 problems (https://forums.gentoo.org/viewtopic.php?t=204059&highlight=usb+massstorage) where one is proposing to check whether it's using USB 1 or USB 2. USB 1 could lead to problems ???

I could not found how to check weather it's using USB1 or 2 but I recompiled the kernel to use only EHCI (directly into the kernel).

=> HD is beeing recocnised and this time all the /dev/sda(s) are beeing listed .A quick test with a big file show:

1) it's much (!!) faster now

2) no hang up

- If one could give me a hint to see weather USB1 or USB2 is beeing used for a dev I would be very glad, thx !

EDITED: I guess this would be the /proc/bus/usb/device file which shows the bus ID, loaded driver, USB speed, and many other data

- Would it be safer to use ext3 instead of reiserfs for the USB HD ?

- or even reiserfs4 ?

----------

## sulu

 *Quote:*   

> When syncronizing larg files (around >200MB) or small but many (I guess over 1000) it nearly allways happend that the USB system hangs or gets blocked (the LED of the USB case does not stop glow anymore). 

 

Oh my god, you have a USB-HD's with this crap Genesys-Chipset.

They cause much pain for the USB-developers.

There are timing issues, problems wich instruction size and the more.

Check http://www.mail-archive.com/index.php?hunt=usb

and search for Genesys.

My Genesys-USB-HD does not hang but the transfre rate is aprox. 1 MB/sec which is USB 1.1 if you ask me.   :Evil or Very Mad: 

 *Quote:*   

>  ...but I recompiled the kernel to use only EHCI (directly into the kernel). 
> 
> 

 

Very interesting. That could be my problem but what to do with the USB-mouse?

 *Quote:*   

> If one could give me a hint to see weather USB1 or USB2 is beeing used for a dev I would be very glad, thx !

 

I allways use 

```
lsusb -v
```

----------

## guldan

 *sulu wrote:*   

> Oh my god, you have a USB-HD's with this crap Genesys-Chipset.
> 
> They cause much pain for the USB-developers.
> 
> There are timing issues, problems wich instruction size and the more.
> ...

 

Yes, did a direct hit by buying this "crap"  :Sad: 

thanx for your link. I'll check there to see if there's a work around.

Since it still crashes by only using EHCI driver (usb 2.0)  :Crying or Very sad: 

 *Quote:*   

> My Genesys-USB-HD does not hang but the transfre rate is aprox. 1 MB/sec which is USB 1.1 if you ask me.   

 

doesn't seems to helped in my case since the hangs occured as well under USB 1-1. To be honest, I don't know really what usb typ it was using when I had usb 1.1 and 2.0 activated ? I'll give it a try by only loading usb 1.1 drivers. If it even would work at usb 1.1 speed...

 *Quote:*   

> Very interesting. That could be my problem but what to do with the USB-mouse?

 

good question, still looking for a way to fix one USB device to use a specific USB driber (2.0 or 1.1). this way you could still implemnt usb 1.1 into the kernel but only use 2.0 for the mass storage device.

 *Quote:*   

> I allways use [code]lsusb -v

 

thx, you could also check the /proc/bus/usb/device file which lists a lot of infos about the attached usb devices.

----------

## guldan

Just borrowed a USB case from a friend. His USB case is beeing recocnised exactly the same as my USB case, but his has as well a IEEE1394 interface (guess is the same chipset ??). Not right sure when exactly he bough his device, but it's quite older then mine. It's beeing recocnised the following:

Aug  6 22:14:40 router usb 1-1: new high speed USB device using address 2

Aug  6 22:14:40 router scsi0 : SCSI emulation for USB Mass Storage devices

Aug  6 22:14:40 router Vendor: Genesys   Model: USB to IDE Disk   Rev: 0002

Aug  6 22:14:40 router Type:   Direct-Access                      ANSI SCSI revision: 02

Aug  6 22:14:40 router Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0

Aug  6 22:14:40 router USB Mass Storage device found at 2

Attached this device while having USB1.1 and 2.0 active. Works like a charm (wrote 13545 bytes  read 2732621 bytes  30012.74 bytes/sec

total size is 72995240  speedup is 26.58) 

Did I choose a bad one  ????

----------

## guldan

Device is now beeing recognized as USB 1.1 but still no go (hangs after a few files, now even faster then with USB 2.0). Seems no way around a new device.

----------

## sulu

Hi

Did you patch the kernel as the developers propose in the mailing-archive?

I did it and my USB-disk works without a hitch but slooooow.

(Reason is that the chipset in my HP-Laptop only supports USB 1-1, crap   :Evil or Very Mad:  )

Try it, the Genesys chipset has timing problems, so the patch has a real purpose.

----------

## guldan

are you refering to this fix ?

http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg26639.html

----------

## sulu

Yep.

I just hacked it into the sources and recompiled the kernel.

Please not that on my box with this crap ALI-USB-1-1-controller it may not have any noticeable effect but with your fast controller it should give you more stability.

----------

## guldan

tested the patch with gentoo-dev-sources-2.6.7-r13 and a set the packet size to 64. Still no go, the USB devices hangs after a few files.

I'll try to change my device for a different one with a different chips set. Thanx for your help sulu !

----------

## lbrtuk

Kernel 2.6.8(.1) has had quite a lot of usb/usb mass storage fixes merged in (inluding the major "empty packet" one), so it might be worth trying the latest vanilla development sources.

----------

## guldan

Tested 2.6.8.1 today but seems to be worse. Can not even copy one file. Get immediately:

Aug 16 11:35:02 router scsi1 (0:0): rejecting I/O to offline device

EDITED: Have bought a new USB case which now works flawless (so far...   :Wink: 

thx for your help !

----------

