From patchwork Mon Jun 6 16:05:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2850CCA473 for ; Mon, 6 Jun 2022 16:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241508AbiFFQFw (ORCPT ); Mon, 6 Jun 2022 12:05:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241491AbiFFQFv (ORCPT ); Mon, 6 Jun 2022 12:05:51 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FFE188E63; Mon, 6 Jun 2022 09:05:49 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id l2-20020a05600c4f0200b0039c55c50482so240054wmq.0; Mon, 06 Jun 2022 09:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cI/QuW66ym5PzfqEi96jpvK+GY/6pjcHFsCHEDRkUFQ=; b=O17/BPbigX34v+0ysF3t2fD/1uv7eMjOkl7mFqyB6KoA0qYrXJX6S1rUDpvgKQTzNX LhThFTXxClujAH09HqzxxlAZnodZiz6sUm5ISSHA68ARTh7+5yinp0zRyK9cq5sgcTZb /LulxFBEPPIn4RoxajBE8k9qiMEByj5bpvBxRi/hGQXtuYqLAkDHepr2NZdMxscUijsR OgQ4S49szvJNYNs8I4Tkmeeh657F2rRsNr6BZ+2Ht/hfVwg/cDB9417iq15saEzaE2YG X1rtxKhtCHhcReJxEAc7GvOZAVIbBSwaSPHvM+VSW0eWSDwVfC2wUAO6Q/mLDF70ehnY xQsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cI/QuW66ym5PzfqEi96jpvK+GY/6pjcHFsCHEDRkUFQ=; b=Z8rlpVcdIrOEcXqQZbCvgojkkopMo+55umWiWlXzA5uHNcqHgIV0LqXh5Mh871BoJb MRl6JkD7F8ONGirFv6Ag1FYRszoh7Fl3jbHjsuLhMXXHyuwoHYFtNbG7fa53gWXxQI48 UnAzId41pTXA7z8A6xYYjV542sA2Kx2FVGzpelRl+0GUlbe4hs/KiXlt+3x93W27ek09 XQOvVhxD/4sdLGD+KsClZGb/KrZ8tje7Ggg7mu3Yx1O0+T5NB9PV+SUEsOzQFXeuABik adzBWSrif3EZfQnVknL5kQ0LWqopTQ3Grcl8ukiVpe0Y0FZvF+yAsOSX23f+K5NHBCqS bS/Q== X-Gm-Message-State: AOAM532jGEM3LNm3qnhqI1xicDSjdFhHvfpmBORe4J+v7bdsGjRulY3v 4u7o8o0Zztk/isRThD8D+GeFYj4eopGlsQ== X-Google-Smtp-Source: ABdhPJx/1XKO/iwTbcSOiabdMcchwCbB0VFn3XFrHKjAYDIEww0Sxv712WI/g5/2aLomNC+sWBnRwQ== X-Received: by 2002:a1c:4d0d:0:b0:397:30f6:b62b with SMTP id o13-20020a1c4d0d000000b0039730f6b62bmr52571028wmh.155.1654531548260; Mon, 06 Jun 2022 09:05:48 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:47 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Dave Chinner Subject: [PATCH 5.10 CANDIDATE 1/7] xfs: use current->journal_info for detecting transaction recursion Date: Mon, 6 Jun 2022 19:05:31 +0300 Message-Id: <20220606160537.689915-2-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner commit 756b1c343333a5aefcc26b0409f3fd16f72281bf upstream. Because the iomap code using PF_MEMALLOC_NOFS to detect transaction recursion in XFS is just wrong. Remove it from the iomap code and replace it with XFS specific internal checks using current->journal_info instead. [djwong: This change also realigns the lifetime of NOFS flag changes to match the incore transaction, instead of the inconsistent scheme we have now.] Fixes: 9070733b4efa ("xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS") Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Amir Goldstein --- fs/iomap/buffered-io.c | 7 ------- fs/xfs/libxfs/xfs_btree.c | 12 ++++++++++-- fs/xfs/xfs_aops.c | 17 +++++++++++++++-- fs/xfs/xfs_trans.c | 20 +++++--------------- fs/xfs/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 26 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index cd9f7baa5bb7..47279fe00b1a 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1459,13 +1459,6 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data) PF_MEMALLOC)) goto redirty; - /* - * Given that we do not allow direct reclaim to call us, we should - * never be called in a recursive filesystem reclaim context. - */ - if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) - goto redirty; - /* * Is this page beyond the end of the file? * diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c index 98c82f4935e1..24c7d30e41df 100644 --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c @@ -2811,7 +2811,7 @@ xfs_btree_split_worker( struct xfs_btree_split_args *args = container_of(work, struct xfs_btree_split_args, work); unsigned long pflags; - unsigned long new_pflags = PF_MEMALLOC_NOFS; + unsigned long new_pflags = 0; /* * we are in a transaction context here, but may also be doing work @@ -2823,12 +2823,20 @@ xfs_btree_split_worker( new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; current_set_flags_nested(&pflags, new_pflags); + xfs_trans_set_context(args->cur->bc_tp); args->result = __xfs_btree_split(args->cur, args->level, args->ptrp, args->key, args->curp, args->stat); - complete(args->done); + xfs_trans_clear_context(args->cur->bc_tp); current_restore_flags_nested(&pflags, new_pflags); + + /* + * Do not access args after complete() has run here. We don't own args + * and the owner may run and free args before we return here. + */ + complete(args->done); + } /* diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 4304c6416fbb..b4186d666157 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -62,7 +62,7 @@ xfs_setfilesize_trans_alloc( * We hand off the transaction to the completion thread now, so * clear the flag here. */ - current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); + xfs_trans_clear_context(tp); return 0; } @@ -125,7 +125,7 @@ xfs_setfilesize_ioend( * thus we need to mark ourselves as being in a transaction manually. * Similarly for freeze protection. */ - current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); + xfs_trans_set_context(tp); __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS); /* we abort the update if there was an IO error */ @@ -568,6 +568,12 @@ xfs_vm_writepage( { struct xfs_writepage_ctx wpc = { }; + if (WARN_ON_ONCE(current->journal_info)) { + redirty_page_for_writepage(wbc, page); + unlock_page(page); + return 0; + } + return iomap_writepage(page, wbc, &wpc.ctx, &xfs_writeback_ops); } @@ -578,6 +584,13 @@ xfs_vm_writepages( { struct xfs_writepage_ctx wpc = { }; + /* + * Writing back data in a transaction context can result in recursive + * transactions. This is bad, so issue a warning and get out of here. + */ + if (WARN_ON_ONCE(current->journal_info)) + return 0; + xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); return iomap_writepages(mapping, wbc, &wpc.ctx, &xfs_writeback_ops); } diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index c94e71f741b6..2d7deacea2cf 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -68,6 +68,7 @@ xfs_trans_free( xfs_extent_busy_clear(tp->t_mountp, &tp->t_busy, false); trace_xfs_trans_free(tp, _RET_IP_); + xfs_trans_clear_context(tp); if (!(tp->t_flags & XFS_TRANS_NO_WRITECOUNT)) sb_end_intwrite(tp->t_mountp->m_super); xfs_trans_free_dqinfo(tp); @@ -119,7 +120,8 @@ xfs_trans_dup( ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; tp->t_rtx_res = tp->t_rtx_res_used; - ntp->t_pflags = tp->t_pflags; + + xfs_trans_switch_context(tp, ntp); /* move deferred ops over to the new tp */ xfs_defer_move(ntp, tp); @@ -153,9 +155,6 @@ xfs_trans_reserve( int error = 0; bool rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; - /* Mark this thread as being in a transaction */ - current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - /* * Attempt to reserve the needed disk blocks by decrementing * the number needed from the number available. This will @@ -163,10 +162,8 @@ xfs_trans_reserve( */ if (blocks > 0) { error = xfs_mod_fdblocks(mp, -((int64_t)blocks), rsvd); - if (error != 0) { - current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); + if (error != 0) return -ENOSPC; - } tp->t_blk_res += blocks; } @@ -240,9 +237,6 @@ xfs_trans_reserve( xfs_mod_fdblocks(mp, (int64_t)blocks, rsvd); tp->t_blk_res = 0; } - - current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - return error; } @@ -266,6 +260,7 @@ xfs_trans_alloc( tp = kmem_cache_zalloc(xfs_trans_zone, GFP_KERNEL | __GFP_NOFAIL); if (!(flags & XFS_TRANS_NO_WRITECOUNT)) sb_start_intwrite(mp->m_super); + xfs_trans_set_context(tp); /* * Zero-reservation ("empty") transactions can't modify anything, so @@ -878,7 +873,6 @@ __xfs_trans_commit( xfs_log_commit_cil(mp, tp, &commit_lsn, regrant); - current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); xfs_trans_free(tp); /* @@ -910,7 +904,6 @@ __xfs_trans_commit( xfs_log_ticket_ungrant(mp->m_log, tp->t_ticket); tp->t_ticket = NULL; } - current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); xfs_trans_free_items(tp, !!error); xfs_trans_free(tp); @@ -970,9 +963,6 @@ xfs_trans_cancel( tp->t_ticket = NULL; } - /* mark this thread as no longer being in a transaction */ - current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - xfs_trans_free_items(tp, dirty); xfs_trans_free(tp); } diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 084658946cc8..075eeade4f7d 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -268,4 +268,34 @@ xfs_trans_item_relog( return lip->li_ops->iop_relog(lip, tp); } +static inline void +xfs_trans_set_context( + struct xfs_trans *tp) +{ + ASSERT(current->journal_info == NULL); + tp->t_pflags = memalloc_nofs_save(); + current->journal_info = tp; +} + +static inline void +xfs_trans_clear_context( + struct xfs_trans *tp) +{ + if (current->journal_info == tp) { + memalloc_nofs_restore(tp->t_pflags); + current->journal_info = NULL; + } +} + +static inline void +xfs_trans_switch_context( + struct xfs_trans *old_tp, + struct xfs_trans *new_tp) +{ + ASSERT(current->journal_info == old_tp); + new_tp->t_pflags = old_tp->t_pflags; + old_tp->t_pflags = 0; + current->journal_info = new_tp; +} + #endif /* __XFS_TRANS_H__ */ From patchwork Mon Jun 6 16:05:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E74DC43334 for ; Mon, 6 Jun 2022 16:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241524AbiFFQFy (ORCPT ); Mon, 6 Jun 2022 12:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241491AbiFFQFx (ORCPT ); Mon, 6 Jun 2022 12:05:53 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C2D18E448; Mon, 6 Jun 2022 09:05:51 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id i17-20020a7bc951000000b0039c4760ec3fso2026361wml.0; Mon, 06 Jun 2022 09:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QRhtSMfP7nSm/2tSi5M5oC7ypK4we5cxq3/aNo6/e8Y=; b=XPB5PmaUDXmMT32mD1/2VkZV79VL9YJssT0/k8rVfz7YkGbiOFY8M7HqTJEU/FXods 4vVTvSwZsgefZF4qYxgGfTSbV/EGeQ4uIB5CGlau/tOjkj0hcwLON5ydpSgH2KRwmiNe dzJBudjlclOuEvUHsRPRc7gNYGQI30WPJfmgnpss08JhC1eN6XfpP+C9jhustQ4aHjDZ fdWrk48mV0gwVSTDuAFImN5SyhSDBRTv9zQY1R52xA7osTuvZdLGv39moxf2G/5MFxFl NhDKm1OfJbRRuqA4l9QiftTp9+YNw7wajlzXmWEjYCLc7KzTmOG4DDFIozUML8/rA2X9 oCaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QRhtSMfP7nSm/2tSi5M5oC7ypK4we5cxq3/aNo6/e8Y=; b=55zK7RpuCA2SdOCGiALxHqmHtfXeQ/kkxzsZlL0ORvU60rE+IvD9fre/gBPfjFSdqg 6PxsnLvTNH6VWJhg+msGqJR8KTVAGVD+jq5QejvWLn8PsltAFhB14b+ySrYtKPdvZnJm ggT1SkfHGmDHNwJf1t2CpJUSjW2tV5ZoYKvtdZfSAraFvYNSR+49HIKEJGbdLqMSXAhy M/DQZCoVxlPZUBtkBjJrby7sqnttAV2fCliTYBUBljS8KRcyPu4ZBo1G53Pivp16SiBi wbIroLbYhjzwW0BhaLrDT/bj5eHQRLNAw05wCUbAjkuTMuktNrFCQvy+5NfPLGO5J7jo mexw== X-Gm-Message-State: AOAM533OxGmpVlT7XDX7OA2p6/keUO/JNAhmXaubnaIuSTRocWUwfjDG GVEgDrTjQaaJ2JGfhwhvDRU= X-Google-Smtp-Source: ABdhPJwaVjQHlc1pZA+yk4W0HRH3ZQ3TsRf/yKmXpD75EIt11ueNm6DG3L/H4GgH6mdfePuG/sv1QQ== X-Received: by 2002:a05:600c:35d4:b0:39c:2541:7571 with SMTP id r20-20020a05600c35d400b0039c25417571mr24057171wmq.33.1654531549764; Mon, 06 Jun 2022 09:05:49 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:49 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Pavel Reichl , Eric Sandeen , Carlos Maiolino Subject: [PATCH 5.10 CANDIDATE 2/7] xfs: rename variable mp to parsing_mp Date: Mon, 6 Jun 2022 19:05:32 +0300 Message-Id: <20220606160537.689915-3-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Pavel Reichl commit 0f98b4ece18da9d8287bb4cc4e8f78b8760ea0d0 upstream. Rename mp variable to parsisng_mp so it is easy to distinguish between current mount point handle and handle for mount point which mount options are being parsed. Suggested-by: Eric Sandeen Signed-off-by: Pavel Reichl Reviewed-by: Darrick J. Wong Reviewed-by: Carlos Maiolino Signed-off-by: Darrick J. Wong Signed-off-by: Amir Goldstein --- fs/xfs/xfs_super.c | 102 ++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 5ebd6cdc44a7..f667be85f454 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1165,7 +1165,7 @@ xfs_fc_parse_param( struct fs_context *fc, struct fs_parameter *param) { - struct xfs_mount *mp = fc->s_fs_info; + struct xfs_mount *parsing_mp = fc->s_fs_info; struct fs_parse_result result; int size = 0; int opt; @@ -1176,142 +1176,142 @@ xfs_fc_parse_param( switch (opt) { case Opt_logbufs: - mp->m_logbufs = result.uint_32; + parsing_mp->m_logbufs = result.uint_32; return 0; case Opt_logbsize: - if (suffix_kstrtoint(param->string, 10, &mp->m_logbsize)) + if (suffix_kstrtoint(param->string, 10, &parsing_mp->m_logbsize)) return -EINVAL; return 0; case Opt_logdev: - kfree(mp->m_logname); - mp->m_logname = kstrdup(param->string, GFP_KERNEL); - if (!mp->m_logname) + kfree(parsing_mp->m_logname); + parsing_mp->m_logname = kstrdup(param->string, GFP_KERNEL); + if (!parsing_mp->m_logname) return -ENOMEM; return 0; case Opt_rtdev: - kfree(mp->m_rtname); - mp->m_rtname = kstrdup(param->string, GFP_KERNEL); - if (!mp->m_rtname) + kfree(parsing_mp->m_rtname); + parsing_mp->m_rtname = kstrdup(param->string, GFP_KERNEL); + if (!parsing_mp->m_rtname) return -ENOMEM; return 0; case Opt_allocsize: if (suffix_kstrtoint(param->string, 10, &size)) return -EINVAL; - mp->m_allocsize_log = ffs(size) - 1; - mp->m_flags |= XFS_MOUNT_ALLOCSIZE; + parsing_mp->m_allocsize_log = ffs(size) - 1; + parsing_mp->m_flags |= XFS_MOUNT_ALLOCSIZE; return 0; case Opt_grpid: case Opt_bsdgroups: - mp->m_flags |= XFS_MOUNT_GRPID; + parsing_mp->m_flags |= XFS_MOUNT_GRPID; return 0; case Opt_nogrpid: case Opt_sysvgroups: - mp->m_flags &= ~XFS_MOUNT_GRPID; + parsing_mp->m_flags &= ~XFS_MOUNT_GRPID; return 0; case Opt_wsync: - mp->m_flags |= XFS_MOUNT_WSYNC; + parsing_mp->m_flags |= XFS_MOUNT_WSYNC; return 0; case Opt_norecovery: - mp->m_flags |= XFS_MOUNT_NORECOVERY; + parsing_mp->m_flags |= XFS_MOUNT_NORECOVERY; return 0; case Opt_noalign: - mp->m_flags |= XFS_MOUNT_NOALIGN; + parsing_mp->m_flags |= XFS_MOUNT_NOALIGN; return 0; case Opt_swalloc: - mp->m_flags |= XFS_MOUNT_SWALLOC; + parsing_mp->m_flags |= XFS_MOUNT_SWALLOC; return 0; case Opt_sunit: - mp->m_dalign = result.uint_32; + parsing_mp->m_dalign = result.uint_32; return 0; case Opt_swidth: - mp->m_swidth = result.uint_32; + parsing_mp->m_swidth = result.uint_32; return 0; case Opt_inode32: - mp->m_flags |= XFS_MOUNT_SMALL_INUMS; + parsing_mp->m_flags |= XFS_MOUNT_SMALL_INUMS; return 0; case Opt_inode64: - mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS; + parsing_mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS; return 0; case Opt_nouuid: - mp->m_flags |= XFS_MOUNT_NOUUID; + parsing_mp->m_flags |= XFS_MOUNT_NOUUID; return 0; case Opt_largeio: - mp->m_flags |= XFS_MOUNT_LARGEIO; + parsing_mp->m_flags |= XFS_MOUNT_LARGEIO; return 0; case Opt_nolargeio: - mp->m_flags &= ~XFS_MOUNT_LARGEIO; + parsing_mp->m_flags &= ~XFS_MOUNT_LARGEIO; return 0; case Opt_filestreams: - mp->m_flags |= XFS_MOUNT_FILESTREAMS; + parsing_mp->m_flags |= XFS_MOUNT_FILESTREAMS; return 0; case Opt_noquota: - mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; - mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; - mp->m_qflags &= ~XFS_ALL_QUOTA_ACTIVE; + parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; + parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; + parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACTIVE; return 0; case Opt_quota: case Opt_uquota: case Opt_usrquota: - mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE | + parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE | XFS_UQUOTA_ENFD); return 0; case Opt_qnoenforce: case Opt_uqnoenforce: - mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE); - mp->m_qflags &= ~XFS_UQUOTA_ENFD; + parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE); + parsing_mp->m_qflags &= ~XFS_UQUOTA_ENFD; return 0; case Opt_pquota: case Opt_prjquota: - mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE | + parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE | XFS_PQUOTA_ENFD); return 0; case Opt_pqnoenforce: - mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE); - mp->m_qflags &= ~XFS_PQUOTA_ENFD; + parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE); + parsing_mp->m_qflags &= ~XFS_PQUOTA_ENFD; return 0; case Opt_gquota: case Opt_grpquota: - mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE | + parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE | XFS_GQUOTA_ENFD); return 0; case Opt_gqnoenforce: - mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); - mp->m_qflags &= ~XFS_GQUOTA_ENFD; + parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); + parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD; return 0; case Opt_discard: - mp->m_flags |= XFS_MOUNT_DISCARD; + parsing_mp->m_flags |= XFS_MOUNT_DISCARD; return 0; case Opt_nodiscard: - mp->m_flags &= ~XFS_MOUNT_DISCARD; + parsing_mp->m_flags &= ~XFS_MOUNT_DISCARD; return 0; #ifdef CONFIG_FS_DAX case Opt_dax: - xfs_mount_set_dax_mode(mp, XFS_DAX_ALWAYS); + xfs_mount_set_dax_mode(parsing_mp, XFS_DAX_ALWAYS); return 0; case Opt_dax_enum: - xfs_mount_set_dax_mode(mp, result.uint_32); + xfs_mount_set_dax_mode(parsing_mp, result.uint_32); return 0; #endif /* Following mount options will be removed in September 2025 */ case Opt_ikeep: - xfs_warn(mp, "%s mount option is deprecated.", param->key); - mp->m_flags |= XFS_MOUNT_IKEEP; + xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + parsing_mp->m_flags |= XFS_MOUNT_IKEEP; return 0; case Opt_noikeep: - xfs_warn(mp, "%s mount option is deprecated.", param->key); - mp->m_flags &= ~XFS_MOUNT_IKEEP; + xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + parsing_mp->m_flags &= ~XFS_MOUNT_IKEEP; return 0; case Opt_attr2: - xfs_warn(mp, "%s mount option is deprecated.", param->key); - mp->m_flags |= XFS_MOUNT_ATTR2; + xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + parsing_mp->m_flags |= XFS_MOUNT_ATTR2; return 0; case Opt_noattr2: - xfs_warn(mp, "%s mount option is deprecated.", param->key); - mp->m_flags &= ~XFS_MOUNT_ATTR2; - mp->m_flags |= XFS_MOUNT_NOATTR2; + xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + parsing_mp->m_flags &= ~XFS_MOUNT_ATTR2; + parsing_mp->m_flags |= XFS_MOUNT_NOATTR2; return 0; default: - xfs_warn(mp, "unknown mount option [%s].", param->key); + xfs_warn(parsing_mp, "unknown mount option [%s].", param->key); return -EINVAL; } From patchwork Mon Jun 6 16:05:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F5ECCA473 for ; Mon, 6 Jun 2022 16:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241521AbiFFQFz (ORCPT ); Mon, 6 Jun 2022 12:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241523AbiFFQFx (ORCPT ); Mon, 6 Jun 2022 12:05:53 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A14D518F2EC; Mon, 6 Jun 2022 09:05:52 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id z9so1133392wmf.3; Mon, 06 Jun 2022 09:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SjunFKBhrKFJ/HQv/88WssDIELUD5Mh1teOcnQSIQqw=; b=DEaVT/QusonOGR7Pk3H7c7Hf2d/Qoq/o9e9Cr739AWVAtgqG30bWY+RGPjdQCc/8UR Fgfs60I+SBPCk10wBebBP4eeI7Vdfkrvog6zeGIs2sh0ujhjlu9prNAq16Mvs25Y0zU0 M45JQ+qKDyp5zqkvk8y+1vIDdSCX+OhuvD0n7/nE2ATxDv+n491LCK1cH8ZhNZY62nFF iOBFUQUmi07XyX7CeQcT0d6sQf5pe61vk3lqWWcd8xTVhkUM18CQmPnwRsbS7uzQkveB UbBZUJ3drwvppG7gmDJW8ePNA3NnNw74p2UKE2oC6YzGYJK+Ami0GIGHTvkYbQ+bnO0n aisg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SjunFKBhrKFJ/HQv/88WssDIELUD5Mh1teOcnQSIQqw=; b=zbGWQt4Oi3UqA+rlIHE24eeoV5lLO4iJf4D8SnVdXZ4hoo6H7DLM7TniLjHiyZNHaJ pc7AxBAMPPOgkDPzRcD1SZH3VP5Yms+pF+sIYxMApSqR5S7WKbDEnOwgytM39oHn5g76 wxkNmbzNXbMxKcjmvvRyrf+eCoYm00JQtM0cnA51A0fhSlLy1h7wJfsp1Ts1Ey1M510O wp0sfs3S91dCiibLjGoONoWEG5w9WhhouqeE0ZP5xGQt+0+fJLoaIeRpQUhupVhzbi4A G4CrYP+l3rJFvcBbyuDZCAhQMm1eF5tCww5FT5qR1o3uz3fJjes9hRf6e2fmqrfCoHOg hQZg== X-Gm-Message-State: AOAM531hLhJZqxGBXJPrLqyWkDD78xRneXwNF1qRE4RURBxRDnaf4JlN ji/ALmn2mUoWmPdCa6jloj8= X-Google-Smtp-Source: ABdhPJx7rnZ6nAjVlZL/lfs6cNXzm+cLv5NKvLemgQwWxdf4cfMcvMhB5cU/3TjLz1LFI30emHh1mg== X-Received: by 2002:a05:600c:511a:b0:397:50b9:f5be with SMTP id o26-20020a05600c511a00b0039750b9f5bemr54536380wms.188.1654531551185; Mon, 06 Jun 2022 09:05:51 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:50 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Pavel Reichl , Eric Sandeen , Carlos Maiolino Subject: [PATCH 5.10 CANDIDATE 3/7] xfs: Skip repetitive warnings about mount options Date: Mon, 6 Jun 2022 19:05:33 +0300 Message-Id: <20220606160537.689915-4-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Pavel Reichl commit 92cf7d36384b99d5a57bf4422904a3c16dc4527a upstream. Skip the warnings about mount option being deprecated if we are remounting and deprecated option state is not changing. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211605 Fix-suggested-by: Eric Sandeen Signed-off-by: Pavel Reichl Reviewed-by: Darrick J. Wong Reviewed-by: Carlos Maiolino Signed-off-by: Darrick J. Wong Signed-off-by: Amir Goldstein --- fs/xfs/xfs_super.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index f667be85f454..b4a3a71bd667 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1155,6 +1155,22 @@ suffix_kstrtoint( return ret; } +static inline void +xfs_fs_warn_deprecated( + struct fs_context *fc, + struct fs_parameter *param, + uint64_t flag, + bool value) +{ + /* Don't print the warning if reconfiguring and current mount point + * already had the flag set + */ + if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) && + !!(XFS_M(fc->root->d_sb)->m_flags & flag) == value) + return; + xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key); +} + /* * Set mount state from a mount option. * @@ -1294,19 +1310,19 @@ xfs_fc_parse_param( #endif /* Following mount options will be removed in September 2025 */ case Opt_ikeep: - xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_IKEEP, true); parsing_mp->m_flags |= XFS_MOUNT_IKEEP; return 0; case Opt_noikeep: - xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_IKEEP, false); parsing_mp->m_flags &= ~XFS_MOUNT_IKEEP; return 0; case Opt_attr2: - xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_ATTR2, true); parsing_mp->m_flags |= XFS_MOUNT_ATTR2; return 0; case Opt_noattr2: - xfs_warn(parsing_mp, "%s mount option is deprecated.", param->key); + xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_NOATTR2, true); parsing_mp->m_flags &= ~XFS_MOUNT_ATTR2; parsing_mp->m_flags |= XFS_MOUNT_NOATTR2; return 0; From patchwork Mon Jun 6 16:05:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5081CC433EF for ; Mon, 6 Jun 2022 16:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241576AbiFFQGA (ORCPT ); Mon, 6 Jun 2022 12:06:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241566AbiFFQFz (ORCPT ); Mon, 6 Jun 2022 12:05:55 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0DD18E449; Mon, 6 Jun 2022 09:05:54 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id o37-20020a05600c512500b0039c4ba4c64dso2283183wms.2; Mon, 06 Jun 2022 09:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=leXUx+xiC8LILxdanH1dyfbyYi+fnX1NdyLFj2WsWtg=; b=kxfJpSgnzSY1qKxIJQW20YkKbKeph4we0ZKVixQjoYxsfs8LLqzPVnBNqQS6L4GV/M rnioW50SIggjU8R5ue85EJS0PF9gW2fjWksWra3CPHB7OTqsk7sbOVcRXyOQVYSPA8sy UzqQ05gcZ+tREEvUlLpw/CXm3BgCAWCBzYQaqY7jLX2K4AoZFd4Bbey4IalzSL2PLhCN THdXaF9fw7AfMnzer66mJg3ns3BsKwrZFeGpblfn+iCazwNfWRSJMwy3ZT2TXCubcqMp dO30zJLkQoCAkyyskmKBFTxQg8LQrUV3qpLUAKuymUMQBHhKqrr8Fq/nXvn5qVZSZ5/U XUzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=leXUx+xiC8LILxdanH1dyfbyYi+fnX1NdyLFj2WsWtg=; b=FY/aXtaEJmL/M19rKi11aKMdNcWLsRno2kOQ/YJbb88sQwES5Hz2IwmBS173U+Wrr5 aKweHZMml54FkPNHYWTjt9xuMKQommuAA3keshbtuqHd4UxvkldTzpDUZYohViNJjj4S oNe7KxaysxSb9fdZ2m9COBR+bDscE+W7GXS15abdcPc7aEhB/5Ce45kV6tOWLDptNzrK vmFBh4MECKYFLYrztmFq35Jge1UaH5aDj4/tzNWLgDYo1tGTHdKSmDsDeUU69p11mNy4 4PqpMYq43oBSPGnbMkQZsjBQpsmqMKRSBDdyE+ZvK+Efrq0gjb2QkSBXRb9Jw1AIOwRj vHmA== X-Gm-Message-State: AOAM531YWJR2ySlXSely+2v0/7mMFNzlff8hxHF7r2H2Ujl6unb4Ln/c Kz5aD7IzAil6Sy/k1fpwV84= X-Google-Smtp-Source: ABdhPJxQzODfrBtKl3V5YaNBG/g6qSV7RJr64EHdUAH+o+QCPEJaysu5oHUH5ccmr9+3MHCwRE5HYQ== X-Received: by 2002:a05:600c:42c6:b0:39c:4bfd:a4a9 with SMTP id j6-20020a05600c42c600b0039c4bfda4a9mr8953830wme.8.1654531552544; Mon, 06 Jun 2022 09:05:52 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:52 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Gao Xiang Subject: [PATCH 5.10 CANDIDATE 4/7] xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX Date: Mon, 6 Jun 2022 19:05:34 +0300 Message-Id: <20220606160537.689915-5-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Gao Xiang commit b2c2974b8cdf1eb3ef90ff845eb27b19e2187b7e upstream. Add the BUILD_BUG_ON to xfs_errortag_add() in order to make sure that the length of xfs_errortag_random_default matches XFS_ERRTAG_MAX when building. Signed-off-by: Gao Xiang Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Amir Goldstein --- fs/xfs/xfs_error.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 7f6e20899473..f9e2f606b5b8 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -293,6 +293,8 @@ xfs_errortag_add( struct xfs_mount *mp, unsigned int error_tag) { + BUILD_BUG_ON(ARRAY_SIZE(xfs_errortag_random_default) != XFS_ERRTAG_MAX); + if (error_tag >= XFS_ERRTAG_MAX) return -EINVAL; From patchwork Mon Jun 6 16:05:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2559BCCA473 for ; Mon, 6 Jun 2022 16:06:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241566AbiFFQGB (ORCPT ); Mon, 6 Jun 2022 12:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241568AbiFFQF4 (ORCPT ); Mon, 6 Jun 2022 12:05:56 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F22F1912E8; Mon, 6 Jun 2022 09:05:55 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id k16so20493968wrg.7; Mon, 06 Jun 2022 09:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wIQ8SbeGnrxRzelf44sWZSiCxelEYptJHBoYPCZkwKo=; b=Ot/xSCCYP8hNUNiAXKSvq6f4tZNmZ7rKO+T8XkRRg78MzTw/gUBlH4hrdkLg/oY150 y1CJIJ2wWb2D/ramGOvdlnPU+tjUkf2F9I/TtATnFolCnTxcU567ImRvG4g/+FfKOUh1 tqjeeJtmHD88Mog3RQJ2HoKx01oHyrcVQLLRtEjhlmjTVSWFTkov9yHQqlTF0mLjX6u/ Wmt2vIwN8ihAubO98dZ0LC89A7NsPYAtiYCeGNeztiC+YrjgJbnXkgeqbbLhnWNQx7BE nUzkWZwHCiIug8NXk70VPf8Emd5tIKUBSJIfBDBMkRbqDvC3Ts3Y6MkYf7DMlohLWmPp 3iKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wIQ8SbeGnrxRzelf44sWZSiCxelEYptJHBoYPCZkwKo=; b=m8zuvX3gen+HVwXKaIRvKQHl9ug1t9n8iXJtNNlEwrBrmPvtzW1GDApaO8ZyWN8Hxv KSnWHZtl/eeCEPPlmWvazGzaaOeUQKbpilRywnyFlREX4ootAHghsP39D9iVCCYBVzct M75GAnf+bLa18X4VOvH/3nbDGom9DNaC8iBi4abnO/6WuKgwgNtsiWfqGS3ispFNppTz c0z0ozI3ohaMbclvUoAe4hx9g1LblIPl8nRESxoBtVNFSsUW+egapSwD0ldJW+Z7gCOW Xpfkwu9OwN9rjpbIRO5Wx9h76eJ7pHyxuS/MSlOm3a9SgFSnss/gJscbyGVBMbZ+ByVy 1ndw== X-Gm-Message-State: AOAM530H/XWjjzyoEFxj7jQhCC5cD8apU9/igxwUJ9bhMSO2JqYg6MbW bJuOJ2GjBvnh5MAxAj9buwE= X-Google-Smtp-Source: ABdhPJx9FnVRP+SlLfBgtMNCXzFwR6wPt/+IqDxGi8T6pBsKLFVzUzJDfJrFbTV9YM6wRrYyPD7vVg== X-Received: by 2002:a5d:6b8b:0:b0:211:6641:628c with SMTP id n11-20020a5d6b8b000000b002116641628cmr22847695wrx.105.1654531553904; Mon, 06 Jun 2022 09:05:53 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:53 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Anthony Iliopoulos Subject: [PATCH 5.10 CANDIDATE 5/7] xfs: fix xfs_trans slab cache name Date: Mon, 6 Jun 2022 19:05:35 +0300 Message-Id: <20220606160537.689915-6-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Anthony Iliopoulos commit 25dfa65f814951a33072bcbae795989d817858da upstream. Removal of kmem_zone_init wrappers accidentally changed a slab cache name from "xfs_trans" to "xf_trans". Fix this so that userspace consumers of /proc/slabinfo and /sys/kernel/slab can find it again. Fixes: b1231760e443 ("xfs: Remove slab init wrappers") Signed-off-by: Anthony Iliopoulos Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Amir Goldstein --- fs/xfs/xfs_super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index b4a3a71bd667..d220a63d7883 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1926,7 +1926,7 @@ xfs_init_zones(void) if (!xfs_ifork_zone) goto out_destroy_da_state_zone; - xfs_trans_zone = kmem_cache_create("xf_trans", + xfs_trans_zone = kmem_cache_create("xfs_trans", sizeof(struct xfs_trans), 0, 0, NULL); if (!xfs_trans_zone) From patchwork Mon Jun 6 16:05:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B51C3CCA483 for ; Mon, 6 Jun 2022 16:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241460AbiFFQGC (ORCPT ); Mon, 6 Jun 2022 12:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241502AbiFFQF6 (ORCPT ); Mon, 6 Jun 2022 12:05:58 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2ED7194245; Mon, 6 Jun 2022 09:05:56 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id q7so20485566wrg.5; Mon, 06 Jun 2022 09:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wn1Y0ouYIlg+N/jjxBw0yK9UaqWrXu4rdEIsXBdfBz4=; b=Id2XcDvMXeGJVF8CP8qD0XBsFV2IrImmdisr0qE/hjB0P+E2eVVCpB7t1g+wuAEOEf ZxlhY9uQNNfYlZ47K1en1vwGfp6Wiaagvi38XTO40An8gKpOc+riYeKzy5DHLRPOR+3s yVuNHOsiqiJJYvNHqmnJILuCBH5Je2774KAj0RBfsawt/cSWX+oLPx/QcLi5zXLoztEm 6LyRonDRunQuiGpUyGc5+XKhlcOxugkuEq3GgrSf3CHfEX9oclsD+UXMgCadoWhcNDQY +uHotwK7BiiVasMyj5FcGvVbTH83CKR+ra1/BGJAPHAka3l/rwFMlO39f90AD65M5Yqk HnxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wn1Y0ouYIlg+N/jjxBw0yK9UaqWrXu4rdEIsXBdfBz4=; b=GiK1WbiOgReJNmcvEdhCmniR5Ak8zPeZ5b+DUdxHgTwRv88mPdMRvEhIRKuqlOOzC5 LZUWmIU2fjGfBut/np6t/M+0FKnzlsuJ42nhXllgz2Xfppyv/8C1eHURzlQQ2IkOkcp4 7wjz7FxxN6iytpkEYD01ARbSXHNUfLmQO6TN2X+k3dJbl6BCLkYVl5jkODOdzDVjBrUY qyCgT1rhDm65FPZy/71sUNkNDluzxagMUoaBjIw8eZjRUskoJge7mFOwcRqKMNoeDPxq HyrYNtqoY5797V5oILR+wt2rIqlEpUtD91Leg5KWxhXPok3p9mk3PUON+LGEbQX43950 8h7Q== X-Gm-Message-State: AOAM531yUYJ9FQU+yqspUCLsYLwqgzQNsrJiU/ebK+mV7VdsP6dNvwLr E9wYHcaSUACSLub/LJD676R4uCIgdASN2A== X-Google-Smtp-Source: ABdhPJx0EuuKTqHzjeEC05qbzWQ4uifR4RM5Wqs3QG0akKETn0fU0+QbLzy5R23D7sT5d3GKLsQQ4g== X-Received: by 2002:a5d:5452:0:b0:216:f80e:f7c6 with SMTP id w18-20020a5d5452000000b00216f80ef7c6mr10240940wrv.472.1654531555333; Mon, 06 Jun 2022 09:05:55 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:54 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Dave Chinner , Zorro Lang , Gao Xiang Subject: [PATCH 5.10 CANDIDATE 6/7] xfs: update superblock counters correctly for !lazysbcount Date: Mon, 6 Jun 2022 19:05:36 +0300 Message-Id: <20220606160537.689915-7-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner commit 6543990a168acf366f4b6174d7bd46ba15a8a2a6 upstream. Keep the mount superblock counters up to date for !lazysbcount filesystems so that when we log the superblock they do not need updating in any way because they are already correct. It's found by what Zorro reported: 1. mkfs.xfs -f -l lazy-count=0 -m crc=0 $dev 2. mount $dev $mnt 3. fsstress -d $mnt -p 100 -n 1000 (maybe need more or less io load) 4. umount $mnt 5. xfs_repair -n $dev and I've seen no problem with this patch. Signed-off-by: Dave Chinner Reported-by: Zorro Lang Reviewed-by: Gao Xiang Signed-off-by: Gao Xiang Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Amir Goldstein --- fs/xfs/libxfs/xfs_sb.c | 16 +++++++++++++--- fs/xfs/xfs_trans.c | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 5aeafa59ed27..66e8353da2f3 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -956,9 +956,19 @@ xfs_log_sb( struct xfs_mount *mp = tp->t_mountp; struct xfs_buf *bp = xfs_trans_getsb(tp); - mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount); - mp->m_sb.sb_ifree = percpu_counter_sum(&mp->m_ifree); - mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks); + /* + * Lazy sb counters don't update the in-core superblock so do that now. + * If this is at unmount, the counters will be exactly correct, but at + * any other time they will only be ballpark correct because of + * reservations that have been taken out percpu counters. If we have an + * unclean shutdown, this will be corrected by log recovery rebuilding + * the counters from the AGF block counts. + */ + if (xfs_sb_version_haslazysbcount(&mp->m_sb)) { + mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount); + mp->m_sb.sb_ifree = percpu_counter_sum(&mp->m_ifree); + mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks); + } xfs_sb_to_disk(bp->b_addr, &mp->m_sb); xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF); diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 2d7deacea2cf..36166bae24a6 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -615,6 +615,9 @@ xfs_trans_unreserve_and_mod_sb( /* apply remaining deltas */ spin_lock(&mp->m_sb_lock); + mp->m_sb.sb_fdblocks += tp->t_fdblocks_delta + tp->t_res_fdblocks_delta; + mp->m_sb.sb_icount += idelta; + mp->m_sb.sb_ifree += ifreedelta; mp->m_sb.sb_frextents += rtxdelta; mp->m_sb.sb_dblocks += tp->t_dblocks_delta; mp->m_sb.sb_agcount += tp->t_agcount_delta; From patchwork Mon Jun 6 16:05:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12870637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C72FCCA484 for ; Mon, 6 Jun 2022 16:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241573AbiFFQGB (ORCPT ); Mon, 6 Jun 2022 12:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241565AbiFFQF7 (ORCPT ); Mon, 6 Jun 2022 12:05:59 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA06194770; Mon, 6 Jun 2022 09:05:58 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id p10so20474473wrg.12; Mon, 06 Jun 2022 09:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BztR3xl1wXSqEmt618SWPDGdztRQPzdI6eVz/ObVHhI=; b=gpLD0N3QeF/Qj9GN7DolFJyKqcQ5jXrC8MElDu+Ju2EQUJxGT3jP3gg/McJl/EPtkg rtb3dUS7iIVN7b/sOh1Vo2ev3Lzv3SSSNXZiDC3vneivaUCsRP1sbTpQy+iVvBvgBs8N yR+9rH+FufqAaYlrVOYPp4kBcQJOr3yVwPc0s/vljBk9h0mKukW1h0DfKJNCDmWVj3o+ F6qrKPYoNe6GpuAVo3CvT7WKBPPyFtSzF2Upg2/jHvlrNAaDvIGXKHihuu3gXudDXGPk +TT6MZgSwY/sXDDb4jjEhLdkxQILrob8AoFVsL/TdaS/m+2Vbo+jRAI1gqBr18HSn/s6 gXig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BztR3xl1wXSqEmt618SWPDGdztRQPzdI6eVz/ObVHhI=; b=xajuBcZexGozCsie1U1W4JYWVKCkY7GPEW3TVfp8p/EIgl0qA6uHN5PEy4pWJIZ3go w0aRt/9Y50Z2T7UAEB1uZZaP3/iXuO56DXtPAYzLOScGBqPZ4EMx50HGLKMdIkUfcxry owsKX3XYjNni0G5X2wAxDgztXrbl7G2REgLugH2h4HGac5f07N0aOjkWTiG67Ws8fNI4 Ybxswf/vvaMGqFl/fnXLejJB+H9qDXb2Sfqt3sa8vMH9rkcvis4gSPbAV9b51gI5gFjs Zrnai+v0+zB3JbSNCLClM/DIgg+owm7VFX/ltE3lUvp3CckKe4AtaBlpveSDg27A/b3n YYXg== X-Gm-Message-State: AOAM532xVKZUlF4Gn/YYs1v/ta/teBQXeKfELYuAhzW0Zu+SFmVrwiP3 /c8I+shnO7On1oIb8TXVILbmwN6Qg2aFCw== X-Google-Smtp-Source: ABdhPJzN0KDinDmIQXnmoMwlH/peJQBrEm5/D2ekpmDMszthEgWt7f90u9Dw151evFli8xV52HjxeA== X-Received: by 2002:a5d:6e03:0:b0:20f:ca43:badc with SMTP id h3-20020a5d6e03000000b0020fca43badcmr22762300wrz.547.1654531556718; Mon, 06 Jun 2022 09:05:56 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm25681327wms.0.2022.06.06.09.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:05:56 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Brian Foster , Christoph Hellwig , Luis Chamberlain , Adam Manzanares , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Chandan Babu R Subject: [PATCH 5.10 CANDIDATE 7/7] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range Date: Mon, 6 Jun 2022 19:05:37 +0300 Message-Id: <20220606160537.689915-8-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606160537.689915-1-amir73il@gmail.com> References: <20220606160537.689915-1-amir73il@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: "Darrick J. Wong" commit d4f74e162d238ce00a640af5f0611c3f51dad70e upstream. The final parameter of filemap_write_and_wait_range is the end of the range to flush, not the length of the range to flush. Fixes: 46afb0628b86 ("xfs: only flush the unshared range in xfs_reflink_unshare") Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R Reviewed-by: Brian Foster Signed-off-by: Amir Goldstein --- fs/xfs/xfs_reflink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 6fa05fb78189..aa46b75d75af 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1503,7 +1503,8 @@ xfs_reflink_unshare( if (error) goto out; - error = filemap_write_and_wait_range(inode->i_mapping, offset, len); + error = filemap_write_and_wait_range(inode->i_mapping, offset, + offset + len - 1); if (error) goto out;