diff mbox series

[v2,13/20] vfat_revalidate{,_ci}(): use stable parent inode passed by caller

Message ID 20250116052317.485356-13-viro@zeniv.linux.org.uk (mailing list archive)
State New
Headers show
Series [v2,01/20] make sure that DNAME_INLINE_LEN is a multiple of word size | expand

Commit Message

Al Viro Jan. 16, 2025, 5:23 a.m. UTC
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/fat/namei_vfat.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Jeff Layton Jan. 17, 2025, 3:22 p.m. UTC | #1
On Thu, 2025-01-16 at 05:23 +0000, Al Viro wrote:
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
>  fs/fat/namei_vfat.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
> index f9cbd5c6f932..926c26e90ef8 100644
> --- a/fs/fat/namei_vfat.c
> +++ b/fs/fat/namei_vfat.c
> @@ -43,14 +43,9 @@ static inline void vfat_d_version_set(struct dentry *dentry,
>   * If it happened, the negative dentry isn't actually negative
>   * anymore.  So, drop it.
>   */
> -static int vfat_revalidate_shortname(struct dentry *dentry)
> +static bool vfat_revalidate_shortname(struct dentry *dentry, struct inode *dir)
>  {
> -	int ret = 1;
> -	spin_lock(&dentry->d_lock);
> -	if (!inode_eq_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry)))
> -		ret = 0;
> -	spin_unlock(&dentry->d_lock);
> -	return ret;
> +	return inode_eq_iversion(dir, vfat_d_version(dentry));
>  }
>  
>  static int vfat_revalidate(struct inode *dir, const struct qstr *name,
> @@ -62,7 +57,7 @@ static int vfat_revalidate(struct inode *dir, const struct qstr *name,
>  	/* This is not negative dentry. Always valid. */
>  	if (d_really_is_positive(dentry))
>  		return 1;
> -	return vfat_revalidate_shortname(dentry);
> +	return vfat_revalidate_shortname(dentry, dir);
>  }
>  
>  static int vfat_revalidate_ci(struct inode *dir, const struct qstr *name,
> @@ -99,7 +94,7 @@ static int vfat_revalidate_ci(struct inode *dir, const struct qstr *name,
>  	if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
>  		return 0;
>  
> -	return vfat_revalidate_shortname(dentry);
> +	return vfat_revalidate_shortname(dentry, dir);
>  }
>  
>  /* returns the length of a struct qstr, ignoring trailing dots */

Reviewed-by: Jeff Layton <jlayton@kernel.org>

Al, you can also add my R-b to 1-12 too.

Nice work!
diff mbox series

Patch

diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index f9cbd5c6f932..926c26e90ef8 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -43,14 +43,9 @@  static inline void vfat_d_version_set(struct dentry *dentry,
  * If it happened, the negative dentry isn't actually negative
  * anymore.  So, drop it.
  */
-static int vfat_revalidate_shortname(struct dentry *dentry)
+static bool vfat_revalidate_shortname(struct dentry *dentry, struct inode *dir)
 {
-	int ret = 1;
-	spin_lock(&dentry->d_lock);
-	if (!inode_eq_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry)))
-		ret = 0;
-	spin_unlock(&dentry->d_lock);
-	return ret;
+	return inode_eq_iversion(dir, vfat_d_version(dentry));
 }
 
 static int vfat_revalidate(struct inode *dir, const struct qstr *name,
@@ -62,7 +57,7 @@  static int vfat_revalidate(struct inode *dir, const struct qstr *name,
 	/* This is not negative dentry. Always valid. */
 	if (d_really_is_positive(dentry))
 		return 1;
-	return vfat_revalidate_shortname(dentry);
+	return vfat_revalidate_shortname(dentry, dir);
 }
 
 static int vfat_revalidate_ci(struct inode *dir, const struct qstr *name,
@@ -99,7 +94,7 @@  static int vfat_revalidate_ci(struct inode *dir, const struct qstr *name,
 	if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
 		return 0;
 
-	return vfat_revalidate_shortname(dentry);
+	return vfat_revalidate_shortname(dentry, dir);
 }
 
 /* returns the length of a struct qstr, ignoring trailing dots */