]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Merge tag 'xfs-6.1-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 11 Oct 2022 03:32:10 +0000 (20:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 11 Oct 2022 03:32:10 +0000 (20:32 -0700)
Pull xfs updates from Dave Chinner:
 "There are relatively few updates this cycle; half the cycle was eaten
  by a grue, the other half was eaten by a tricky data corruption issue
  that I still haven't entirely solved.

  Hence there's no major changes in this cycle and it's largely just
  minor cleanups and small bug fixes:

   - fixes for filesystem shutdown procedure during a DAX memory failure
     notification

   - bug fixes

   - logic cleanups

   - log message cleanups

   - updates to use vfs{g,u}id_t helpers where appropriate"

* tag 'xfs-6.1-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: on memory failure, only shut down fs after scanning all mappings
  xfs: rearrange the logic and remove the broken comment for xfs_dir2_isxx
  xfs: trim the mapp array accordingly in xfs_da_grow_inode_int
  xfs: do not need to check return value of xlog_kvmalloc()
  xfs: port to vfs{g,u}id_t and associated helpers
  xfs: remove xfs_setattr_time() declaration
  xfs: Remove the unneeded result variable
  xfs: missing space in xfs trace log
  xfs: simplify if-else condition in xfs_reflink_trim_around_shared
  xfs: simplify if-else condition in xfs_validate_new_dalign
  xfs: replace unnecessary seq_printf with seq_puts
  xfs: clean up "%Ld/%Lu" which doesn't meet C standard
  xfs: remove redundant else for clean code
  xfs: remove the redundant word in comment

21 files changed:
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_da_btree.c
fs/xfs/libxfs/xfs_dir2.c
fs/xfs/libxfs/xfs_dir2.h
fs/xfs/libxfs/xfs_dir2_sf.c
fs/xfs/libxfs/xfs_inode_fork.c
fs/xfs/scrub/dir.c
fs/xfs/xfs_attr_item.c
fs/xfs/xfs_dir2_readdir.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_inode_item_recover.c
fs/xfs/xfs_iops.c
fs/xfs/xfs_iops.h
fs/xfs/xfs_itable.c
fs/xfs/xfs_log.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_notify_failure.c
fs/xfs/xfs_reflink.c
fs/xfs/xfs_stats.c
fs/xfs/xfs_trace.h

index e56723dc9cd5b940623aad0b05dc1facdc676903..49d0d4ea63fcdb11f9b1267f2c30e0585e765e70 100644 (file)
@@ -294,7 +294,7 @@ xfs_check_block(
                        else
                                thispa = XFS_BMBT_PTR_ADDR(mp, block, j, dmxr);
                        if (*thispa == *pp) {
-                               xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld",
+                               xfs_warn(mp, "%s: thispa(%d) == pp(%d) %lld",
                                        __func__, j, i,
                                        (unsigned long long)be64_to_cpu(*thispa));
                                xfs_err(mp, "%s: ptrs are equal in node\n",
index e7201dc68f4309a422ce611fb53db2d69cd95caf..e576560b46e9789bcd7496de926b840cc46a564b 100644 (file)
@@ -2192,8 +2192,8 @@ xfs_da_grow_inode_int(
                 */
                mapp = kmem_alloc(sizeof(*mapp) * count, 0);
                for (b = *bno, mapi = 0; b < *bno + count; ) {
-                       nmap = min(XFS_BMAP_MAX_NMAP, count);
                        c = (int)(*bno + count - b);
+                       nmap = min(XFS_BMAP_MAX_NMAP, c);
                        error = xfs_bmapi_write(tp, dp, b, c,
                                        xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
                                        args->total, &mapp[mapi], &nmap);
index 76eedc2756b318cc1967b7699586ad40ec648507..92bac3373f1f5cf55cbdd967db0d3534758518e8 100644 (file)
@@ -261,7 +261,7 @@ xfs_dir_createname(
 {
        struct xfs_da_args      *args;
        int                     rval;
-       int                     v;              /* type-checking value */
+       bool                    v;
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
 
@@ -357,7 +357,7 @@ xfs_dir_lookup(
 {
        struct xfs_da_args      *args;
        int                     rval;
-       int                     v;        /* type-checking value */
+       bool                    v;
        int                     lock_mode;
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
@@ -435,7 +435,7 @@ xfs_dir_removename(
 {
        struct xfs_da_args      *args;
        int                     rval;
-       int                     v;              /* type-checking value */
+       bool                    v;
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
        XFS_STATS_INC(dp->i_mount, xs_dir_remove);
@@ -493,7 +493,7 @@ xfs_dir_replace(
 {
        struct xfs_da_args      *args;
        int                     rval;
-       int                     v;              /* type-checking value */
+       bool                    v;
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
 
@@ -610,19 +610,23 @@ xfs_dir2_grow_inode(
 int
 xfs_dir2_isblock(
        struct xfs_da_args      *args,
-       int                     *vp)    /* out: 1 is block, 0 is not block */
+       bool                    *isblock)
 {
-       xfs_fileoff_t           last;   /* last file offset */
-       int                     rval;
+       struct xfs_mount        *mp = args->dp->i_mount;
+       xfs_fileoff_t           eof;
+       int                     error;
 
-       if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
-               return rval;
-       rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
-       if (XFS_IS_CORRUPT(args->dp->i_mount,
-                          rval != 0 &&
-                          args->dp->i_disk_size != args->geo->blksize))
+       error = xfs_bmap_last_offset(args->dp, &eof, XFS_DATA_FORK);
+       if (error)
+               return error;
+
+       *isblock = false;
+       if (XFS_FSB_TO_B(mp, eof) != args->geo->blksize)
+               return 0;
+
+       *isblock = true;
+       if (XFS_IS_CORRUPT(mp, args->dp->i_disk_size != args->geo->blksize))
                return -EFSCORRUPTED;
-       *vp = rval;
        return 0;
 }
 
@@ -632,14 +636,20 @@ xfs_dir2_isblock(
 int
 xfs_dir2_isleaf(
        struct xfs_da_args      *args,
-       int                     *vp)    /* out: 1 is block, 0 is not block */
+       bool                    *isleaf)
 {
-       xfs_fileoff_t           last;   /* last file offset */
-       int                     rval;
+       xfs_fileoff_t           eof;
+       int                     error;
 
-       if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
-               return rval;
-       *vp = last == args->geo->leafblk + args->geo->fsbcount;
+       error = xfs_bmap_last_offset(args->dp, &eof, XFS_DATA_FORK);
+       if (error)
+               return error;
+
+       *isleaf = false;
+       if (eof != args->geo->leafblk + args->geo->fsbcount)
+               return 0;
+
+       *isleaf = true;
        return 0;
 }
 
index b6df3c34b26afb8a703aece814770a283619915b..dd39f17dd9a9cac81fea1f0c76b9545f547f53b7 100644 (file)
@@ -61,8 +61,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
 /*
  * Interface routines used by userspace utilities
  */
-extern int xfs_dir2_isblock(struct xfs_da_args *args, int *r);
-extern int xfs_dir2_isleaf(struct xfs_da_args *args, int *r);
+extern int xfs_dir2_isblock(struct xfs_da_args *args, bool *isblock);
+extern int xfs_dir2_isleaf(struct xfs_da_args *args, bool *isleaf);
 extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
                                struct xfs_buf *bp);
 
index 003812fd7d3559d13d3fbcbec8be733408ec8ca0..8cd37e6e9d387959133e33c379be16469f512549 100644 (file)
@@ -865,7 +865,6 @@ xfs_dir2_sf_lookup(
        struct xfs_inode        *dp = args->dp;
        struct xfs_mount        *mp = dp->i_mount;
        int                     i;              /* entry index */
-       int                     error;
        xfs_dir2_sf_entry_t     *sfep;          /* shortform directory entry */
        xfs_dir2_sf_hdr_t       *sfp;           /* shortform structure */
        enum xfs_dacmp          cmp;            /* comparison result */
@@ -929,8 +928,7 @@ xfs_dir2_sf_lookup(
        if (!ci_sfep)
                return -ENOENT;
        /* otherwise process the CI match as required by the caller */
-       error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
-       return error;
+       return xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
 }
 
 /*
index 9327a4f392065605dc76f8e54131c4dc6b84a681..6b21760184d9ed33620bec3a72e78f49b161fd24 100644 (file)
@@ -78,7 +78,7 @@ xfs_iformat_local(
         */
        if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
                xfs_warn(ip->i_mount,
-       "corrupt inode %Lu (bad size %d for local fork, size = %zd).",
+       "corrupt inode %llu (bad size %d for local fork, size = %zd).",
                        (unsigned long long) ip->i_ino, size,
                        XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
                xfs_inode_verifier_error(ip, -EFSCORRUPTED,
@@ -192,7 +192,7 @@ xfs_iformat_btree(
                                        XFS_DFORK_SIZE(dip, mp, whichfork) ||
                     ifp->if_nextents > ip->i_nblocks) ||
                     level == 0 || level > XFS_BM_MAXLEVELS(mp, whichfork)) {
-               xfs_warn(mp, "corrupt inode %Lu (btree).",
+               xfs_warn(mp, "corrupt inode %llu (btree).",
                                        (unsigned long long) ip->i_ino);
                xfs_inode_verifier_error(ip, -EFSCORRUPTED,
                                "xfs_iformat_btree", dfp, size,
index b594f02a52c479c198aab5d7414a3a36329c5512..5c87800ab223df02bb959ca021281f44d5e04e1b 100644 (file)
@@ -676,7 +676,7 @@ xchk_directory_blocks(
        xfs_dablk_t             dabno;
        xfs_dir2_db_t           last_data_db = 0;
        bool                    found;
-       int                     is_block = 0;
+       bool                    is_block = false;
        int                     error;
 
        /* Ignore local format directories. */
index 5077a7ad56460f78cffb578f3bddc381e2da8cd3..cf5ce607dc051fe15bfb211cff03d0345a73ef04 100644 (file)
@@ -86,8 +86,6 @@ xfs_attri_log_nameval_alloc(
         */
        nv = xlog_kvmalloc(sizeof(struct xfs_attri_log_nameval) +
                                        name_len + value_len);
-       if (!nv)
-               return nv;
 
        nv->name.i_addr = nv + 1;
        nv->name.i_len = name_len;
@@ -441,8 +439,6 @@ xfs_attr_create_intent(
                attr->xattri_nameval = xfs_attri_log_nameval_alloc(args->name,
                                args->namelen, args->value, args->valuelen);
        }
-       if (!attr->xattri_nameval)
-               return ERR_PTR(-ENOMEM);
 
        attrip = xfs_attri_init(mp, attr->xattri_nameval);
        xfs_trans_add_item(tp, &attrip->attri_item);
@@ -762,8 +758,6 @@ xlog_recover_attri_commit_pass2(
        nv = xfs_attri_log_nameval_alloc(attr_name,
                        attri_formatp->alfi_name_len, attr_value,
                        attri_formatp->alfi_value_len);
-       if (!nv)
-               return -ENOMEM;
 
        attrip = xfs_attri_init(mp, nv);
        error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format);
index e295fc8062d81e2c5cc5f395fe211c79c7b76d7d..9f3ceb46151566834d63840162b51f4caf6cc8dd 100644 (file)
@@ -512,7 +512,7 @@ xfs_readdir(
 {
        struct xfs_da_args      args = { NULL };
        unsigned int            lock_mode;
-       int                     isblock;
+       bool                    isblock;
        int                     error;
 
        trace_xfs_readdir(dp);
index 28493c8e9bb231accb53884e1fd126c9d366c407..c000b74dd203582517081fe253d770b8205493fb 100644 (file)
@@ -835,9 +835,8 @@ xfs_init_new_inode(
         * ID or one of the supplementary group IDs, the S_ISGID bit is cleared
         * (and only if the irix_sgid_inherit compatibility variable is set).
         */
-       if (irix_sgid_inherit &&
-           (inode->i_mode & S_ISGID) &&
-           !in_group_p(i_gid_into_mnt(mnt_userns, inode)))
+       if (irix_sgid_inherit && (inode->i_mode & S_ISGID) &&
+           !vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
                inode->i_mode &= ~S_ISGID;
 
        ip->i_disk_size = 0;
@@ -3119,7 +3118,7 @@ xfs_iflush(
        if (XFS_TEST_ERROR(dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC),
                               mp, XFS_ERRTAG_IFLUSH_1)) {
                xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
-                       "%s: Bad inode %Lu magic number 0x%x, ptr "PTR_FMT,
+                       "%s: Bad inode %llu magic number 0x%x, ptr "PTR_FMT,
                        __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
                goto flush_out;
        }
@@ -3129,7 +3128,7 @@ xfs_iflush(
                    ip->i_df.if_format != XFS_DINODE_FMT_BTREE,
                    mp, XFS_ERRTAG_IFLUSH_3)) {
                        xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
-                               "%s: Bad regular inode %Lu, ptr "PTR_FMT,
+                               "%s: Bad regular inode %llu, ptr "PTR_FMT,
                                __func__, ip->i_ino, ip);
                        goto flush_out;
                }
@@ -3140,7 +3139,7 @@ xfs_iflush(
                    ip->i_df.if_format != XFS_DINODE_FMT_LOCAL,
                    mp, XFS_ERRTAG_IFLUSH_4)) {
                        xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
-                               "%s: Bad directory inode %Lu, ptr "PTR_FMT,
+                               "%s: Bad directory inode %llu, ptr "PTR_FMT,
                                __func__, ip->i_ino, ip);
                        goto flush_out;
                }
@@ -3158,7 +3157,7 @@ xfs_iflush(
        if (XFS_TEST_ERROR(ip->i_forkoff > mp->m_sb.sb_inodesize,
                                mp, XFS_ERRTAG_IFLUSH_6)) {
                xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
-                       "%s: bad inode %Lu, forkoff 0x%x, ptr "PTR_FMT,
+                       "%s: bad inode %llu, forkoff 0x%x, ptr "PTR_FMT,
                        __func__, ip->i_ino, ip->i_forkoff, ip);
                goto flush_out;
        }
index 6e19ece916bfb5c49713712b5beef37d824a377a..ca2941ab6cbcdd714787dd88040f407a578ab5b3 100644 (file)
@@ -550,7 +550,7 @@ xfs_inode_item_push(
 
        if (!bp || (ip->i_flags & XFS_ISTALE)) {
                /*
-                * Inode item/buffer is being being aborted due to cluster
+                * Inode item/buffer is being aborted due to cluster
                 * buffer deletion. Trigger a log force to have that operation
                 * completed and items removed from the AIL before the next push
                 * attempt.
index d28ffaebd067000efbe0150b47cb217a23ee990d..0e5dba2343ea13e2e0451178097f6ad247371724 100644 (file)
@@ -321,7 +321,7 @@ xlog_recover_inode_commit_pass2(
         */
        if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic))) {
                xfs_alert(mp,
-       "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld",
+       "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %lld",
                        __func__, dip, bp, in_f->ilf_ino);
                error = -EFSCORRUPTED;
                goto out_release;
@@ -329,7 +329,7 @@ xlog_recover_inode_commit_pass2(
        ldip = item->ri_buf[1].i_addr;
        if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) {
                xfs_alert(mp,
-                       "%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld",
+                       "%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld",
                        __func__, item, in_f->ilf_ino);
                error = -EFSCORRUPTED;
                goto out_release;
index 6f51b5d4999843a2bd4ab34cc81f87c06bcd637b..2e10e1c66ad60a6ba0340ffda78b8baab67d6c2a 100644 (file)
@@ -558,6 +558,8 @@ xfs_vn_getattr(
        struct inode            *inode = d_inode(path->dentry);
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
+       vfsuid_t                vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
+       vfsgid_t                vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
 
        trace_xfs_getattr(ip);
 
@@ -568,8 +570,8 @@ xfs_vn_getattr(
        stat->dev = inode->i_sb->s_dev;
        stat->mode = inode->i_mode;
        stat->nlink = inode->i_nlink;
-       stat->uid = i_uid_into_mnt(mnt_userns, inode);
-       stat->gid = i_gid_into_mnt(mnt_userns, inode);
+       stat->uid = vfsuid_into_kuid(vfsuid);
+       stat->gid = vfsgid_into_kgid(vfsgid);
        stat->ino = ip->i_ino;
        stat->atime = inode->i_atime;
        stat->mtime = inode->i_mtime;
index cb5fc68c9ea00e75a890ae37dafb03ab217a8afc..e570dcb5df8d52efcc42607173cba782e8a36d4b 100644 (file)
@@ -13,7 +13,6 @@ extern const struct file_operations xfs_dir_file_operations;
 
 extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);
 
-extern void xfs_setattr_time(struct xfs_inode *ip, struct iattr *iattr);
 int xfs_vn_setattr_size(struct user_namespace *mnt_userns,
                struct dentry *dentry, struct iattr *vap);
 
index 36312b00b1642e2627f726b70a30d53847b9264d..a1c2bcf65d376fc485294ae296dd56ba31da03f3 100644 (file)
@@ -66,6 +66,8 @@ xfs_bulkstat_one_int(
        struct xfs_bulkstat     *buf = bc->buf;
        xfs_extnum_t            nextents;
        int                     error = -EINVAL;
+       vfsuid_t                vfsuid;
+       vfsgid_t                vfsgid;
 
        if (xfs_internal_inum(mp, ino))
                goto out_advance;
@@ -81,14 +83,16 @@ xfs_bulkstat_one_int(
        ASSERT(ip != NULL);
        ASSERT(ip->i_imap.im_blkno != 0);
        inode = VFS_I(ip);
+       vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
+       vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
 
        /* xfs_iget returns the following without needing
         * further change.
         */
        buf->bs_projectid = ip->i_projid;
        buf->bs_ino = ino;
-       buf->bs_uid = from_kuid(sb_userns, i_uid_into_mnt(mnt_userns, inode));
-       buf->bs_gid = from_kgid(sb_userns, i_gid_into_mnt(mnt_userns, inode));
+       buf->bs_uid = from_kuid(sb_userns, vfsuid_into_kuid(vfsuid));
+       buf->bs_gid = from_kgid(sb_userns, vfsgid_into_kgid(vfsgid));
        buf->bs_size = ip->i_disk_size;
 
        buf->bs_nlink = inode->i_nlink;
index 386b0307aed8576a1a833f50aaf7df8b96b57c7d..f6e7e4fd72ae71da2fbe548cce0bad11b6f197b9 100644 (file)
@@ -226,12 +226,12 @@ xlog_ticket_reservation(
        if (head == &log->l_write_head) {
                ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV);
                return tic->t_unit_res;
-       } else {
-               if (tic->t_flags & XLOG_TIC_PERM_RESERV)
-                       return tic->t_unit_res * tic->t_cnt;
-               else
-                       return tic->t_unit_res;
        }
+
+       if (tic->t_flags & XLOG_TIC_PERM_RESERV)
+               return tic->t_unit_res * tic->t_cnt;
+
+       return tic->t_unit_res;
 }
 
 STATIC bool
index f10c88cee116e17619a9ca03f08f87c998180ddd..e8bb3c2e847e1ad14769ccf2f285df0cb56929db 100644 (file)
@@ -300,26 +300,28 @@ xfs_validate_new_dalign(
        "alignment check failed: sunit/swidth vs. blocksize(%d)",
                        mp->m_sb.sb_blocksize);
                return -EINVAL;
-       } else {
-               /*
-                * Convert the stripe unit and width to FSBs.
-                */
-               mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
-               if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) {
-                       xfs_warn(mp,
-               "alignment check failed: sunit/swidth vs. agsize(%d)",
-                                mp->m_sb.sb_agblocks);
-                       return -EINVAL;
-               } else if (mp->m_dalign) {
-                       mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
-               } else {
-                       xfs_warn(mp,
-               "alignment check failed: sunit(%d) less than bsize(%d)",
-                                mp->m_dalign, mp->m_sb.sb_blocksize);
-                       return -EINVAL;
-               }
        }
 
+       /*
+        * Convert the stripe unit and width to FSBs.
+        */
+       mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
+       if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) {
+               xfs_warn(mp,
+       "alignment check failed: sunit/swidth vs. agsize(%d)",
+                       mp->m_sb.sb_agblocks);
+               return -EINVAL;
+       }
+
+       if (!mp->m_dalign) {
+               xfs_warn(mp,
+       "alignment check failed: sunit(%d) less than bsize(%d)",
+                       mp->m_dalign, mp->m_sb.sb_blocksize);
+               return -EINVAL;
+       }
+
+       mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
+
        if (!xfs_has_dalign(mp)) {
                xfs_warn(mp,
 "cannot change alignment: superblock does not support data alignment");
index 5b1f9a24ed5917a747daf2d42df87adc8cca12b6..c4078d0ec108f1e64ad476a8b2a5e720c785fcfe 100644 (file)
 #include <linux/mm.h>
 #include <linux/dax.h>
 
-struct failure_info {
+struct xfs_failure_info {
        xfs_agblock_t           startblock;
        xfs_extlen_t            blockcount;
        int                     mf_flags;
+       bool                    want_shutdown;
 };
 
 static pgoff_t
 xfs_failure_pgoff(
        struct xfs_mount                *mp,
        const struct xfs_rmap_irec      *rec,
-       const struct failure_info       *notify)
+       const struct xfs_failure_info   *notify)
 {
        loff_t                          pos = XFS_FSB_TO_B(mp, rec->rm_offset);
 
@@ -47,7 +48,7 @@ static unsigned long
 xfs_failure_pgcnt(
        struct xfs_mount                *mp,
        const struct xfs_rmap_irec      *rec,
-       const struct failure_info       *notify)
+       const struct xfs_failure_info   *notify)
 {
        xfs_agblock_t                   end_rec;
        xfs_agblock_t                   end_notify;
@@ -71,13 +72,13 @@ xfs_dax_failure_fn(
 {
        struct xfs_mount                *mp = cur->bc_mp;
        struct xfs_inode                *ip;
-       struct failure_info             *notify = data;
+       struct xfs_failure_info         *notify = data;
        int                             error = 0;
 
        if (XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) ||
            (rec->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK))) {
-               xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
-               return -EFSCORRUPTED;
+               notify->want_shutdown = true;
+               return 0;
        }
 
        /* Get files that incore, filter out others that are not in use. */
@@ -86,8 +87,10 @@ xfs_dax_failure_fn(
        /* Continue the rmap query if the inode isn't incore */
        if (error == -ENODATA)
                return 0;
-       if (error)
-               return error;
+       if (error) {
+               notify->want_shutdown = true;
+               return 0;
+       }
 
        error = mf_dax_kill_procs(VFS_I(ip)->i_mapping,
                                  xfs_failure_pgoff(mp, rec, notify),
@@ -104,6 +107,7 @@ xfs_dax_notify_ddev_failure(
        xfs_daddr_t             bblen,
        int                     mf_flags)
 {
+       struct xfs_failure_info notify = { .mf_flags = mf_flags };
        struct xfs_trans        *tp = NULL;
        struct xfs_btree_cur    *cur = NULL;
        struct xfs_buf          *agf_bp = NULL;
@@ -120,7 +124,6 @@ xfs_dax_notify_ddev_failure(
        for (; agno <= end_agno; agno++) {
                struct xfs_rmap_irec    ri_low = { };
                struct xfs_rmap_irec    ri_high;
-               struct failure_info     notify;
                struct xfs_agf          *agf;
                xfs_agblock_t           agend;
                struct xfs_perag        *pag;
@@ -161,6 +164,11 @@ xfs_dax_notify_ddev_failure(
        }
 
        xfs_trans_cancel(tp);
+       if (error || notify.want_shutdown) {
+               xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
+               if (!error)
+                       error = -EFSCORRUPTED;
+       }
        return error;
 }
 
index 251f20ddd3683c61e6562b6b4dccfb054b576ab0..93bdd25680bc9a4869f5b8bb2372a37dc5898ace 100644 (file)
@@ -200,7 +200,9 @@ xfs_reflink_trim_around_shared(
        if (fbno == NULLAGBLOCK) {
                /* No shared blocks at all. */
                return 0;
-       } else if (fbno == agbno) {
+       }
+
+       if (fbno == agbno) {
                /*
                 * The start of this extent is shared.  Truncate the
                 * mapping at the end of the shared region so that a
@@ -210,16 +212,16 @@ xfs_reflink_trim_around_shared(
                irec->br_blockcount = flen;
                *shared = true;
                return 0;
-       } else {
-               /*
-                * There's a shared extent midway through this extent.
-                * Truncate the mapping at the start of the shared
-                * extent so that a subsequent iteration starts at the
-                * start of the shared region.
-                */
-               irec->br_blockcount = fbno - agbno;
-               return 0;
        }
+
+       /*
+        * There's a shared extent midway through this extent.
+        * Truncate the mapping at the start of the shared
+        * extent so that a subsequent iteration starts at the
+        * start of the shared region.
+        */
+       irec->br_blockcount = fbno - agbno;
+       return 0;
 }
 
 int
index 20e0534a772c92018b2c3a03bf38323dff89a172..90a77cd3ebade814ee72f6b061b5a0a9ac132330 100644 (file)
@@ -74,7 +74,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
                defer_relog += per_cpu_ptr(stats, i)->s.defer_relog;
        }
 
-       len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n",
+       len += scnprintf(buf + len, PATH_MAX-len, "xpc %llu %llu %llu\n",
                        xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
        len += scnprintf(buf + len, PATH_MAX-len, "defer_relog %llu\n",
                        defer_relog);
@@ -125,7 +125,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 {
        int j;
 
-       seq_printf(m, "qm");
+       seq_puts(m, "qm");
        for (j = XFSSTAT_START_XQMSTAT; j < XFSSTAT_END_XQMSTAT; j++)
                seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
        seq_putc(m, '\n');
index f9057af6e0c80d70aa9899c58eb962647e19f7aa..cb7c81ba7fa38bcd4d89dedfc215aa78ba4fd091 100644 (file)
@@ -1170,7 +1170,7 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class,
                __entry->ino_res_used = qtrx->qt_ino_res_used;
                __entry->icount_delta = qtrx->qt_icount_delta;
        ),
-       TP_printk("dev %d:%d dquot id 0x%x type %s flags %s"
+       TP_printk("dev %d:%d dquot id 0x%x type %s flags %s "
                  "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
                  "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
                  "ino_res %llu ino_res_used %llu icount_delta %lld",
@@ -1602,7 +1602,7 @@ TRACE_EVENT(xfs_bunmap,
                __entry->caller_ip = caller_ip;
                __entry->flags = flags;
        ),
-       TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx"
+       TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx "
                  "flags %s caller %pS",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,