Bug 12538

Summary: xfs_fsr fails on 2.6.29-rc kernels
Product: File System Reporter: Paul Martin (pm)
Component: XFSAssignee: Eric Sandeen (sandeen)
Status: CLOSED CODE_FIX    
Severity: normal CC: rjw, sandeen
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.29-rc1 Tree: Mainline
Regression: Yes
Bug Depends on:    
Bug Blocks: 12398    
Attachments: potential fix

Description Paul Martin 2009-01-25 13:02:40 UTC
Latest working kernel version: 2.6.28-rc9
Earliest failing kernel version: 2.6.29-rc1
Distribution: Debian
Hardware Environment: IBM Thinkpad T42
Software Environment: 
Problem Description:

xfs_fsr -v fails with:

XFS_IOC_SWAPEXT failed: ino=XXXXXXX: Invalid argument

Steps to reproduce:

Run xfs_fsr on a moderately fragmented filesystem.

Have git-bisected this to the following patch:

commit 743bb4650da9e2595d6cedd01c680b5b9398c74a
Author: sandeen@sandeen.net <sandeen@sandeen.net>
Date:   Tue Nov 25 21:20:06 2008 -0600

    [XFS] Move copy_from_user calls out of ioctl helpers into ioctl switch.

    Moving the copy_from_user out of some of the ioctl helpers will
    make it easier for the compat ioctl switch to copy in the right
    struct, then just pass to the underlying helper.

    Also, move common access checks into the helpers themselves,
    and out of the native ioctl switch code, to reduce code
    duplication between native & compat ioctl callers.

    Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Comment 1 Eric Sandeen 2009-01-25 15:36:13 UTC
Thanks for doing the bisecting.

Which arch is this on, and if a 64-bit arch, is it 32 bit or 64 bit userspace?
Comment 2 Paul Martin 2009-01-25 15:58:39 UTC
32-bit i686.

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Pentium(R) M processor 1.70GHz
stepping        : 6
Comment 3 Eric Sandeen 2009-01-25 16:19:33 UTC
Created attachment 19986 [details]
potential fix

Wow, that was an incredibly dumb mistake on my part, not sure how it ever worked at all.  Does this help?
Comment 4 Paul Martin 2009-01-25 18:44:29 UTC
Yes, it fixes it.
Comment 5 Eric Sandeen 2009-01-25 18:56:00 UTC
thanks so much for finding, bisecting, and testing.

Patch sent to the list, cc'd akpm, should get upstream soon if all goes well.  :)
Comment 6 Rafael J. Wysocki 2009-02-01 13:55:29 UTC
Handled-By : Eric Sandeen <sandeen@sandeen.net
Patch : http://bugzilla.kernel.org/attachment.cgi?id=19986&action=view

First-Bad-Commit : 743bb4650da9e2595d6cedd01c680b5b9398c74a
Comment 7 Rafael J. Wysocki 2009-02-08 13:13:56 UTC
Fixed by commit f0e0059b9c18426cffdcc04161062251a8f9741e .