From: Timothy Shimmin <tes@sgi.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Miklos Szeredi <miklos@szeredi.hu>, xfs-oss <xfs@oss.sgi.com>
Subject: XFS_ERROR use - was Re: [PATCH] prevent NULL returns from d_obtain_alias
Date: Fri, 17 Oct 2008 11:11:00 +1100 [thread overview]
Message-ID: <48F7D814.2080705@sgi.com> (raw)
In-Reply-To: <20081016180947.GA26285@lst.de>
Christoph Hellwig wrote:
> On Thu, Oct 16, 2008 at 07:50:10PM +0200, Miklos Szeredi wrote:
>> should be
>>
>> return -XFS_ERROR(-PTR_ERR(dentry));
>
> No need for XFS_ERROR at all here, it's only used for error injection in
> low-level code. Updated version that propagates the error below:
>
> (Al, if you rebase vfs.git this should probably be folded into the patch
> that switches over to d_obtain_alias)
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
[...stuff deleted]
> Index: vfs-2.6/fs/xfs/linux-2.6/xfs_ioctl.c
> ===================================================================
> --- vfs-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl.c 2008-10-15 21:26:33.000000000 +0200
> +++ vfs-2.6/fs/xfs/linux-2.6/xfs_ioctl.c 2008-10-16 20:06:20.000000000 +0200
> @@ -312,9 +312,9 @@ xfs_open_by_handle(
> }
>
> dentry = d_obtain_alias(inode);
> - if (dentry == NULL) {
> + if (IS_ERR(dentry)) {
> put_unused_fd(new_fd);
> - return -XFS_ERROR(ENOMEM);
> + return PTR_ERR(dentry);
> }
>
> /* Ensure umount returns EBUSY on umounts while this file is open. */
> --
Fair enough.
But XFS_ERROR is used throughout the function.
I've found the whole idea of when and when not to use XFS_ERROR annoying :)
I've never used it (other than calling it to stay consistent with the code).
Looking at the code, it is used to BUG and print a msg on particular error codes set in xfs_etrap[] -
and it does this in xfs_error_trap().
Can one not decide to do this at any error point?
I can't see where we hook in to set up xfs_etrap.
> #ifdef DEBUG
> #define XFS_ERROR_NTRAP 10
> extern int xfs_etrap[XFS_ERROR_NTRAP];
> extern int xfs_error_trap(int);
> #define XFS_ERROR(e) xfs_error_trap(e)
> #else
> #define XFS_ERROR(e) (e)
> #endif
Cheers,
Tim.
next parent reply other threads:[~2008-10-17 0:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081015192839.GA867@lst.de>
[not found] ` <E1KqWzC-00087u-TG@pomaz-ex.szeredi.hu>
[not found] ` <20081016180947.GA26285@lst.de>
2008-10-17 0:11 ` Timothy Shimmin [this message]
2008-10-17 1:53 ` XFS_ERROR use - was Re: [PATCH] prevent NULL returns from d_obtain_alias Dave Chinner
2008-10-17 3:04 ` Eric Sandeen
2008-10-17 17:10 ` Christoph Hellwig
2008-10-20 0:49 ` Timothy Shimmin
2008-10-20 9:23 ` Christoph Hellwig
2008-10-20 23:16 ` Timothy Shimmin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48F7D814.2080705@sgi.com \
--to=tes@sgi.com \
--cc=hch@lst.de \
--cc=miklos@szeredi.hu \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox