All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Bob Peterson <rpeterso@redhat.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nfs@vger.kernel.org, Miklos Szeredi <mszeredi@suse.cz>
Subject: Re: [PATCH] dcache: fix d_splice_alias handling of aliases
Date: Thu, 16 Jan 2014 13:51:07 -0500	[thread overview]
Message-ID: <20140116185107.GE16829@fieldses.org> (raw)
In-Reply-To: <1875464309.3327883.1389891247171.JavaMail.root@redhat.com>

On Thu, Jan 16, 2014 at 11:54:07AM -0500, Bob Peterson wrote:
> ----- Original Message -----
> | Something like this?
> (snip)
> | @@ -779,6 +782,11 @@ static struct dentry *__gfs2_lookup(struct inode *dir,
> | struct dentry *dentry,
> |  	}
> |  
> |  	d = d_splice_alias(inode, dentry);
> | +	if (IS_ERR(d)) {
> | +		iput(inode);
> | +		gfs2_glock_dq_uninit(&gh);
> | +		return ERR_PTR(error);
> 
> ---------------------------------^
> Shouldn't that be ERR_PTR(d)?

Oops, yeah--well, actually just "d" I guess.

This is what I've got for what it's worth.

--b.

commit 6fba5295019b52a03d76c9e9570952466051a7a6
Author: J. Bruce Fields <bfields@redhat.com>
Date:   Thu Jan 16 11:44:53 2014 -0500

    gfs2: revert "GFS2: d_splice_alias() can't return error"
    
    0d0d110720d7960b77c03c9f2597faaff4b484ae asserts that "d_splice_alias()
    can't return error unless it was given an IS_ERR(inode)".
    
    That was true of the implementation of d_splice_alias, but this is
    really a problem with d_splice_alias: at a minimum it should be able to
    return -ELOOP in the case where inserting the given dentry would cause a
    directory loop.
    
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 7119504..3f44902 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -585,6 +585,9 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 	error = PTR_ERR(inode);
 	if (!IS_ERR(inode)) {
 		d = d_splice_alias(inode, dentry);
+		error = PTR_ERR(d);
+		if (IS_ERR(d))
+			goto fail_gunlock;
 		error = 0;
 		if (file) {
 			if (S_ISREG(inode->i_mode)) {
@@ -779,6 +782,11 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
 	}
 
 	d = d_splice_alias(inode, dentry);
+	if (IS_ERR(d)) {
+		iput(inode);
+		gfs2_glock_dq_uninit(&gh);
+		return d;
+	}
 	if (file && S_ISREG(inode->i_mode))
 		error = finish_open(file, dentry, gfs2_open_common, opened);
 

  reply	other threads:[~2014-01-16 18:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 15:17 [PATCH] dcache: fix d_splice_alias handling of aliases J. Bruce Fields
2014-01-15 15:17 ` J. Bruce Fields
2014-01-15 17:34 ` Miklos Szeredi
2014-01-15 17:57   ` J. Bruce Fields
2014-01-15 18:25     ` Miklos Szeredi
2014-01-15 18:25       ` Miklos Szeredi
2014-01-16 15:41       ` J. Bruce Fields
2014-01-16 16:13         ` Miklos Szeredi
2014-01-16 16:13           ` Miklos Szeredi
2014-01-16 16:10 ` J. Bruce Fields
2014-01-16 16:10   ` J. Bruce Fields
2014-01-16 16:15   ` Steven Whitehouse
2014-01-16 16:44     ` J. Bruce Fields
2014-01-16 16:44       ` J. Bruce Fields
2014-01-16 16:54       ` Bob Peterson
2014-01-16 18:51         ` J. Bruce Fields [this message]
2014-01-17 10:04           ` Steven Whitehouse
2014-01-17 18:04             ` J. Bruce Fields
2014-01-17 12:17 ` Christoph Hellwig
2014-01-17 15:39   ` J. Bruce Fields
2014-01-17 15:39     ` J. Bruce Fields
2014-01-17 21:03     ` J. Bruce Fields
2014-01-17 21:03       ` J. Bruce Fields
2014-01-17 21:26       ` J. Bruce Fields
2014-01-17 21:26         ` J. Bruce Fields
2014-01-23 21:27         ` [PATCH] dcache: make d_splice_alias use d_materialise_unique J. Bruce Fields
2014-01-31 18:42           ` Al Viro
2014-01-31 19:47             ` J. Bruce Fields
2014-02-06 17:03               ` J. Bruce Fields
2014-02-06 17:03                 ` J. Bruce Fields

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=20140116185107.GE16829@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=rpeterso@redhat.com \
    --cc=swhiteho@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.