Whamcloud - gitweb
LU-12137 osd-ldiskfs: trace the obd device used for osd lookup 82/35582/3
authorJames Simmons <jsimmons@infradead.org>
Mon, 19 Aug 2019 13:14:55 +0000 (09:14 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 16 Sep 2019 23:03:39 +0000 (23:03 +0000)
If a osd lookup of a dentry fails a debug message is logged but
no information is given for which OSD device this happened on.
Add in the osd device information for debugging purposes.

Change-Id: If7719987682c4b9f8219c08431337306bd91ab67
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/35582
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_compat.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_oi.c
lustre/osd-ldiskfs/osd_scrub.c

index fed4238..298ce2f 100644 (file)
@@ -69,6 +69,7 @@ static void osd_push_ctxt(const struct osd_device *dev,
 /**
  * osd_lookup_one_len_unlocked
  *
+ * @dev:       obd device we are searching
  * @name:      pathname component to lookup
  * @base:      base directory to lookup from
  * @len:       maximum length @len should be interpreted to
@@ -76,7 +77,8 @@ static void osd_push_ctxt(const struct osd_device *dev,
  * This should be called without the parent
  * i_mutex held, and will take the i_mutex itself.
  */
-struct dentry *osd_lookup_one_len_unlocked(const char *name,
+struct dentry *osd_lookup_one_len_unlocked(struct osd_device *dev,
+                                          const char *name,
                                           struct dentry *base, int len)
 {
        struct dentry *dchild;
@@ -89,8 +91,9 @@ struct dentry *osd_lookup_one_len_unlocked(const char *name,
                return dchild;
 
        if (dchild->d_inode && unlikely(is_bad_inode(dchild->d_inode))) {
-               CERROR("bad inode returned %lu/%u\n",
-                      dchild->d_inode->i_ino, dchild->d_inode->i_generation);
+               CERROR("%s: bad inode returned %lu/%u: rc = -ENOENT\n",
+                      osd_name(dev), dchild->d_inode->i_ino,
+                      dchild->d_inode->i_generation);
                dput(dchild);
                dchild = ERR_PTR(-ENOENT);
        }
@@ -101,14 +104,15 @@ struct dentry *osd_lookup_one_len_unlocked(const char *name,
 /**
  * osd_ios_lookup_one_len - lookup single pathname component
  *
+ * @dev:       obd device we are searching
  * @name:      pathname component to lookup
  * @base:      base directory to lookup from
  * @len:       maximum length @len should be interpreted to
  */
-struct dentry *osd_ios_lookup_one_len(const char *name, struct dentry *base,
-                                     int len)
+struct dentry *osd_ios_lookup_one_len(struct osd_device *dev, const char *name,
+                                     struct dentry *base, int len)
 {
-       return osd_lookup_one_len_unlocked(name, base, len);
+       return osd_lookup_one_len_unlocked(dev, name, base, len);
 }
 
 /* utility to make a directory */
@@ -127,7 +131,7 @@ simple_mkdir(const struct lu_env *env, struct osd_device *osd,
 
        // ASSERT_KERNEL_CTXT("kernel doing mkdir outside kernel context\n");
        CDEBUG(D_INODE, "creating directory %.*s\n", (int)strlen(name), name);
-       dchild = osd_lookup_one_len_unlocked(name, dir, strlen(name));
+       dchild = osd_lookup_one_len_unlocked(osd, name, dir, strlen(name));
        if (IS_ERR(dchild))
                RETURN(dchild);
 
@@ -207,7 +211,7 @@ static int osd_last_rcvd_subdir_count(struct osd_device *osd)
 
        ENTRY;
 
-       dlast = osd_lookup_one_len_unlocked(LAST_RCVD, osd_sb(osd)->s_root,
+       dlast = osd_lookup_one_len_unlocked(osd, LAST_RCVD, osd_sb(osd)->s_root,
                                            strlen(LAST_RCVD));
        if (IS_ERR(dlast))
                return PTR_ERR(dlast);
@@ -1427,7 +1431,7 @@ int osd_obj_spec_lookup(struct osd_thread_info *info, struct osd_device *osd,
                        RETURN(-ENOENT);
        }
 
-       dentry = osd_lookup_one_len_unlocked(name, root, strlen(name));
+       dentry = osd_lookup_one_len_unlocked(osd, name, root, strlen(name));
        if (!IS_ERR(dentry)) {
                inode = dentry->d_inode;
                if (inode) {
index 8b62608..c76b2a0 100644 (file)
@@ -797,10 +797,12 @@ int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid,
                   struct osd_inode_id *id);
 void osd_scrub_dump(struct seq_file *m, struct osd_device *dev);
 
-struct dentry *osd_lookup_one_len_unlocked(const char *name,
+struct dentry *osd_lookup_one_len_unlocked(struct osd_device *dev,
+                                          const char *name,
                                           struct dentry *base, int len);
-struct dentry *osd_ios_lookup_one_len(const char *name, struct dentry *base,
-                                     int len);
+struct dentry *osd_ios_lookup_one_len(struct osd_device *dev,
+                                     const char *name,
+                                     struct dentry *base, int len);
 
 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd,
                   u64 seq, struct lu_seq_range *range);
index fcd42bd..44d56d9 100644 (file)
@@ -161,7 +161,7 @@ static struct inode *osd_oi_index_open(struct osd_thread_info *info,
         struct inode  *inode;
         int            rc;
 
-       dentry = osd_lookup_one_len_unlocked(name, osd_sb(osd)->s_root,
+       dentry = osd_lookup_one_len_unlocked(osd, name, osd_sb(osd)->s_root,
                                             strlen(name));
         if (IS_ERR(dentry))
                return ERR_CAST(dentry);
@@ -184,7 +184,7 @@ static struct inode *osd_oi_index_open(struct osd_thread_info *info,
         if (rc)
                return ERR_PTR(rc);
 
-       dentry = osd_lookup_one_len_unlocked(name, osd_sb(osd)->s_root,
+       dentry = osd_lookup_one_len_unlocked(osd, name, osd_sb(osd)->s_root,
                                             strlen(name));
         if (IS_ERR(dentry))
                return ERR_CAST(dentry);
@@ -337,13 +337,13 @@ osd_oi_table_open(struct osd_thread_info *info, struct osd_device *osd,
        RETURN(count);
 }
 
-static int osd_remove_oi_one(struct dentry *parent, const char *name,
-                            int namelen)
+static int osd_remove_oi_one(struct osd_device *osd, struct dentry *parent,
+                            const char *name, int namelen)
 {
        struct dentry *child;
        int rc;
 
-       child = osd_lookup_one_len_unlocked(name, parent, namelen);
+       child = osd_lookup_one_len_unlocked(osd, name, parent, namelen);
        if (IS_ERR(child)) {
                rc = PTR_ERR(child);
        } else {
@@ -367,7 +367,7 @@ static int osd_remove_ois(struct osd_thread_info *info, struct osd_device *osd)
        for (i = 0; i < OSD_OI_FID_NR_MAX; i++) {
                namelen = snprintf(name, sizeof(name), "%s.%d",
                                   OSD_OI_NAME_BASE, i);
-               rc = osd_remove_oi_one(osd_sb(osd)->s_root, name, namelen);
+               rc = osd_remove_oi_one(osd, osd_sb(osd)->s_root, name, namelen);
                if (rc != 0) {
                        CERROR("%s: fail to remove the stale OI file %s: "
                               "rc = %d\n", osd_dev2name(osd), name, rc);
@@ -376,7 +376,7 @@ static int osd_remove_ois(struct osd_thread_info *info, struct osd_device *osd)
        }
 
        namelen = snprintf(name, sizeof(name), "%s", OSD_OI_NAME_BASE);
-       rc = osd_remove_oi_one(osd_sb(osd)->s_root, name, namelen);
+       rc = osd_remove_oi_one(osd, osd_sb(osd)->s_root, name, namelen);
        if (rc != 0)
                CERROR("%s: fail to remove the stale OI file %s: rc = %d\n",
                       osd_dev2name(osd), name, rc);
index 184c83a..adabfd3 100644 (file)
@@ -2022,7 +2022,7 @@ static int osd_ios_lf_fill(void *buf,
                RETURN(0);
 
        scrub->os_lf_scanned++;
-       child = osd_ios_lookup_one_len(name, parent, namelen);
+       child = osd_ios_lookup_one_len(dev, name, parent, namelen);
        if (IS_ERR(child)) {
                CDEBUG(D_LFSCK, "%s: cannot lookup child '%.*s': rc = %d\n",
                      osd_name(dev), namelen, name, (int)PTR_ERR(child));
@@ -2096,7 +2096,8 @@ static int osd_ios_varfid_fill(void *buf,
        if (name[0] == '.')
                RETURN(0);
 
-       child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+       child = osd_ios_lookup_one_len(dev, name, fill_buf->oifb_dentry,
+                                      namelen);
        if (IS_ERR(child))
                RETURN(PTR_ERR(child));
 
@@ -2144,7 +2145,8 @@ static int osd_ios_dl_fill(void *buf,
        if (map->olm_name == NULL)
                RETURN(0);
 
-       child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+       child = osd_ios_lookup_one_len(dev, name, fill_buf->oifb_dentry,
+                                      namelen);
        if (IS_ERR(child))
                RETURN(PTR_ERR(child));
 
@@ -2166,6 +2168,7 @@ static int osd_ios_uld_fill(void *buf,
 {
        struct osd_ios_filldir_buf *fill_buf =
                (struct osd_ios_filldir_buf *)buf;
+       struct osd_device *dev = fill_buf->oifb_dev;
        struct dentry              *child;
        struct lu_fid               tfid;
        int                         rc       = 0;
@@ -2177,7 +2180,8 @@ static int osd_ios_uld_fill(void *buf,
        if (name[0] != '[')
                RETURN(0);
 
-       child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+       child = osd_ios_lookup_one_len(dev, name, fill_buf->oifb_dentry,
+                                      namelen);
        if (IS_ERR(child))
                RETURN(PTR_ERR(child));
 
@@ -2227,7 +2231,8 @@ static int osd_ios_root_fill(void *buf,
        if (map->olm_name == NULL)
                RETURN(0);
 
-       child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+       child = osd_ios_lookup_one_len(dev, name, fill_buf->oifb_dentry,
+                                      namelen);
        if (IS_ERR(child))
                RETURN(PTR_ERR(child));
        else if (!child->d_inode)
@@ -2317,7 +2322,7 @@ osd_ios_ROOT_scan(struct osd_thread_info *info, struct osd_device *dev,
         *      OI mapping crashed or lost also, then we have to give up under
         *      double failure cases. */
        scrub->os_convert_igif = 1;
-       child = osd_ios_lookup_one_len(dot_lustre_name, dentry,
+       child = osd_ios_lookup_one_len(dev, dot_lustre_name, dentry,
                                       strlen(dot_lustre_name));
        if (IS_ERR(child)) {
                if (PTR_ERR(child) != -ENOENT)
@@ -2390,7 +2395,8 @@ osd_ios_OBJECTS_scan(struct osd_thread_info *info, struct osd_device *dev,
                        RETURN(rc);
        }
 
-       child = osd_ios_lookup_one_len(ADMIN_USR, dentry, strlen(ADMIN_USR));
+       child = osd_ios_lookup_one_len(dev, ADMIN_USR, dentry,
+                                      strlen(ADMIN_USR));
        if (IS_ERR(child)) {
                rc = PTR_ERR(child);
        } else {
@@ -2403,7 +2409,8 @@ osd_ios_OBJECTS_scan(struct osd_thread_info *info, struct osd_device *dev,
        if (rc != 0 && rc != -ENOENT)
                GOTO(out, rc);
 
-       child = osd_ios_lookup_one_len(ADMIN_GRP, dentry, strlen(ADMIN_GRP));
+       child = osd_ios_lookup_one_len(dev, ADMIN_GRP, dentry,
+                                      strlen(ADMIN_GRP));
        if (IS_ERR(child))
                GOTO(out, rc = PTR_ERR(child));
 
@@ -2459,7 +2466,7 @@ static void osd_initial_OI_scrub(struct osd_thread_info *info,
                        continue;
                }
 
-               child = osd_ios_lookup_one_len(map->olm_name,
+               child = osd_ios_lookup_one_len(dev, map->olm_name,
                                               osd_sb(dev)->s_root,
                                               map->olm_namelen);
                if (PTR_ERR(child) == -ENOENT ||