From patchwork Wed Dec 4 03:32:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heming Zhao X-Patchwork-Id: 13893190 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F54514885E for ; Wed, 4 Dec 2024 03:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733283179; cv=none; b=DnUUjpaklgxcP0gw9fY3CTQS87GHIQffXS+KsWi7HfgnnCOmLr/hfownZY2r+o8qmLgta+WjZTcxzxojt+r34P2B8JN5hrqLaFWSV067NFJ1RvefO4/fYiXnYhW/4KmMEqZtJVkACLKc+hrvLOx0r07prbAS+t9rIl6Q268WFQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733283179; c=relaxed/simple; bh=HETMPyYFonTIlUEtDkB4W+NGpx0pChnBvtqpUMwbz5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z4kwQEjUFU3JbFWhv3C0GS8f5UFewkEVNaYZRnRzH6yzxAz4yncPnNILhfPKlWUARHRa+zeaUsEzo8+XTDF9ENCV0W8ilDBBoN67K5A9nwTaNXBGuUVdsWgpdc5eHQUz729emN+c7cAQtlIydLRZRIbqxWkM0Ib9Qi2umIRFo9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=YGVrz/Tz; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="YGVrz/Tz" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-434a29ecbceso7405955e9.0 for ; Tue, 03 Dec 2024 19:32:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733283175; x=1733887975; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IyQZbBp455IiiS0cimMqLKVcykFWRydlh8NnN31mrV4=; b=YGVrz/TzWkSKun5uOZfI2TvjIBLl8Y8Yujv6DcjCtACg5Ku9kljgmhDWOkqyAlqAYt uGgkJ3pcjrHY4FVOcJhQxEuaQqBCs1dR5g3RMjtXsl9Yyka1KSvhwmbNNNN2PM6Ko8ud 8wyYDIZMQH0yfEXj10+WPHkLAtrBYe3a6GIssnFeOwv79DgpV2PPUBTGmxcU84gFs5U4 2/73TnScD6j1ERupJcdceKJCNjEMVCvEWf95ckwKSlIT/yTTUZyuByXc/Q8KMzpGuvs7 zTOcpGv4z0vFyZw2ewN5DFXOeM+24dDpOluGYjB5cFXOI7APlvnvbgrZ8sCsGVh4Hbv0 7iNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733283175; x=1733887975; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IyQZbBp455IiiS0cimMqLKVcykFWRydlh8NnN31mrV4=; b=ulAoBmV1os/TsnGlzyV0nxxuvn5Ns4SkmbVGEweZaP1yh3Gmo0dZ0+odrrfkn+sCLs IbNbl2IPYAcak4DU4AJT0mb0FyJz60z2ekQxpEThLAZz+GYWQKRtYI5k/lfBjES693R1 XplpDBCiSZh5HUUFLmYHJ3HcyStvAQEVFM1n0gs6KVmeMYoP57L6XBTNL9/AQPJgdn32 4mLtE4qxwx9vwgPuyv1ORq/S7szkhSVrhuBegmJn5rb9QgomwcyGVrfQ4LfnrvwfKhDe cMrDf4FAgB+BYNj1tjKpA2VLj3uBWFaBarXQdfvYw9k9PIIaTtKtr1QyFXQNKjONBmfM yN6Q== X-Forwarded-Encrypted: i=1; AJvYcCX2QBRPEvFyjMskUqjn1xulZCqm8I+4ivoPGcpguOv4AGQYd0hXCGt1XIG7Cjyx8l2QfYfuJJLgrtbePA==@lists.linux.dev X-Gm-Message-State: AOJu0YxYF4E8QpcA/gkmd/hcmPMmewyowbqbrWZF4SgeBzxSF2yPyL4p Uj0KsoJdR8qge4nQLAgkVx/dmHxpZIAQlcp9T/n8+gsEtXLjgMpwaqDNYaNP7BM= X-Gm-Gg: ASbGncvIZ07vPF1J4tEiPLIvIT4fP9oPSz2T62P2Mu7da6QWl7tQ1ZxpH03lxZv51yV wfs7dyc0tVXT533MsUNusFDrFvF8ROSpmO40fS9Hfe49tZr9sJu9WdY34txUpKAAC17ltU2BDWS RIlpPHkSq68PhQPBbc0NyKSGnTqztoVyNBGdj+j2SuusAtv+YQ51gvI5nMhg9TfcIUc4tjLscao ABgLHrBd3VRm4xdgFhyvhZneFdQbRwA5bSiU5t4lR3ZGP2DxYYjqJlE3igtgQ== X-Google-Smtp-Source: AGHT+IE/jHB53rXLi5u7lvRJEF+CPq4Zu3rqIEuQoyRi8fGpj8biZzILxPOqXkFg+fFvWqVlPTnhJQ== X-Received: by 2002:a5d:6dae:0:b0:385:e10a:4d98 with SMTP id ffacd0b85a97d-385fd3cfcb3mr1524139f8f.8.1733283175560; Tue, 03 Dec 2024 19:32:55 -0800 (PST) Received: from localhost.localdomain ([114.254.72.7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215a04dc249sm37476025ad.203.2024.12.03.19.32.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 19:32:54 -0800 (PST) From: Heming Zhao To: joseph.qi@linux.alibaba.com, ocfs2-devel@lists.linux.dev Cc: Heming Zhao , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, gregkh@linuxfoundation.org, Heming Zhao , stable@vger.kernel.org Subject: [PATCH 1/2] ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2 volume" Date: Wed, 4 Dec 2024 11:32:39 +0800 Message-ID: <20241204033243.8273-2-heming.zhao@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241204033243.8273-1-heming.zhao@suse.com> References: <20241204033243.8273-1-heming.zhao@suse.com> Precedence: bulk X-Mailing-List: ocfs2-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This reverts commit dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume"). In commit dfe6c5692fb5, the commit log stating "This bug has existed since the initial OCFS2 code." is incorrect. The correct introduction commit is 30dd3478c3cd ("ocfs2: correctly use ocfs2_find_next_zero_bit()"). Fixes: dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume") Signed-off-by: Heming Zhao Cc: --- fs/ocfs2/localalloc.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 8ac42ea81a17..5df34561c551 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -1002,25 +1002,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = bit_off + 1; } - /* clear the contiguous bits until the end boundary */ - if (count) { - blkno = la_start_blk + - ocfs2_clusters_to_blocks(osb->sb, - start - count); - - trace_ocfs2_sync_local_to_main_free( - count, start - count, - (unsigned long long)la_start_blk, - (unsigned long long)blkno); - - status = ocfs2_release_clusters(handle, - main_bm_inode, - main_bm_bh, blkno, - count); - if (status < 0) - mlog_errno(status); - } - bail: if (status) mlog_errno(status); From patchwork Wed Dec 4 03:32:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heming Zhao X-Patchwork-Id: 13893191 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA8DE157A5C for ; Wed, 4 Dec 2024 03:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733283182; cv=none; b=EZbRfe5FUBhgZ9L7q3S8ljx+jdGitvNJjFhRLQj+yqAvnvqCmNWT4b0vPcH3u6jHHOlUhLyw093TFhBuzlowZUMHRjFw242733ShKet0YbKa7oCPRgG1hX3P9QxIJvhbXtjQHzvrPWH2xEn9WXegJVMOz2JfG4ERwqtllCyXiVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733283182; c=relaxed/simple; bh=V/GrvN8+N9+Lt1DYRfzrOPsts/7lPzckFMVjjKtG5Nc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SY8F5wj0NvdveSW9dqvziF0p2ZxNKeOyl1tWa59JUo6ktnueldQ2Qt9AJTWgMUrmQ7O5Z1M5kNgdf+7yciqxvExXPv4+uZBqVJ3/U+5p4JKd0AlD21TvNyLLQD95QzSMo4R4DrqN2ThsIcPut2c4nIQZGfborBOEY2hc81I+FCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=NejwzWl+; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="NejwzWl+" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-385e971a2a0so227937f8f.1 for ; Tue, 03 Dec 2024 19:33:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733283179; x=1733887979; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mp1Qqcg1dvH5e9SyzHpweN5r/SUkOnitlXEeua4r1tk=; b=NejwzWl+2pPpN1BjAt4oBatEcDicubPuWGkq5yjIUBr9FDEzcNPKbtZzH+VAs2u2cr H29jax+TXf9eb/s6CSWS9f8w381unUlT+ouJ+qkN65OYs5GrXzYgaaCHs18GXxeLsgqg /xJpE/O1NpUYCPPzIxFiSMfYtdVwnp+d2NOXxtU5Xop6E34jb3c68RvMu1WTmP9uRhKc x0iarBgrtLU8gz48sf9P12L02qW7vl3rWaa+XA5wwf4qKUeDm4qK64NGgRQHG4ES+rnI Iabv4JJ7A5U/yd8NJkKW2WcL57KN01ZWyOr2KI0Gp1eHrBTrvH1ZrLoHOz44ARnKmjlK b/jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733283179; x=1733887979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mp1Qqcg1dvH5e9SyzHpweN5r/SUkOnitlXEeua4r1tk=; b=dwemZocoNGOjXAavodDNMqi459/p2CtezlIdzozLMMGgdf5/lWXHJt7IR7h4VG8GHE kiGfv61lUcStMYO0kHMytLetEXKu0vGiuifLLg8o0+o3wrS/I1/6Ogy0wQrkHlVeMNFe 6d72v/bwm3ygwsj8Z99IVyY++zBdIjHV5XLVmkHGAb3tyxoMLdzw796uQD9/hOmse2r+ 7EJzmbWDqv9x8LzN2s0b0O9cbP0uOX/zGc3pz/GHiVmndWVvg/BWjyZaVQSa6nCzVwtx Xa582RGJLNc9zkyNL+bIOax+aL0wXV7HWlYQVghhS1bsdKz4a30ok5In9NJ/GgIBnvr2 VpUw== X-Forwarded-Encrypted: i=1; AJvYcCUc1awKDHAAjjwiBZSl3/tMwxB3/AARZyfswPGLJNtA6oGnY/oSnT+wShaR/lmVGPS5Pa3/GPRYR/wsLw==@lists.linux.dev X-Gm-Message-State: AOJu0YxIxQFcgYnhxgM4mam7+wQwVelKz+hiq/JLO/0cQgqcIJJscje4 KbVgC54NUFgzCd36d7Qo61MbOrBuMHpo62Nw8Am0bRAoeIb4IX5UnlZkOYkbhF8= X-Gm-Gg: ASbGncsiK7W0/1PalxyLk+iF6pF6nt7zHi2oIftG1C9KjEj8ARWRuiY6T+51GiD2GIV Nq856+B2nJiRoR8Qp4nP5pzPr7GFaPXzoxkStJzBQ7GqqGW/gwUrk0h1HRdWFIRAAR9OLD3oWuc 6B8U8mh9XB6cV+CiHw0eyhhrao9zRqLcT2eQvheQ14E6Fq6sMwEHAOdY6WC4cpEuzgxoAZHlZoi cshRhEtBRR2xM6UxRq1cT8IvHBTwBhb5/1FPuz/Y7gdYlzmq3Ujm03du0eOww== X-Google-Smtp-Source: AGHT+IGrxSK7SMs30zEUVr384O062RDz8BWaLsZ1ohvJ+GDGEs2COmYERdYzpJ0KCyZv7A9tHSOkdA== X-Received: by 2002:a5d:588f:0:b0:37d:54d0:1f18 with SMTP id ffacd0b85a97d-385fd3ea027mr1773079f8f.6.1733283179136; Tue, 03 Dec 2024 19:32:59 -0800 (PST) Received: from localhost.localdomain ([114.254.72.7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215a04dc249sm37476025ad.203.2024.12.03.19.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 19:32:58 -0800 (PST) From: Heming Zhao To: joseph.qi@linux.alibaba.com, ocfs2-devel@lists.linux.dev Cc: Heming Zhao , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, gregkh@linuxfoundation.org Subject: [PATCH 2/2] ocfs2: fix the la space leak when unmounting an ocfs2 volume Date: Wed, 4 Dec 2024 11:32:40 +0800 Message-ID: <20241204033243.8273-3-heming.zhao@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241204033243.8273-1-heming.zhao@suse.com> References: <20241204033243.8273-1-heming.zhao@suse.com> Precedence: bulk X-Mailing-List: ocfs2-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This bug has existed since the initial OCFS2 code. The code logic in ocfs2_sync_local_to_main() is wrong, as it ignores the last contiguous free bits, which causes an OCFS2 volume to lose the last free clusters of LA window on each umount command. Signed-off-by: Heming Zhao Fixes: 30dd3478c3cd ("ocfs2: correctly use ocfs2_find_next_zero_bit()") --- fs/ocfs2/localalloc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 5df34561c551..8ac42ea81a17 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -1002,6 +1002,25 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = bit_off + 1; } + /* clear the contiguous bits until the end boundary */ + if (count) { + blkno = la_start_blk + + ocfs2_clusters_to_blocks(osb->sb, + start - count); + + trace_ocfs2_sync_local_to_main_free( + count, start - count, + (unsigned long long)la_start_blk, + (unsigned long long)blkno); + + status = ocfs2_release_clusters(handle, + main_bm_inode, + main_bm_bh, blkno, + count); + if (status < 0) + mlog_errno(status); + } + bail: if (status) mlog_errno(status);