Re: Bug : XFS - XSCALE "Directory Not Empty"

Top Page
Attachments:
Message as email
+ (text/plain)
+ xfs-20040217.patch (text/plain)
Delete this message
Reply to this message
Author: Greg Ungerer
Date:  
To: Vinesh Christopher
CC: 'linux-arm-kernel@lists.arm.linux.org.uk'
Subject: Re: Bug : XFS - XSCALE "Directory Not Empty"
Hi Vinesh,

Vinesh Christopher wrote:
> Intel IQ80321 (Xscale) Evaluation Board
> Running Linux 2.6.0 with -rmk2 -iop1 patches
> xfsprogs_2.6.3-1 is taken from debian
>
> I did the following
>
> # mkfs.xfs /dev/sda1
> # mount /dev/sda1 /mnt
> # cd /mnt
> # mkdir t
> # cp /lib/* t
> # rm -r -f t
> rm: cannot remove directory 't' : Directory not empty
> #


I had similar behavior using XFS on an XSCALE/IXP425 platform
(I was using a 2.4.24 kernel at the time).

If you turn on XFS debug mode do you get any warnings/errors?

With debug mode enabled I was getting:

   XFS assertion failed: (char *)sfep - (char *)sfp == size, file:
      xfs_dir2_sf.c, line: 287


When doing a "rm -rf" type removal of files.

I don't completely understand why but the size calculation
done in function xfs_dir2_block_sfsize() doesn't seem to
match up when the code actually constructs the short form
directory list. I fixed with the small patch below, and it
seems to basically work.

I am not using XFS anymore, so only did limited testing on
it with this. I really have no idea either why this only
seemed to effect my IXP425 platform and not other architectures
as well.

This change could be completely wrong, and people with
a better understanding of XFS could well do better...
I have been meaning to mail on the XFS list about this,
just didn't get around to it yet.

Rgeards
Greg



------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     
SnapGear -- a CyberGuard Company            PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com

--- xfs_dir2_sf.c.org    2004-02-17 14:56:16.000000000 +1000
+++ xfs_dir2_sf.c    2004-02-17 14:55:16.000000000 +1000
@@ -148,6 +148,7 @@
         /*
          * Calculate the new size, see if we should give up yet.
          */
+#if 0
         size = XFS_DIR2_SF_HDR_SIZE(i8count) +        /* header */
                count +                    /* namelen */
                count * (uint)sizeof(xfs_dir2_sf_off_t) + /* offset */
@@ -155,6 +156,13 @@
                (i8count ?                /* inumber */
                 (uint)sizeof(xfs_dir2_ino8_t) * count :
                 (uint)sizeof(xfs_dir2_ino4_t) * count);
+#endif
+        size = XFS_DIR2_SF_HDR_SIZE(i8count)        /* header */
+               + namelen
+               + (count * (sizeof(xfs_dir2_sf_entry_t) - 1))
+               - (count * (((i8count == 0) ? 1 : 0) *
+                (sizeof(xfs_dir2_ino8_t) - sizeof(xfs_dir2_ino4_t))));
+            
         if (size > XFS_IFORK_DSIZE(dp))
             return size;        /* size value is a failure */
     }