diff mbox

[2/2] ceph: use d_invalidate() to invalidate aliases

Message ID 1378106394-14481-2-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng Sept. 2, 2013, 7:19 a.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

d_invalidate() is the standard VFS method to invalidate dentry.
compare to d_delete(), it also try shrinking children dentries.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 fs/ceph/caps.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alex Elder Sept. 3, 2013, 1:48 p.m. UTC | #1
On 09/02/2013 02:19 AM, Yan, Zheng wrote:
> From: "Yan, Zheng" <zheng.z.yan@intel.com>
> 
> d_invalidate() is the standard VFS method to invalidate dentry.
> compare to d_delete(), it also try shrinking children dentries.

I'm less familiar with this code than rbd and the osd client,
so you probably want another reviewer.
I have one comment though, below.

> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
>  fs/ceph/caps.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 7b451eb..13976c3 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -2346,10 +2346,10 @@ static void invalidate_aliases(struct inode *inode)
>  	d_prune_aliases(inode);
>  	/*
>  	 * For non-directory inode, d_find_alias() only returns
> -	 * connected dentry. After calling d_delete(), the dentry
> -	 * become disconnected.
> +	 * connected dentry. After calling d_invalidate(), the
> +	 * dentry become disconnected.
>  	 *
> -	 * For directory inode, d_find_alias() only can return
> +	 * For directory inode, d_find_alias() can return
>  	 * disconnected dentry. But directory inode should have
>  	 * one alias at most.
>  	 */
> @@ -2358,7 +2358,7 @@ static void invalidate_aliases(struct inode *inode)
>  			dput(dn);
>  			break;
>  		}
> -		d_delete(dn);
> +		d_invalidate(dn);

Unlike d_delete(), d_invalidate() can return an error, and in
particular will return an error if there are other dentries
reachable from the one being invalidated.  Do you need to check
for and handle an error here?

					-Alex

>  		if (prev)
>  			dput(prev);
>  		prev = dn;
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 7b451eb..13976c3 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2346,10 +2346,10 @@  static void invalidate_aliases(struct inode *inode)
 	d_prune_aliases(inode);
 	/*
 	 * For non-directory inode, d_find_alias() only returns
-	 * connected dentry. After calling d_delete(), the dentry
-	 * become disconnected.
+	 * connected dentry. After calling d_invalidate(), the
+	 * dentry become disconnected.
 	 *
-	 * For directory inode, d_find_alias() only can return
+	 * For directory inode, d_find_alias() can return
 	 * disconnected dentry. But directory inode should have
 	 * one alias at most.
 	 */
@@ -2358,7 +2358,7 @@  static void invalidate_aliases(struct inode *inode)
 			dput(dn);
 			break;
 		}
-		d_delete(dn);
+		d_invalidate(dn);
 		if (prev)
 			dput(prev);
 		prev = dn;