From patchwork Fri Jun 9 13:05:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 13273934 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 F3C2AC7EE2E for ; Fri, 9 Jun 2023 13:04:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240325AbjFINEm (ORCPT ); Fri, 9 Jun 2023 09:04:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239939AbjFINEk (ORCPT ); Fri, 9 Jun 2023 09:04:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5342D74 for ; Fri, 9 Jun 2023 06:04:40 -0700 (PDT) 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 CFD1A1FDF8 for ; Fri, 9 Jun 2023 13:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686315878; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=Ixre44R2int8Gj0sLd4BBmGnT9zemVkWyzGFyWJZUqc=; b=BEUqfjsswDBBslgVfuVvHVuCfnxklQ7790bQvO6veCV/oFNTgC9KvKj64HkNKWtlapzUND fKUtfJzyXT6prjCALki7wrdB/Jk9bxi7LmQ+xOo1XObuma+/x+1AGABUPtRPA0hvLiVCEf 3M7Edl3wizLvK1LOsq1Ofj70E5csN1k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686315878; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=Ixre44R2int8Gj0sLd4BBmGnT9zemVkWyzGFyWJZUqc=; b=VMfCTn40NCbyAfkND3vBqe5LBpLokXSnKj9Yd3RX7FiKr8r+27NqCMPT8Smx/MYiu/Vyxx DyEbeZkEvbt4JbCA== 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 7940913A47 for ; Fri, 9 Jun 2023 13:04:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qAUsFWYjg2QATgAAMHmgww (envelope-from ) for ; Fri, 09 Jun 2023 13:04:38 +0000 Date: Fri, 9 Jun 2023 08:05:14 -0500 From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: do not clear EXTENT_LOCKED in try_release_extent_state() Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org clear_bits unsets EXTENT_LOCKED in the else branch of checking EXTENT_LOCKED. At this point, it is not possible that EXTENT_LOCKED bits are set, so do not clear EXTENT_LOCKED. Besides, The comment above try_release_extent_state():__clear_extent_bit() also says that locked bit should not be cleared. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a91d5ad27984..e5bec73b5991 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2357,7 +2357,7 @@ static int try_release_extent_state(struct extent_io_tree *tree, if (test_range_bit(tree, start, end, EXTENT_LOCKED, 0, NULL)) { ret = 0; } else { - u32 clear_bits = ~(EXTENT_LOCKED | EXTENT_NODATASUM | + u32 clear_bits = ~(EXTENT_NODATASUM | EXTENT_DELALLOC_NEW | EXTENT_CTLBITS); /*