xfs
[Top] [All Lists]

Re: [PATCH 2/2] xfs: Nuke XFS_ERROR macro

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/2] xfs: Nuke XFS_ERROR macro
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Wed, 16 Apr 2014 14:11:32 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <534EC42D.1080704@xxxxxxxxxxx>
References: <534EC073.8090006@xxxxxxxxxxx> <534EC282.7010905@xxxxxxxxxxx> <20140416175117.GA23643@xxxxxxxxxxxxx> <534EC42D.1080704@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
On 4/16/14, 12:55 PM, Eric Sandeen wrote:
> On 4/16/14, 12:51 PM, Christoph Hellwig wrote:
>> On Wed, Apr 16, 2014 at 12:48:50PM -0500, Eric Sandeen wrote:
>>> XFS_ERROR was designed long ago to trap return values,
>>> but it's not runtime configurable, it's not consistently used,
>>> and we can do the same thing today with systemtap, using
>>> something like:
>>>
>>> probe module("xfs").function("xfs_*").return { if (@defined($return) && 
>>> $return == VALUE) { ... } }
>>
>> Gives me a version just using ftrace, or at least a kprobes based module
>> that we can merged in the kernel tree and this would be fine for me.
>>
>> Requiring a massive blob of questionable out of tree module code and a
>> compiler is an absolute no-go.
> 
> Ok, fair point.
>  
>> NAK for now.
> 
> Even if we don't have a replacement, I have yet to find anyone who has
> ever used it...
> 
> Anyway, I'll look into options besides systemtap.

Here's the "best" I've come up with so far...

# for FUNCTION in `grep "t xfs_" /proc/kallsyms | awk '{print $3}'`; do echo 
"r:ret_$FUNCTION $FUNCTION \$retval" >> 
/sys/kernel/debug/tracing/kprobe_events; done

# for ENABLE in /sys/kernel/debug/tracing/events/kprobes/ret_xfs_*/enable; do 
echo 1 > $ENABLE; done

run a test that fails:

# dd if=/dev/zero of=newfile bs=513 oflag=direct
dd: writing `newfile': Invalid argument

# for ENABLE in /sys/kernel/debug/tracing/events/kprobes/ret_xfs_*/enable; do 
echo 0 > $ENABLE; done

# cat /sys/kernel/debug/tracing/trace
<snip>
           <...>-63791 [000] d... 705435.568913: ret_xfs_vn_mknod: 
(xfs_vn_create+0x13/0x20 [xfs] <- xfs_vn_mknod) arg1=0
           <...>-63791 [000] d... 705435.568913: ret_xfs_vn_create: 
(vfs_create+0xdb/0x100 <- xfs_vn_create) arg1=0
           <...>-63791 [000] d... 705435.568918: ret_xfs_file_open: 
(do_dentry_open+0x24e/0x2e0 <- xfs_file_open) arg1=0
           <...>-63791 [000] d... 705435.568934: ret_xfs_file_dio_aio_write: 
(xfs_file_aio_write+0x147/0x150 [xfs] <- xfs_file_dio_aio_write) 
arg1=ffffffffffffffea

Hey look, it's "-22" in hex!  ;)

so it's possible, but bleah.

<Prev in Thread] Current Thread [Next in Thread>