Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7300707rwb; Tue, 15 Nov 2022 10:10:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf7BpjtBkR3iKXzL72FlSRhMnizey5v39hkYGlsoAE6xyK1oT5OnyfGaFSBiDfSmpC4oSxuQ X-Received: by 2002:a05:6402:d64:b0:461:fe2b:3225 with SMTP id ec36-20020a0564020d6400b00461fe2b3225mr16460470edb.292.1668535838833; Tue, 15 Nov 2022 10:10:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668535838; cv=none; d=google.com; s=arc-20160816; b=gXgG66alJTkfobTztaL/WCqtcR5RwnEfs4HLgttPSgD30dnKbc2bhSvqU/atPsUu5j XF2pSUpUC1bIzNpDRrOlmJ4rdMLYCtm3fX98jKJ7AymoFd67ETHBI2eSDbgOf8Glw2ia pdAOClc0kCY1D3ySrduHe8GmXsb1PY3BZ4En4Eo/anNTRVxHddPK8o8/Ov/DfSAVTv/J 03od2steObHj6EnXJ9NLjSiUK3fgzcWb1p7pj0aR/2RPAz52tBaOTo85c58KxpQ7sAUu FicjsWsbzCD7ZZE+Q/dNS3jS6ik6JL98pH4bYbrArXKuq07DKt85dq8KXnYgDITHRNPw Qozg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=yb1QWgprwexsQKm4S/Gq/MwPIFzEpTMe+qnWWEHuwCo=; b=DqmGPeDLkNRK+hFF3JyFln4wowf8EbRX2ux3t9ZM7prg8WZoKoJuUTtBDXt4pd5hpj FKjvOq/0f+qr8maPOfYe50/J1yTPyWBO4kFaIOI0l0KpDcIU5poAhkRJ+z9H6U78BSa/ NyDGQGb3C2wECjtDAy7BpA4Y5OcUC28zK386AfB0X7g0qh6NBHbeAMN62p5ZlwsfqGqT Qv3Qdgbzbl71/Bd2OrL6kkCrpko3tl1IAsOX9gbOS9VGLR/P3+c9iuM60n4F+yhg4Sed vFsvEaO9qUeL1kfweFZaBTJEQFVM2e1cL24hoskndhmXrLEeAIQAHtoBhOLPDvCQgThh Tv/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AOtDzt1M; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=Ha9x0WWX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a056402190e00b0046382109edbsi13604624edz.395.2022.11.15.10.10.14; Tue, 15 Nov 2022 10:10:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AOtDzt1M; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=Ha9x0WWX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231867AbiKORlz (ORCPT + 90 others); Tue, 15 Nov 2022 12:41:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiKORlv (ORCPT ); Tue, 15 Nov 2022 12:41:51 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DDB6303D3; Tue, 15 Nov 2022 09:41:50 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E41AC1F8E1; Tue, 15 Nov 2022 17:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1668534108; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yb1QWgprwexsQKm4S/Gq/MwPIFzEpTMe+qnWWEHuwCo=; b=AOtDzt1M2fGiZ/8NX5AFf2F72XKWlnKtKgjXMQYDehm9G1Z5SDTpQBVmMY8Qa8DhpMKFDZ 7RI5V9lKC4wC48Krfx4xeEbTOIW5cpz54048nWEoITLRVNewus3EaCRIx8gId5i4CcPgdg ieEYKJM8r2TZzvav+MTXywVk59HdQZQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1668534108; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yb1QWgprwexsQKm4S/Gq/MwPIFzEpTMe+qnWWEHuwCo=; b=Ha9x0WWXoA7lnuDcZtLmpSFtBEkGqNKQ797FYv3srYjBjXXgfYUJTSsTuI/oMdX6v7/JBS NbGGlaZ+7kfyH1DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A03CE13A91; Tue, 15 Nov 2022 17:41:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sDrZJVzPc2PFXAAAMHmgww (envelope-from ); Tue, 15 Nov 2022 17:41:48 +0000 Date: Tue, 15 Nov 2022 18:41:22 +0100 From: David Sterba To: ChenXiaoSong Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangxiaoxu5@huawei.com, yanaijie@huawei.com, quwenruo.btrfs@gmx.com, wqu@suse.com Subject: Re: [PATCH v4 1/3] btrfs: add might_sleep() to some places in update_qgroup_limit_item() Message-ID: <20221115174122.GM5824@suse.cz> Reply-To: dsterba@suse.cz References: <20221115171709.3774614-1-chenxiaosong2@huawei.com> <20221115171709.3774614-2-chenxiaosong2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115171709.3774614-2-chenxiaosong2@huawei.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 16, 2022 at 01:17:07AM +0800, ChenXiaoSong wrote: > As the potential sleeping under spin lock is hard to spot, we should add > might_sleep() to some places. > > Signed-off-by: ChenXiaoSong > --- > fs/btrfs/ctree.c | 2 ++ > fs/btrfs/qgroup.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c > index a9543f01184c..809053e9cfde 100644 > --- a/fs/btrfs/ctree.c > +++ b/fs/btrfs/ctree.c > @@ -1934,6 +1934,8 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root, > int min_write_lock_level; > int prev_cmp; > > + might_sleep(); This needs some explanation in the changelog, the reason was mentioned in some past patch iteration that it's due to potential IO fi the blocks are not cached. > + > lowest_level = p->lowest_level; > WARN_ON(lowest_level && ins_len > 0); > WARN_ON(p->nodes[0] != NULL); > diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c > index 9334c3157c22..d0480b9c6c86 100644 > --- a/fs/btrfs/qgroup.c > +++ b/fs/btrfs/qgroup.c > @@ -779,6 +779,8 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, > int ret; > int slot; > > + might_sleep(); This one is redundant, no? There's call to btrfs_search_slot a few lines below. > + > key.objectid = 0; > key.type = BTRFS_QGROUP_LIMIT_KEY; > key.offset = qgroup->qgroupid; > -- > 2.31.1 >