Bug 717288

Summary: udf deadlocks access to DVD drive
Product: [Fedora] Fedora Reporter: Wolfgang Denk <wd>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 15CC: gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-08 11:27:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Wolfgang Denk 2011-06-28 14:08:21 UTC
Description of problem:

After a few (1...3) successful runs of "growisofs" to write a DVD/BD image no further accesses are possible bcuase exclusive opens of the device fail:
open("/dev/dvdrw", O_RDONLY|O_EXCL|O_NONBLOCK|O_LARGEFILE) = -1 EBUSY (Device or resource busy)

However, there are no uses of the drive:
# ls -l /dev/dvdrw
lrwxrwxrwx 1 root root 3 Jun 28 15:33 /dev/dvdrw -> sr0
# lsof /dev/sr0
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/wd/.gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/wd/.gvfs
      Output information may be incomplete.
# 

lsmod shows that "udf" is in use:

# lsmod
Module                  Size  Used by
udf                    61737  1 
crc_itu_t               1251  1 udf
tcp_lp                  1867  0 
nfs                   269067  0 
fscache                37475  1 nfs
...

It cannot be removed:

# rmmod -f udf
ERROR: Removing 'udf': Resource temporarily unavailable

The only way to recover is a reboot of the system.


Version-Release number of selected component (if applicable):

kernel-2.6.38.8-32.fc15.i686

How reproducible:

Reliably; usually it hangs at the second attempt to write a DVD; so far it never survived a 3rd writing.

Steps to Reproduce:
1. Write some files to DVD/BD, for example like this:
growisofs -dvd-compat -Z /dev/dvdrw -R -J -udf -allow-limited-size -iso-level=3 Monty_Python.mkv
2. Wait for completion, insert new disk
3. re-run the same command (if it works, go to step 2.)
  
Actual results:

growisofs will bail out with an error message:
...
:-( unable to O_EXCL /dev/dvdrw: someone was in time to remount?

Checking with strace shows that an exclusive open fails:

open("/dev/dvdrw", O_RDONLY|O_EXCL|O_NONBLOCK|O_LARGEFILE) = -1 EBUSY (Device or resource busy)

As mentioned, in this situation the UDF mdule is locked and cannot be unloaded any more, so I suspect problems in that area.

Expected results:

It should be possible to write an unlimited number of DVD /BD without need to reboot the system.


Additional info:

Comment 1 Wolfgang Denk 2011-06-28 21:28:14 UTC
Sorry, but my description of the steps to trigger the problem is
wrong.  I understand this only now myself.

The problem happens when _mounting_ an UDF file system as greated in
the steps described above.

Before:

# lsmod
Module                  Size  Used by
tcp_lp                  1867  0 
sco                    13425  2 
bnep                   12069  2 
...

Then run:

# mount -o ro /dev/sr0 /mnt/tmp/

The kernel will report:

Jun 28 23:21:33 gemini kernel: [22516.221453] UDF-fs: Partition marked readonly; forcing readonly mount
Jun 28 23:21:33 gemini kernel: [22516.261759] UDF-fs INFO UDF: Mounting volume 'CDROM', timestamp 2011/06/28 19:07 (1000)

and:

# lsmod 
Module                  Size  Used by
udf                    61737  1 
crc_itu_t               1251  1 udf
tcp_lp                  1867  0 
sco                    13425  2 
bnep                   12069  2 
...

After an umount I see this:

# umount /mnt/tmp/

# lsmod
Module                  Size  Used by
udf                    61737  1 
crc_itu_t               1251  1 udf
tcp_lp                  1867  0 
sco                    13425  2 
bnep                   12069  2 
...

# rmmod udf
ERROR: Module udf is in use

...
open("/dev/sr0", O_RDONLY|O_EXCL|O_NONBLOCK|O_LARGEFILE) = -1 EBUSY (Device or resource busy)
...

So the Subject: is OK, the actual problem happens when mounting an UDF
file system - it blocks the device forever, and the module cannot be
unloaded.

# uname -a
Linux gemini.denx.de 2.6.38.8-32.fc15.i686.PAE #1 SMP Mon Jun 13 19:55:27 UTC 2011 i686 i686 i386 GNU/Linux

Comment 2 Chuck Ebbert 2011-06-30 08:45:59 UTC
Do you get any error messages in the kernel log when you unmount the filesystem?

Comment 3 Wolfgang Denk 2011-06-30 09:37:38 UTC
Not when mounting or unmounting.

When mounting, I get this:

UDF-fs: Partition marked readonly; forcing readonly mount
UDF-fs INFO UDF: Mounting volume 'CDROM', timestamp 2011/06/28 19:07 (1000)

There are no messages at all when unmounting.

But when I then try to access the drive again (to write a new image), I see:

VFS: busy inodes on changed media or resized disk sr0
VFS: busy inodes on changed media or resized disk sr0
VFS: busy inodes on changed media or resized disk sr0

Comment 4 Josh Boyer 2012-06-06 15:31:40 UTC
Wolfgang, are you still seeing this with the 2.6.43/3.3 kernels?

Comment 5 Wolfgang Denk 2012-06-08 08:11:20 UTC
(In reply to comment #4)
> Wolfgang, are you still seeing this with the 2.6.43/3.3 kernels?

I've only tried this 2 or 3 times since, with 3.x kernel versions, and it did not cause problems then.

Comment 6 Josh Boyer 2012-06-08 11:27:28 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Wolfgang, are you still seeing this with the 2.6.43/3.3 kernels?
> 
> I've only tried this 2 or 3 times since, with 3.x kernel versions, and it
> did not cause problems then.

OK.  We'll close this out as F15 is going EOL.  If you see it again, please reopen.