Bug 170143

Summary: rm command hangs when removing a symlink on ext2 loop filesystem
Product: Red Hat Enterprise Linux 4 Reporter: rich turner <rturner>
Component: kernelAssignee: Peter Staubach <staubach>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: pegasus, sct
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2006-0575 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-10 21:24:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 181409    
Attachments:
Description Flags
Reproducible testcase
none
Proposed patch none

Description rich turner 2005-10-07 18:17:44 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 Firefox/1.0.7 SUSE/1.0.7-0.1

Description of problem:
when i try to remove a symbollic link from an ext2 loop filesystem the system hangs. this does not happen if i use ext3

Version-Release number of selected component (if applicable):
e2fsprogs-1.35-11.6.EL4 kernel-2.6.9-5.EL

How reproducible:
Always

Steps to Reproduce:
1. losetup /dev/loop0
2. dd if=/dev/zero of=/tmp/tmploopfs
3. mkfs.ext2 -F -N 3401 -m 0 /tmp/tmploopfs
4. mount -t ext2 -o loop,sync /tmp/tmploopfs /mnt
5. cp -Rpd /tmp/testfile /mnt
6. ln -sf /mnt/testfile /mnt/testlink
7. rm /mnt/testlink
  

Actual Results:  the rm command just hangs

Expected Results:  /mnt/testlink should have been removed and i should be at a command prompt

Additional info:

if i use mkfs.ext3 instead of mkfs.ext2 it performs as expected

Comment 1 rich turner 2005-10-07 18:19:56 UTC
step #2 should read:
dd if=/dev/zero of=/tmp/tmploopfs bs=1k count=32768

Comment 2 Thomas Woerner 2005-11-10 14:41:57 UTC
This seems not to be a userland e2fsprogs problem. Assigning to kernel.

Comment 3 Peter Staubach 2006-02-13 22:22:02 UTC
Created attachment 124582 [details]
Reproducible testcase

Comment 4 Peter Staubach 2006-02-13 22:22:58 UTC
I attached a testcase which was constructed out of the directions above.

Comment 5 Peter Staubach 2006-02-13 22:27:14 UTC
The problem seems to be that ext2_xattr_delete_inode() calls
lock_buffer(bh) and then, because the file system was mounted
with the "sync" option, calls sync_dirty_buffer(bh).  The
routine, sync_dirty_buffer, immediately calls lock_buffer(bh),
again.

This is a deadlock.  The solution is to call unlock_dirty_buffer(bh)
before invoking sync_dirty_buffer(bh) so that the buffer head is
unlocked.

I alao rearranged and updated some debugging code to match the
change in locking.

Comment 6 Peter Staubach 2006-02-13 22:40:11 UTC
Created attachment 124585 [details]
Proposed patch

Comment 7 Peter Staubach 2006-02-14 14:11:58 UTC
*** Bug 180028 has been marked as a duplicate of this bug. ***

Comment 12 Red Hat Bugzilla 2006-08-10 21:24:15 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2006-0575.html