From patchwork Mon Jun 27 07:33:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896323 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 25535C43334 for ; Mon, 27 Jun 2022 07:33:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232918AbiF0HdU (ORCPT ); Mon, 27 Jun 2022 03:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbiF0HdT (ORCPT ); Mon, 27 Jun 2022 03:33:19 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FD125F52; Mon, 27 Jun 2022 00:33:18 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id v14so11698288wra.5; Mon, 27 Jun 2022 00:33:18 -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=oaARiwiEx/3RCWDyCcO1te+XU/5DqLqVsURD1C3kmZE=; b=bUCmyaH0DRywMH/aL9aF2lQA73kdHL1FnFn1bxJs2pF3c0UXy+YU7/uAiD0roR255h L1+8bTGVXXnwDAZ5x8evY4ouHLLc7J55VFVX12z00k0Heq9pKfJfzEQGkiENJngPVogp IUtv8YYhzbOvKjb67TTURJTYSXoJZyNIoWZcXrIcZItOeiy49RhcN3WsLIRL4DLAE5AT Tp8uPuEpy6Lzqwr3hBVwBsAyWBwaNFMY1mc/sdt5DV7Te/+0K2MksdSLaWh3oYS12E72 SWr5KPNFPBwowi8QpVldvH+bNlfQSspaRhgvW5pPrr8uWR91yBw09ZsLou4g6nHARb6a T90Q== 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=oaARiwiEx/3RCWDyCcO1te+XU/5DqLqVsURD1C3kmZE=; b=LxxwRqWjCBgbWZl8En1kWjX4LUKPNYqsStnB6+mVSNyzmKWFRacZ6E6H1uGFDpay3v YDr6I86nHHbHy94/kv0afHWWuBUh1aYwCCqCBcn2SFOH43AJ4Y0IB7fVvzK3Mg3mIjMF fI2i/M2bhN3xs49iCVdeF4mf6ZG3tRPFcvGIefI9PALj+E/l8RxJDeHZqk0bgz7j9ara IiPJ1zP4iyBj5CD21TZXkG5XeOs5VVGyRDlDaR+YN16zvxLjIF7nQForiw+6edXibCVD 09hCClQ9+JCyt92qoMs0l1TBcYLep7EMGHx1KEGrpAbcEoM6WMxWq8tKbDHU1r/UmV9d CLhg== X-Gm-Message-State: AJIora89txMhNGT0tKc81HFgZaSuL6oZ5SpY3xBEfPrITQOTV/EQO8B+ PyuWc7F3YfDOUtPWmRjt65FHTQDt7FiHqQ== X-Google-Smtp-Source: AGRyM1uC6gtD+lFBu0ck3yU1Q81pbRe+JUDMICPrHrchwDEZN5irv/+6SWLKcLaNKprbxcwtSJjVSQ== X-Received: by 2002:a05:6000:1f07:b0:21b:a6d4:9d26 with SMTP id bv7-20020a0560001f0700b0021ba6d49d26mr10791624wrb.150.1656315197126; Mon, 27 Jun 2022 00:33:17 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:16 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Dave Chinner , Christoph Hellwig Subject: [PATCH 5.10 CANDIDATE v2 1/7] xfs: use current->journal_info for detecting transaction recursion Date: Mon, 27 Jun 2022 10:33:05 +0300 Message-Id: <20220627073311.2800330-2-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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 dd33b31b0a82..86297f59b43e 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1460,13 +1460,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 4b76a32d2f16..953de843d9c3 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 */ @@ -577,6 +577,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); } @@ -587,6 +593,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 27 07:33:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896324 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 61315C43334 for ; Mon, 27 Jun 2022 07:33:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232908AbiF0HdX (ORCPT ); Mon, 27 Jun 2022 03:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbiF0HdV (ORCPT ); Mon, 27 Jun 2022 03:33:21 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44BEC5FA5; Mon, 27 Jun 2022 00:33:20 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id v14so11698378wra.5; Mon, 27 Jun 2022 00:33:20 -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=/1EHMgfrGUhZPCPRBTdDPwYNr34YyDlrux6kPWGwhzU=; b=GyRzTLLrT4n8K1TdO0g24ATtCiDOLoEcgB4EWUFcqCPE0ibnSDMrWZzx1aD/jckZJ1 7NpTj9m+ASXt3Ga7aUIV7xhNWpXT43eOTDIORcz949iXLAIky3y98u8M9atRymUpQSML l5dR8ybfUF6lWHpMKGxScyhjlbAt5yES3sbt7u/+kMi4gV2sqZXvATzkpaauHzSHX3Eg LnwQE9Xm8LriJ9N8UxHM8NR0hrFxzKCxks9C3ozoXt1/DBYrmxocrfdeXZ0svwNYmeZV fJcEGcLMcYwPMnplYhqzkylFcvZ5P/ABEA+ZBSewC/+IDyowa9R4TwatQLnAwlQVayJt C81Q== 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=/1EHMgfrGUhZPCPRBTdDPwYNr34YyDlrux6kPWGwhzU=; b=Bt6pdB6Uho6MuVzFD0iL+ywA9bSvdsnrb4nf72LC2e7VHxE3tDgGshzpfovSH2pafG 5wM86sywXKdmV7z5JJ0jIfAvowDwBHEGbNXuvy5pSLYm208h7A2P6k7JibG0kBVTtTSg biv3tfgQQgq3zod4xah1o12WN9A+COkwWNE3iFf9Q7p6e6CY9KovZas/SV/QGOkfPv6F ZdD53eD/aOmDoosXTVKYJgnnzy0js57nETSAycxbtzbzi8iB+ndQSo1Az7G5dssznASf mbtAIBhkXvWLi2Yw+dK9JK8DxXXB7Zrtx2Zk2ZI0hVqgyCt/YIh1HZG8g6C8NhlP1Nod JxPQ== X-Gm-Message-State: AJIora9IQohkK8aQVxVe7AlMiSutU/TUIxxt8pM0j2yf6amVz2XJIx1+ lPGqg4nULD/iPfPtgAehB/c= X-Google-Smtp-Source: AGRyM1uT2j9hWHSnfpSJv7/8/Hf9MiqFXDVyohEBHa2R4L4FLkznQGvTEKEqlqZgzIK7Oj54dje5YQ== X-Received: by 2002:a5d:4f07:0:b0:21b:8ea0:ef0 with SMTP id c7-20020a5d4f07000000b0021b8ea00ef0mr11121742wru.329.1656315198827; Mon, 27 Jun 2022 00:33:18 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:18 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Pavel Reichl , Eric Sandeen , Carlos Maiolino Subject: [PATCH 5.10 CANDIDATE v2 2/7] xfs: rename variable mp to parsing_mp Date: Mon, 27 Jun 2022 10:33:06 +0300 Message-Id: <20220627073311.2800330-3-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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 05cea7788d49..cba47adbbfdc 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 27 07:33:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896325 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 374E8CCA473 for ; Mon, 27 Jun 2022 07:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232235AbiF0HdY (ORCPT ); Mon, 27 Jun 2022 03:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbiF0HdX (ORCPT ); Mon, 27 Jun 2022 03:33:23 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D49D5FE1; Mon, 27 Jun 2022 00:33:22 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id n1so11666386wrg.12; Mon, 27 Jun 2022 00:33:21 -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=CA92df9BhmtGbPL/verbNBeKPY+zGVKKjMeB6o3F8F4=; b=OdBhuaXo+iL7/MFfOvdeSBWB4S/2nDTmNLmCeav5I2IfKRSs8O92900Fotj4aaE+56 7p+zVnyBXUuR3Ay5582bOFiwzdzs04GuY9z1MuD2zgm+yMkqJQzhEUZZueuBI2A7fDeQ RxkMjPIJPc3WfwM/YqvWJrX6nFnkvgsPs3RYfPdgELuNIMuR3zE0sqoQTWVJvqaq3ofn YN94T4SxFUlORsv0avrf5JEfLb1r9fIE6V2866RLkPkOUJGd6iZa2ggP0UiSXZm9BHUa s0wsA1msQiKAuleOogihtUBFPlJiuM7uDPgOStg59Kl9AgVY5qNa5NQANctiDTCKWzfP 9RNA== 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=CA92df9BhmtGbPL/verbNBeKPY+zGVKKjMeB6o3F8F4=; b=CD84RHgEIAcW+a93mVWgZpDfDo/Ig86ip0CQPxkhssgGzqRB4cZsmXG87OJEZnfNSs bsMoXIs4X7xjzd8JTJYCe+atVDwHO2FmoaWLjRFzlSe9bWN2Etp6BXvZY9J+CCSW29/n oSKVPUIQvEbbo8YaEcyMJ38u2cqfofdoYIId4VBKaeqI21TaWcR44gQBUiUSjLY7q6Sb eP+3xjjm0gGqx2tiEAYcHhnauGd3gm8cr+LEBENDIGNhRLvhVmS99Iu6/WDHdMln8U0i gywC7dd3jwN8582KvyUy1qyHtAlOH/1/v1FEPkwlLm2UTb9ZqldGfLuH56OIRf1ZI00O hgNQ== X-Gm-Message-State: AJIora9uQAlnGw29pNdPV57gfbllpsCgUZeTL3JT3Ber7YG2fUhkIKL+ rpOyNwu9Cqf5orcur3NPU5w= X-Google-Smtp-Source: AGRyM1vIRiNhcxgNgdyKU1+K0gejdYLF4Di1cv8QmDF7SjwUJIRBVsp2aHmjpAI5HPs81be+sKGdZQ== X-Received: by 2002:a5d:6b06:0:b0:21b:902e:5727 with SMTP id v6-20020a5d6b06000000b0021b902e5727mr11082489wrw.86.1656315200574; Mon, 27 Jun 2022 00:33:20 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:19 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Pavel Reichl , Eric Sandeen , Carlos Maiolino Subject: [PATCH 5.10 CANDIDATE v2 3/7] xfs: Skip repetitive warnings about mount options Date: Mon, 27 Jun 2022 10:33:07 +0300 Message-Id: <20220627073311.2800330-4-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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 cba47adbbfdc..04af5d17abc7 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 27 07:33:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896326 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 1CDF8C43334 for ; Mon, 27 Jun 2022 07:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232925AbiF0Hd0 (ORCPT ); Mon, 27 Jun 2022 03:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232922AbiF0HdY (ORCPT ); Mon, 27 Jun 2022 03:33:24 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E474C5FD5; Mon, 27 Jun 2022 00:33:23 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id k22so11694518wrd.6; Mon, 27 Jun 2022 00:33:23 -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=SSS2P5CweqeMgCAhEH1iYJbJl5DOj7NnLflWpu+UNQVObjoz1eJmW0tUfPBhpTS8Sm v8lRjc07LHLqqxczbEWDHmK5P02CvQO17lqo9NMw5oMVviWcDddAJmTqmmfv6lg+GZ8P USjDp3DxobLCPKMNvvJu77ITE8xY4zNM6/n5z/5HcRjlFPVyULinzKNdviBkxLYCuKba ljWGmbQUTPxpnQwg2EI3dCwdajcF2j2uV4k1WckGTc0P8PE3wcOF6wZotmP7VNbCzoQG Xe59TZhqA3JspkQ7dzKZgLt9yurfH/8AOEq/GYAW3EMv66SKQ5n0SqkaxFFxWhsOViaf dJfA== 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=3N29HDTr/kwe+sSia/vy5pFxYcGrhmw7Y6/mQwaEakrFX9DJIOavqp3giBgarMh0IC mESKd1AJ5a7NH9A2gy81jmcW5+wJQjtmm5uaGZjc9nahgaaoaU5FtSiqxnCltNubjg0H hebmZro3jWOR2+FSBVVPSE+4u4BHv/bxw6jXy2hVCtdVfDfYgNJzreNETsbnKInhxT7I 2bwqN2F6C0IbHqPOGGYohZcmleNu006Ns/rVXe9QVHirCbudkfxQvMPcnjohk18raNSD gxbyLmWP78A41icJyOXqS2Bz1rIF7M7OUFsWCHZHlvIaB6D8hmw24ftU6ana+wv4mUGs Mq0w== X-Gm-Message-State: AJIora8wvyMCU5utjYHtb0Hd4Hh2tQANMKgIgAVcwFzRLJXrodDyGPXC wRRQmtDWju7O0ZfpmRvdtU+bsyi5kfhWCg== X-Google-Smtp-Source: AGRyM1ugr+9eDyri3itM9Ix5FOJZJPC3jW94+HVw33BJRB1VYYks66ypModPEU09HwCLn6Hjbr6Oeg== X-Received: by 2002:adf:fb08:0:b0:21b:af81:2ffd with SMTP id c8-20020adffb08000000b0021baf812ffdmr10969700wrr.685.1656315202301; Mon, 27 Jun 2022 00:33:22 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:21 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Gao Xiang , Christoph Hellwig Subject: [PATCH 5.10 CANDIDATE v2 4/7] xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX Date: Mon, 27 Jun 2022 10:33:08 +0300 Message-Id: <20220627073311.2800330-5-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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 27 07:33:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896327 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 CAE6BCCA47F for ; Mon, 27 Jun 2022 07:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232922AbiF0Hd1 (ORCPT ); Mon, 27 Jun 2022 03:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbiF0HdZ (ORCPT ); Mon, 27 Jun 2022 03:33:25 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79B535FDD; Mon, 27 Jun 2022 00:33:24 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id r20so11735447wra.1; Mon, 27 Jun 2022 00:33:24 -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=q7+aaYxWvJpUUImyX0kEjqtoV/Ox5Gruzg85xMJV5V4=; b=Pn6917jxen0o/l0xLr9f+doO1T5Syz/mcSrATru2smz3xg/C/C+Mk+zpBIxzK9C3P9 VKrmmq9q3dGATbrNRYDFvwQNPQAkoeCSSuLst1kKjZdnQEemVaWgT05fzHKabaKf9hYO S45oKbD/qMa+ffTQ4yetfkT39nXw4kxt/7juS7y9DoFivq3fZkkHXF/d2yfUKQ63z3jz Kw2nOdCdYRHhyz8fmtqP4caLV4Md3YnTzDV9BZV0EpiG2IsUjMnfWLQF+t4qrQRAbQuZ e+Pg0JalOyIaqLdEA2y/yHuEqJYcCkByW3Ktu08E2KZIZy/jsCkiltifi0z3JUdyeGMs 6s2g== 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=q7+aaYxWvJpUUImyX0kEjqtoV/Ox5Gruzg85xMJV5V4=; b=j4hWVPxXrKA6SDufLvKDBVIlGfu12fg40PSWlNjLCVjxRktaJV89oA88tswPYplKR9 l1C512fdw7PJqQkopT/K+flgQZnOrkXXwfqJfIToUjOuiOFJX0rsolKJT7E7aqtCIUIs k1Fp1HjYIzz/Hl0vYaeiGxMiFQzgbH/Af1fopl/mncJjfy8WSdvAp/3+1SruVTGg/mnT n1vIYJ1pWVa1mGu9Iv3aGENiydtWUuc3yib/NgzZ99Xl2W2z2uNFh2MSg+1J35eeYn7H H0nuobqojGhc8hB6qISBK6JEpQbUx4UxtkFRg3gLo1twJPBbqdShrAlcdmCoKch+bpQ3 e2OA== X-Gm-Message-State: AJIora821DCrANSAKAD7fF9PS417nF3xP9IuBd9tPGUDf2mMp7tww38G 9pc43V2Eq+z+upJVGaXGmWI= X-Google-Smtp-Source: AGRyM1tLNSS7392jFMSmzop0TFE+7gPAUJ0Nt74ylzmqyq3/s+T/nOXOJTquDkQnm95wVOxpNoSZlQ== X-Received: by 2002:adf:e6d2:0:b0:21b:9580:8d8b with SMTP id y18-20020adfe6d2000000b0021b95808d8bmr10519597wrm.120.1656315204073; Mon, 27 Jun 2022 00:33:24 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:23 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Anthony Iliopoulos Subject: [PATCH 5.10 CANDIDATE v2 5/7] xfs: fix xfs_trans slab cache name Date: Mon, 27 Jun 2022 10:33:09 +0300 Message-Id: <20220627073311.2800330-6-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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 04af5d17abc7..6323974d6b3e 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1934,7 +1934,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 27 07:33:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896328 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 6D882CCA473 for ; Mon, 27 Jun 2022 07:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232932AbiF0Hd3 (ORCPT ); Mon, 27 Jun 2022 03:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbiF0Hd2 (ORCPT ); Mon, 27 Jun 2022 03:33:28 -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 7DCB05592; Mon, 27 Jun 2022 00:33:27 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id l2-20020a05600c4f0200b0039c55c50482so6955903wmq.0; Mon, 27 Jun 2022 00:33:27 -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=jJE0swdPowWhFGEvtt+wvpLEkGqp4l7CJVG6k8MYXhm3ZNGSqE/7+ZI0iNwEtT09Wn HrTeoDbFPGPvOQW1/uW6Ay8WVFsxxWgns3lVNeeThbnU2TQ4WlcV3L4wIR8W/ev9CaGY 7ugtHCJXjTv1SMGzslOEl9kcagONkBDe5g3uXjNC15U4Fl4GZdasxD8TnnPkiXFeQP8g J0Vf7/3FXVKGfCFpFgewxPo7x3CXicyAopOwzr9geOSauk5uymasd/dcQqk1pv+QGiH7 TMonHBI05xojKh1siLtzd/IkHQtnHIaLXWXEP0hWnEvXwPuDISk5jA4bPBpcNXu0YnGY pHSw== 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=fenDaqL4/QUp/0424ehm7GYZzczb5rbxnDAKjTGVdksDBsxLW0sfNyv8QBNwmJy/s2 cU0dTnjEtKWPZmXpAeXvs3f9ymEKreNkgRn+uTzdfITgqwrDw10M4A6vS5xbXWO9t2Vk dxF3FusziSYC/eJZjY7fKXTGe4J0yyFAPS9Ef9TPmGJioV6g+c5im6BZWY/J0c7P4jxL TXLtYY2GExGD5NMzDVnEnbemk7617PF70GGzCM9s7qRPH8Ov8WTBO3ghsi8b1XyEKIg+ vl20ODRjMQ0UZwOw+AI1rnALKxXTNjTZD8uv75viJ9gEhya3GH/MmHm6ITyaJ/4Pa8NI LzVA== X-Gm-Message-State: AJIora9UcJud+qGbd3+1JNXcjsfBqghUgnEUrqWmkL/2adkcfzbYcJyr 840qTKfpu+bGWGlypm0M3zY= X-Google-Smtp-Source: AGRyM1uUXox1i7pzrS6eHYRG7Pjzzc+qWUqUX9gc3H47zEC42brLjAyQP2BU/aUOgFtaCqwvuohsgw== X-Received: by 2002:a05:600c:4f54:b0:3a0:4a5b:2692 with SMTP id m20-20020a05600c4f5400b003a04a5b2692mr4228833wmq.109.1656315205973; Mon, 27 Jun 2022 00:33:25 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:25 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Dave Chinner , Zorro Lang , Gao Xiang , Brian Foster Subject: [PATCH 5.10 CANDIDATE v2 6/7] xfs: update superblock counters correctly for !lazysbcount Date: Mon, 27 Jun 2022 10:33:10 +0300 Message-Id: <20220627073311.2800330-7-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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 27 07:33:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 12896329 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 AE5D1C433EF for ; Mon, 27 Jun 2022 07:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbiF0Hda (ORCPT ); Mon, 27 Jun 2022 03:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbiF0Hd3 (ORCPT ); Mon, 27 Jun 2022 03:33:29 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 115EF5F7B; Mon, 27 Jun 2022 00:33:28 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id v14so11698288wra.5; Mon, 27 Jun 2022 00:33:27 -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=CvjX0rm3EoE8khbsBpmBE9BcbieFleylvaRKbdxtOkTzj+SbayW9UF0BBNBXYqMkvT cftKVq0oHpbSfg/c0e8FX+Fpto1YAnDYw/dZ5p5hWOkM11OMauDd2AL1JvW7N7kB3H9y /HQ54m2qUpQIM/MVNaLt8dHNEb5T5tb6wfM4uXCIFDgHsSuplCsH7BmJL3ed8/askgAR /3NnqvrCsfdD/41lOhoPdlfZDVivzEa4F32Bfxp8GTJOSqyl5osgM3Y+I75Uva3imMHI 3wAitz3MniFjqW4D5hbGr4/kkWbw9rApViT2x1Wg5uzIRmmEU353GvJYROqHyP4JDoUL CLhQ== 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=SWAdEH9/9KBjZZ/mv03yXm8Pp61kjk7SxxCi5lO3he4XVzOdov1VljWcoDEp+gr6Rh tSH55kMPLbaQYuQqu1310aNyyQVYX/summKtru/Tj/0qICqQqY5an0oYghFq7CTBlArk D8TS+JMvV0th0Hq+mCiegAXYP1C1s8YxflOkJXTlY/2AhfLYuxEaGhOuf6re0xwdUnXe 0eRZxu4QG3TiEQzZwl9dFxzE6GNmC+q5dXwFdR3vS2Z+oGQ6FFiSab7zqi0wscmfIF4u i/S9/BEbyp2+cEWH7FSgzS4nZ+dLQ601fbsEfs1U0+CWQTSlHhrcsL4bPfcIz6ozgEEN Frnw== X-Gm-Message-State: AJIora/SCMdes1qacSWDT9jb9uUeu9gCqUsNJjef8fkmQnwKLZOMuuXV g4tsR7EWNQHhg0mGo0Mq8sY= X-Google-Smtp-Source: AGRyM1vuI/aNm+g7BWDoprDddUlIrM6zLYlPhBendmGhbSF0w2LJP0cOpEJu7/kvbPOcpWOpRkNJnw== X-Received: by 2002:a5d:4d10:0:b0:21b:93fc:67a9 with SMTP id z16-20020a5d4d10000000b0021b93fc67a9mr10434361wrt.505.1656315207670; Mon, 27 Jun 2022 00:33:27 -0700 (PDT) Received: from amir-ThinkPad-T480.lan ([77.137.66.49]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c2b9400b00397623ff335sm12070070wmc.10.2022.06.27.00.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 00:33:27 -0700 (PDT) From: Amir Goldstein To: "Darrick J . Wong" Cc: Dave Chinner , Leah Rumancik , Chandan Babu R , Luis Chamberlain , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, Chandan Babu R , Brian Foster Subject: [PATCH 5.10 CANDIDATE v2 7/7] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range Date: Mon, 27 Jun 2022 10:33:11 +0300 Message-Id: <20220627073311.2800330-8-amir73il@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627073311.2800330-1-amir73il@gmail.com> References: <20220627073311.2800330-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;