Whamcloud - gitweb
LU-13980 osd-ldiskfs: print label instead of device 38/40738/4
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 24 Nov 2020 07:35:17 +0000 (00:35 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 3 Dec 2020 07:27:50 +0000 (07:27 +0000)
Print out the volume label (e.g. fsname-OST0000) in error messages
instead of the device name (e.g. dm-2) so that it is easier to
correlate this with other messages in the log.

Fix error strings to be on one line to match code style.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Iff31bc962ca32b1f3a13f579700d03835a3ebbe5
Reviewed-on: https://review.whamcloud.com/40738
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_iam.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_io.c
lustre/osd-ldiskfs/osd_scrub.c

index e9388f3..24db85c 100644 (file)
@@ -467,12 +467,11 @@ int osd_get_lma(struct osd_thread_info *info, struct inode *inode,
                lustre_loa_swab(loa, true);
                /* Check LMA compatibility */
                if (lma->lma_incompat & ~LMA_INCOMPAT_SUPP) {
-                       CWARN("%s: unsupported incompat LMA feature(s) %#x "
-                             "for fid = "DFID", ino = %lu\n",
+                       rc = -EOPNOTSUPP;
+                       CWARN("%s: unsupported incompat LMA feature(s) %#x for fid = "DFID", ino = %lu: rc = %d\n",
                              osd_ino2name(inode),
                              lma->lma_incompat & ~LMA_INCOMPAT_SUPP,
-                             PFID(&lma->lma_self_fid), inode->i_ino);
-                       rc = -EOPNOTSUPP;
+                             PFID(&lma->lma_self_fid), inode->i_ino, rc);
                }
        } else if (rc == 0) {
                rc = -ENODATA;
@@ -517,10 +516,11 @@ struct inode *osd_iget(struct osd_thread_info *info, struct osd_device *dev,
                iput(inode);
                inode = ERR_PTR(-ESTALE);
        } else if (is_bad_inode(inode)) {
-               CWARN("%s: bad inode: ino = %u\n",
-                     osd_dev2name(dev), id->oii_ino);
+               rc = -ENOENT;
+               CWARN("%s: bad inode: ino = %u: rc = %d\n",
+                     osd_dev2name(dev), id->oii_ino, rc);
                iput(inode);
-               inode = ERR_PTR(-ENOENT);
+               inode = ERR_PTR(rc);
        } else if ((rc = osd_attach_jinode(inode))) {
                iput(inode);
                inode = ERR_PTR(rc);
@@ -1091,9 +1091,9 @@ again:
 
 out:
        if (rc < 0)
-               CDEBUG(D_LFSCK, "%s: fail to check LMV EA, inode = %lu/%u,"
-                      DFID": rc = %d\n", osd_ino2name(inode),
-                      inode->i_ino, inode->i_generation,
+               CDEBUG(D_LFSCK,
+                      "%s: cannot check LMV, ino = %lu/%u "DFID": rc = %d\n",
+                      osd_ino2name(inode), inode->i_ino, inode->i_generation,
                       PFID(&oic->oic_fid), rc);
        else
                rc = 0;
@@ -2884,9 +2884,9 @@ static int osd_declare_attr_set(const struct lu_env *env,
                bool ignore_edquot = !(attr->la_flags & LUSTRE_SET_SYNC_FL);
 
                if (!ignore_edquot)
-                       CDEBUG(D_QUOTA, "%s: enforce quota on UID %u, GID %u"
-                              "(the quota space is %lld)\n",
-                              obj->oo_inode->i_sb->s_id, attr->la_uid,
+                       CDEBUG(D_QUOTA,
+                              "%s: enforce quota on UID %u, GID %u (quota space is %lld)\n",
+                              osd_ino2name(obj->oo_inode), attr->la_uid,
                               attr->la_gid, bspace);
 
                /* USERQUOTA */
@@ -3079,9 +3079,8 @@ static int osd_quota_transfer(struct inode *inode, const struct lu_attr *attr,
 
                rc = dquot_transfer(inode, &iattr);
                if (rc) {
-                       CERROR("%s: quota transfer failed: rc = %d. Is quota "
-                              "enforcement enabled on the ldiskfs "
-                              "filesystem?\n", inode->i_sb->s_id, rc);
+                       CERROR("%s: quota transfer failed. Is quota enforcement enabled on the ldiskfs filesystem? rc = %d\n",
+                              osd_ino2name(inode), rc);
                        return rc;
                }
        }
@@ -3095,9 +3094,8 @@ static int osd_quota_transfer(struct inode *inode, const struct lu_attr *attr,
                rc = -ENOTSUPP;
 #endif
                if (rc) {
-                       CERROR("%s: quota transfer failed: rc = %d. Is project "
-                              "enforcement enabled on the ldiskfs "
-                              "filesystem?\n", inode->i_sb->s_id, rc);
+                       CERROR("%s: quota transfer failed. Is project enforcement enabled on the ldiskfs filesystem? rc = %d\n",
+                              osd_ino2name(inode), rc);
                        return rc;
                }
        }
@@ -3977,9 +3975,8 @@ static struct inode *osd_create_local_agent_inode(const struct lu_env *env,
            i_projid_read(pobj->oo_inode) != 0) {
                rc = osd_transfer_project(local, 0, th);
                if (rc) {
-                       CERROR("%s: quota transfer failed: rc = %d. Is project "
-                              "quota enforcement enabled on the ldiskfs "
-                              "filesystem?\n", local->i_sb->s_id, rc);
+                       CERROR("%s: quota transfer failed:. Is project quota enforcement enabled on the ldiskfs filesystem? rc = %d\n",
+                              osd_ino2name(local), rc);
                        RETURN(ERR_PTR(rc));
                }
        }
@@ -5807,8 +5804,7 @@ trigger:
                rc = osd_scrub_start(oti->oti_env, dev, SS_AUTO_PARTIAL |
                                     SS_CLEAR_DRYRUN | SS_CLEAR_FAILOUT);
                CDEBUG(D_LFSCK | D_CONSOLE | D_WARNING,
-                      "%s: trigger partial OI scrub for RPC inconsistency "
-                      "checking FID "DFID": rc = %d\n",
+                      "%s: trigger partial OI scrub for RPC inconsistency checking FID "DFID": rc = %d\n",
                       osd_dev2name(dev), PFID(fid), rc);
                if (rc == 0 || rc == -EALREADY)
                        goto again;
@@ -6941,11 +6937,10 @@ osd_dirent_reinsert(const struct lu_env *env, struct osd_device *dev,
         * That means we lose it!
         */
        if (rc != 0)
-               CDEBUG(D_LFSCK, "%s: fail to reinsert the dirent, "
-                      "dir = %lu/%u, name = %.*s, "DFID": rc = %d\n",
-                      osd_ino2name(inode),
-                      dir->i_ino, dir->i_generation, namelen,
-                      dentry->d_name.name, PFID(fid), rc);
+               CDEBUG(D_LFSCK,
+                      "%s: fail to reinsert the dirent, dir = %lu/%u, name = %.*s, "DFID": rc = %d\n",
+                      osd_ino2name(inode), dir->i_ino, dir->i_generation,
+                      namelen, dentry->d_name.name, PFID(fid), rc);
 
        RETURN(rc);
 }
index 56881d6..96d8b47 100644 (file)
@@ -166,7 +166,7 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk)
 
        bh = __ldiskfs_bread(NULL, inode, blk, 0);
        if (IS_ERR_OR_NULL(bh)) {
-               CERROR("%s: cannot load idle blocks, blk = %u, err = %ld\n",
+               CERROR("%s: cannot load idle blocks, blk = %u: rc = %ld\n",
                       osd_ino2name(inode), blk, bh ? PTR_ERR(bh) : -EIO);
                c->ic_idle_failed = 1;
                if (bh == NULL)
@@ -176,11 +176,14 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk)
 
        head = (struct iam_idle_head *)(bh->b_data);
        if (le16_to_cpu(head->iih_magic) != IAM_IDLE_HEADER_MAGIC) {
-               CERROR("%s: invalid idle block head, blk = %u, magic = %d\n",
-                      osd_ino2name(inode), blk, le16_to_cpu(head->iih_magic));
+               int rc = -EBADF;
+
+               CERROR("%s: invalid idle block head, blk = %u, magic = %x: rc = %d\n",
+                      osd_ino2name(inode), blk, le16_to_cpu(head->iih_magic),
+                      rc);
                brelse(bh);
                c->ic_idle_failed = 1;
-               return ERR_PTR(-EBADF);
+               return ERR_PTR(rc);
        }
 
        return bh;
index 7351b0a..f374321 100644 (file)
@@ -1031,14 +1031,22 @@ static inline struct super_block *osd_sb(const struct osd_device *dev)
        return dev->od_mnt->mnt_sb;
 }
 
+static inline const char *osd_sb2name(const struct super_block *sb)
+{
+       /* this is LDISKFS_SB(sb), but preserves "const" */
+       const struct ldiskfs_sb_info *sbi = sb->s_fs_info;
+
+       return sbi->s_es->s_volume_name;
+}
+
 static inline const char *osd_dev2name(const struct osd_device *dev)
 {
-       return osd_sb(dev)->s_id;
+       return osd_sb2name(osd_sb(dev));
 }
 
 static inline const char *osd_ino2name(const struct inode *inode)
 {
-       return inode->i_sb->s_id;
+       return osd_sb2name(inode->i_sb);
 }
 
 /**
index 15392bb..dac36d2 100644 (file)
@@ -1918,7 +1918,7 @@ static int osd_ldiskfs_write_record(struct dt_object *dt, void *buf,
                if (unlikely(IS_ERR_OR_NULL(bh) && !sync))
                        CWARN(
                              "%s: adding bh without locking off %llu (block %lu, size %d, offs %llu)\n",
-                             inode->i_sb->s_id,
+                             osd_ino2name(inode),
                              offset, block, bufsize, *offs);
 
                if (IS_ERR_OR_NULL(bh)) {
@@ -1952,8 +1952,8 @@ static int osd_ldiskfs_write_record(struct dt_object *dt, void *buf,
 
                        CERROR(
                               "%s: error reading offset %llu (block %lu, size %d, offs %llu), credits %d/%d: rc = %d\n",
-                              inode->i_sb->s_id, offset, block, bufsize, *offs,
-                              credits, handle->h_buffer_credits, err);
+                              osd_ino2name(inode), offset, block, bufsize,
+                              *offs, credits, handle->h_buffer_credits, err);
                        break;
                }
 
index 8cc3d38..60da375 100644 (file)
@@ -607,7 +607,7 @@ again:
                /* We should NOT find the same object more than once. */
                CERROR("%s: scan the same object multiple times at the pos: "
                       "group = %u, base = %u, offset = %u, start = %u\n",
-                      param->sb->s_id, (__u32)param->bg, param->gbase,
+                      osd_sb2name(param->sb), (__u32)param->bg, param->gbase,
                       offset, param->start);
                goto again;
        }