From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 CEF4B25F7B9 for ; Sat, 22 Aug 2026 04:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787374643; cv=none; b=hxk7y06XLQjgQVz6P6BAsa4fvRkQ2lJ0Ikbkx34YqK1nywd16DJnjFRnnbpNPQZlsK1WpgbP+7ZP3yyfO7PAZSV3N1NEkc1dArSVnahsLgwWFk3OJPg5wwJmUn4ooFHfEtObKlB323tq1Rzjyw9jyl9YZs0ZQahSxuCJ0Yw0Qzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787374643; c=relaxed/simple; bh=VanUjKeNAZEPgQBnEjkQ37NMwGMaBcsxCWOhYmHg7ho=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rEBNwqeyY2AUHomrnBmmMDVji3tyD8VcUbMEp8hSiKdUFea82xjXKkwTPPO6vkKV9BtyJJ3Q3msEogktZDGq1+UAr/tQdbUY8nptSA14Dom2EK1C62+HGfagIKjI25Z7DykpyJNpFwaP52OI6fWX5qINHUAh5LR1+aksv+kq0uE= 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=QcFWkKtS; arc=none smtp.client-ip=209.85.128.52 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="QcFWkKtS" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4954a9e8490so17026325e9.1 for ; Fri, 21 Aug 2026 21:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1787374640; x=1787979440; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=v4PibLJPwswVRuRK8+G860V3WJH/gWrO0hZuqSUKKPk=; b=QcFWkKtSLQ3OA+BV7lSfz45r6OrcUV9TCiPEaj4yLTVMQzRNY3DTRMTdsxvzBV2ikh jks6C0HRTSdeFe0a9/8IuSI6phFXPofB4uzB+NjyShluhY7f/0dxW7cg47ow4KoCJy8c QVnyHZxHuVaNdSnRemlBXczGLTpdnt2/FDrb5bRDr7Xqq2nDmdWg7Uw378CbcDpDfAP+ JHueUPaMsZkKt7rNbFex50UqaUt0a4XCKQkzuNprlQqXFsHKWbMf3coPvxfFHe3Hbt6D 0DfWP9gX7PvXPWqU/zilx68rX0wMhvN6qxgaYQpXsyx4iCqeH+7V70BgYS2aDfS8VJJH L4fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787374640; x=1787979440; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=v4PibLJPwswVRuRK8+G860V3WJH/gWrO0hZuqSUKKPk=; b=Y13vLLPRcUvlUi+24AIaD02DTzWCCcpRAj8QDSv9JfQl5jPh7d1A3I4kHK3aOFG+fl Izm28hxRPtv/EUcEouk+xuF0TZkj6JRVCVVSIW79NNctnAE96IFt5zhnalwc78O9Fvu2 qj3DetsGkQ6ux8aHUllbRo2w/wrxml43H2Uqe2u8hFc17u03eu5ju4yHISDCfkWcVhDC 6c7Za7mi3BU7zAVECMMsT+bGQ0ly97USjktldLDr5lLAN9eAfrPNWYm6XYfCe1HJEFxv 05obt/tqlkakM4Ra5ZYrYff50PzfYxdNHa4hGKc7t/LyYkBLQv51/tbyvLjCKtKq+lTZ Bmxw== X-Forwarded-Encrypted: i=1; AHgh+RrfdmqD+YTujCc59eIhiWnduS6O0CEy5Z86MtCdtm0768JBhbJ7FwFSdDGgnFsgJl2HS2CusK2Dhj/letU=@vger.kernel.org X-Gm-Message-State: AFuF++m7/fpq2BbiaV2CAUW1TIaGi4PauaExbGSMEu9RD7XiToEt97Nw OKyFs5+MKokOeYRPXJm+6zMgZvwYrIJe2xJ4qQCdf7oBrkLSDVQlBUmubU4ZI3tL3rA= X-Gm-Gg: AR+sD11ChLR1d21j4yR5F0/ZvVQyHV82phkNL/YIJWgEFoD5ELMnXmWsWaf16pyakI1 jPcZsbs4VbRcB/GfeOyKwPIOUBDbFPsPTFIb+MUZQ8bQiUDOf96HP95N7dWxUE8iLdKQGyY6qOs F681AYYYl05tqognBJRA9ZoHoMtgjm/xAyUZteC/J8lEbs1WqBzwQkLQ/2IzttbIXoi2GZPBSo9 qEEJHyC7UAcwQrH8sfV5r93daWAZj/MJ42EQ9KKYe30HQ2PYjPfkMPpsZjOaoRvncnLFXSrzhBH 2Qnz+OOebnhA9tZrQj1zv3vSjSAwb0yOVkn0QP/BiQq9UO9YRFG6a896ms6TA8XQcA9uw/muxSS a4RAJdGVX/MRTJG6MoatHqKv5OLO4sHlpBFttpPYrIt3y+Eq4PWoQc8cnExl4SRtSDF7Mnv+fuk C/KhrnxC29X9g9o8lqfTU8illEOmCxcq8B3JR5sk1FyfgvSg6iTfoELQ== X-Received: by 2002:a05:600c:c114:b0:499:71d6:359a with SMTP id 5b1f17b1804b1-499b070c272mr237863515e9.8.1787374640107; Fri, 21 Aug 2026 21:57:20 -0700 (PDT) Received: from [172.16.0.229] ([159.196.52.54]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-14186173199sm3454006c88.9.2026.08.21.21.57.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Aug 2026 21:57:19 -0700 (PDT) Message-ID: Date: Sat, 22 Aug 2026 14:27:14 +0930 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/2] btrfs: delay mounted sysfs attributes until mount is ready To: Jiacheng Xu Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20b09e24.16b27.1a01f23ee08.Coremail.stitch@zju.edu.cn> <698e5039.16b92.1a0278ef67b.Coremail.stitch@zju.edu.cn> Content-Language: en-US From: Qu Wenruo Autocrypt: addr=wqu@suse.com; keydata= xsBNBFnVga8BCACyhFP3ExcTIuB73jDIBA/vSoYcTyysFQzPvez64TUSCv1SgXEByR7fju3o 8RfaWuHCnkkea5luuTZMqfgTXrun2dqNVYDNOV6RIVrc4YuG20yhC1epnV55fJCThqij0MRL 1NxPKXIlEdHvN0Kov3CtWA+R1iNN0RCeVun7rmOrrjBK573aWC5sgP7YsBOLK79H3tmUtz6b 9Imuj0ZyEsa76Xg9PX9Hn2myKj1hfWGS+5og9Va4hrwQC8ipjXik6NKR5GDV+hOZkktU81G5 gkQtGB9jOAYRs86QG/b7PtIlbd3+pppT0gaS+wvwMs8cuNG+Pu6KO1oC4jgdseFLu7NpABEB AAHNGFF1IFdlbnJ1byA8d3F1QHN1c2UuY29tPsLAlAQTAQgAPgIbAwULCQgHAgYVCAkKCwIE FgIDAQIeAQIXgBYhBC3fcuWlpVuonapC4cI9kfOhJf6oBQJnEXVgBQkQ/lqxAAoJEMI9kfOh Jf6o+jIH/2KhFmyOw4XWAYbnnijuYqb/obGae8HhcJO2KIGcxbsinK+KQFTSZnkFxnbsQ+VY fvtW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.Coremail.stitch@zju.edu.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2026/8/22 13:11, Jiacheng Xu 写道: > Here is a potential fix following Wenruo's idea. > > btrfs_sysfs_add_mounted() currently publishes the writable label and > feature attributes before the transaction kthread is created. A concurrent > sysfs write can therefore dereference a NULL transaction_kthread in > wake_up_process(). > > This series follows the suggested lifecycle: create only the required > subdirectories during early mount, publish the fsid attributes after mount > initialization, and remove them before the kthreads are stopped. The > feature attributes are included because their store callback has the same > transaction_kthread dependency as the label callback. > > Patch 1 factors the fsid attribute handling into dedicated helpers. Patch 2 > moves their publication and removal to the safe mount and unmount stages. > On unmount the cleaner is parked before attribute removal so it cannot > recreate the feature group through sysfs_update_group(). Both patches are > required for stable backports. > > The resulting fs/btrfs/sysfs.o and fs/btrfs/disk-io.o were build-tested. > > Changes in v2: > - Delay creation of both the root and feature attributes until mount setup > is complete. You don't need to bother feature attributes for now, there is already a patch addressing it by completely removing the write support for feature attributes: https://lore.kernel.org/linux-btrfs/8a598d76555b5944d34bb08fa8dbeea28fc05db9.1787307129.git.wqu@suse.com/ Considering it's only extended_iref, removing it should be much simpler. Until that is determined, you only need to bother the label one. Furthermore, among all the attr files in the fsid directory, there is only label that is writable, it would make more sense to split btrfs_attrs into two parts, one for those read-only members, and one for the only writebale label one. Otherwise the series looks much better. > - Remove those attributes while their kthread dependencies are still > valid. > - Split helper extraction from the lifecycle fix for stable backports. > > Jiacheng Xu (2): > btrfs: sysfs: factor out mounted fsid attribute helpers > btrfs: delay mounted fsid attributes until the fs is ready > > fs/btrfs/disk-io.c | 18 ++++++++++++++++- > fs/btrfs/sysfs.c | 50 ++++++++++++++++++++++++++++++---------------- > fs/btrfs/sysfs.h | 2 ++ > 3 files changed, 52 insertions(+), 18 deletions(-) > > base-commit: 0f23d56f17fdfc7db69d51f64c8b91bbab947aa9