Whamcloud - gitweb
LU-9868 llite: Get rid of ll_dcompare 75/24175/5
authorOleg Drokin <oleg.drokin@intel.com>
Fri, 3 Apr 2020 03:24:04 +0000 (23:24 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Apr 2020 08:09:02 +0000 (08:09 +0000)
The problem with real_lookup, and real_lookup itself are long gone,
so let's kick out invalid dentries in revalidate now.

Change-Id: Ieb274645245a19ac4917e0ec4643a0c44aa32cd3
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: https://review.whamcloud.com/24175
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/dcache.c

index a466c76..876d112 100644 (file)
@@ -428,23 +428,6 @@ dir_context, [
 ]) # LC_HAVE_DIR_CONTEXT
 
 #
-# LC_D_COMPARE_5ARGS
-#
-# 3.11 dentry_operations.d_compare() taken 5 arguments.
-#
-AC_DEFUN([LC_D_COMPARE_5ARGS], [
-LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
-d_compare_5args, [
-       #include <linux/dcache.h>
-],[
-       ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
-],[
-       AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
-               [d_compare need 5 arguments])
-])
-]) # LC_D_COMPARE_5ARGS
-
-#
 # LC_HAVE_DCOUNT
 #
 # 3.11 need to access d_count to get dentry reference count
@@ -1536,24 +1519,6 @@ posix_acl_valid, [
 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
 
 #
-# LC_D_COMPARE_4ARGS
-#
-# Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
-# get rid of 'parent' argument of ->d_compare()
-#
-AC_DEFUN([LC_D_COMPARE_4ARGS], [
-LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
-d_compare_4args, [
-       #include <linux/dcache.h>
-],[
-       ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
-],[
-       AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
-               [d_compare need 4 arguments])
-])
-]) # LC_D_COMPARE_4ARGS
-
-#
 # LC_FULL_NAME_HASH_3ARGS
 #
 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
@@ -2175,7 +2140,6 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 3.11
        LC_INVALIDATE_RANGE
        LC_HAVE_DIR_CONTEXT
-       LC_D_COMPARE_5ARGS
        LC_HAVE_DCOUNT
        LC_HAVE_DENTRY_D_U_D_ALIAS
        LC_HAVE_DENTRY_D_CHILD
@@ -2267,7 +2231,6 @@ AC_DEFUN([LC_PROG_LINUX], [
 
        # 4.8
        LC_HAVE_POSIX_ACL_VALID_USER_NS
-       LC_D_COMPARE_4ARGS
        LC_FULL_NAME_HASH_3ARGS
        LC_STRUCT_POSIX_ACL_XATTR
        LC_IOP_XATTR
index d33e680..cc03462 100644 (file)
@@ -66,55 +66,6 @@ static void ll_release(struct dentry *de)
        EXIT;
 }
 
-/* Compare if two dentries are the same.  Don't match if the existing dentry
- * is marked invalid.  Returns 1 if different, 0 if the same.
- *
- * This avoids a race where ll_lookup_it() instantiates a dentry, but we get
- * an AST before calling d_revalidate_it().  The dentry still exists (marked
- * INVALID) so d_lookup() matches it, but we have no lock on it (so
- * lock_match() fails) and we spin around real_lookup().
- *
- * This race doesn't apply to lookups in d_alloc_parallel(), and for
- * those we want to ensure that only one dentry with a given name is
- * in ll_lookup_nd() at a time.  So allow invalid dentries to match
- * while d_in_lookup().  We will be called again when the lookup
- * completes, and can give a different answer then.
- */
-#if defined(HAVE_D_COMPARE_5ARGS)
-static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
-                      unsigned int len, const char *str,
-                      const struct qstr *name)
-#elif defined(HAVE_D_COMPARE_4ARGS)
-static int ll_dcompare(const struct dentry *dentry, unsigned int len,
-                      const char *str, const struct qstr *name)
-#endif
-{
-       ENTRY;
-
-       if (len != name->len)
-               RETURN(1);
-
-       if (memcmp(str, name->name, len))
-               RETURN(1);
-
-       CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
-              name->len, name->name, dentry, dentry->d_flags,
-              ll_d_count(dentry));
-
-       /* mountpoint is always valid */
-       if (d_mountpoint((struct dentry *)dentry))
-               RETURN(0);
-
-       /* ensure exclusion against parallel lookup of the same name */
-       if (d_in_lookup((struct dentry *)dentry))
-               return 0;
-
-       if (d_lustre_invalid(dentry))
-               RETURN(1);
-
-       RETURN(0);
-}
-
 /**
  * Called when last reference to a dentry is dropped and dcache wants to know
  * whether or not it should cache it:
@@ -290,6 +241,14 @@ static int ll_revalidate_dentry(struct dentry *dentry,
        CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n",
               dentry->d_name.name, lookup_flags);
 
+       /* mountpoint is always valid */
+       if (d_mountpoint((struct dentry *)dentry))
+               return 1;
+
+       /* No lock -> invalid dentry */
+       if (d_lustre_invalid(dentry))
+               return 0;
+
        /* If this is intermediate component path lookup and we were able to get
         * to this dentry, then its lock has not been revoked and the
         * path component is valid. */
@@ -326,5 +285,4 @@ const struct dentry_operations ll_d_ops = {
        .d_revalidate   = ll_revalidate_dentry,
         .d_release = ll_release,
         .d_delete  = ll_ddelete,
-        .d_compare = ll_dcompare,
 };