Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1451587lqj; Tue, 4 Jun 2024 01:47:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXjIq+xEdkA6BGKhCJbEIZx8gfvtAUWXRnWqbOlg1ky04xSdQDy3y9FcBgxIIhsxOWLgcTGQiTZOF//rD+h7KLHN7LJ4nwn6arAlhZlTw== X-Google-Smtp-Source: AGHT+IGxh85X2GRniVBFq0fanHyQUXLh8hortlOZonr3AHFCVPTJ7gMIF6PmwjR8WiqoZmGDJ4G6 X-Received: by 2002:a05:622a:47:b0:43f:f28e:f78d with SMTP id d75a77b69052e-43ff526f986mr102489301cf.17.1717490844407; Tue, 04 Jun 2024 01:47:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717490844; cv=pass; d=google.com; s=arc-20160816; b=RYojkjLwLD/DnsPD/zHFqwjpOZ1Up03awFUHgfB0rBpVc8/9MwYhNwSuk6O7pS3wPD ZUFV/gWr8e+e7Kvn/daSotJQxmD6f28Gxr0uXOUJeOQ5dVzymUyVfUtYUySg3VoS0BOt klQQjD/TQhEPVd+IoGdxCwnbTTlCcu6yzf9U6C+AZ5JNfF7yezuV5MFBFcKoUSw04sCM 4Mf5LEjArGljbtKTTSG4WljR6ihh1MyRfjI4l4Ccz3X/9x4pzYxr4aIgEhzqJBP1pGgP nbEZTwR03YtGU52Ta2HpLvQMiqJztxyDFe601HRiM0y62VhHsrBKS7H0IT6FcIQckUbV flRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=N5wvSoM1bL8UEGO0xicxwbrkdQzMxVrx45Djt/Yqlo4=; fh=9QA4ZLr+1b6KAs9emCF14kPKPWeMuKnIuKLpwBa8Frc=; b=n0bwl96fiOwRapsOTkcsy2zh2gcDVMoiBjolAZMgkYemNin+MzpQGSwXKvOBPJzdam NplqSNuMbe2pmn6AsnUykgonm35DUyDzwcbnXXpaKzyk8ZIO80EWnIr/0zUhVsAG4zu2 9iPxHFpoaQJYt6P3118SLjnrtheQIbeMwKmRj7Qz7yO4IbObV+WKtXPhXq3/ykTHIi9W 812HwFCp+YPPxnJDge/dS/FYM04IVlTGTMzmu2+uR+k/5gWkoKMsOa7jsrZnvVCywCnx 2U0OXVIDbukvIl3Yh/HFsrbmzwuJ8x+Y+/t94kFCY2CJT6BW/Lyst2ByLuaW7gG8+wlP gCvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SxzTzenQ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-200267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43ff23ae81fsi103351181cf.6.2024.06.04.01.47.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 01:47:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SxzTzenQ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-200267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 247591C232F5 for ; Tue, 4 Jun 2024 08:47:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C195E142900; Tue, 4 Jun 2024 08:47:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="SxzTzenQ" Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FADF1411F7; Tue, 4 Jun 2024 08:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717490838; cv=none; b=gKfPBractDIUzdbgdne8u/RDJrLmd9sxea4nFiKPt6f35VTyTB3wuB9lW7qepx6doTk7PMmJourkZTCZIVc8TP1boRpnCU8lv3Aoae0DbKlZWNxiC3xvskt4HHrRARnnsqNOqk175VD+HHg7tYVIZcSNhBIekwlbOlhsyvnfz9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717490838; c=relaxed/simple; bh=AA3Rl+0xtoO3H2LbG1/6LvDkAhOdb8JORN3HMqGymmM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GxWh3WUMng6WT52sn9niKLjpLar5RF7Cyz5DORTvW70MnYSkLJBZNNuqNfDxUXchKlJ001Hoe35rljqcl1IrIL9jrx0ImHwMAXgqG13Gly9RHVSYegdr8/Zz68qcXxrltXJtVMAjBCyRkwM2WBZM+rrwXoaHoxH+rQA/R08fIOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=SxzTzenQ; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: kent.overstreet@linux.dev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717490828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=N5wvSoM1bL8UEGO0xicxwbrkdQzMxVrx45Djt/Yqlo4=; b=SxzTzenQU2gRcWNmDyi3KT0CkG4KlH+4yuYh/rWhSz5DyAEPTX1pBqnzMzXomi2A+bvX+0 D8bGxabvlNGlmv+mCj0/UdyGE6FzEThL4an+GnnXkcFQdCBJamCu0x9vi4S8QYMA98HnJn q8nk+yqzBKT4X6EEJ6dx8QDlDE5Q+7g= X-Envelope-To: bfoster@redhat.com X-Envelope-To: linux-bcachefs@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: tangyouling@kylinos.cn X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Youling Tang To: Kent Overstreet Cc: Brian Foster , linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, Youling Tang Subject: [PATCH] bcachefs: Move the ei_flags setting to after initialization Date: Tue, 4 Jun 2024 16:46:10 +0800 Message-Id: <20240604084610.94558-1-youling.tang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Youling Tang `inode->ei_flags` setting and cleaning should be done after initialization, otherwise the operation is invalid. Fixes: 9ca4853b98af ("bcachefs: Fix quota support for snapshots") Signed-off-by: Youling Tang --- fs/bcachefs/fs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 0695f478e206..21e5fe296ac8 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1488,11 +1488,6 @@ static void bch2_vfs_inode_init(struct btree_trans *trans, subvol_inum inum, bch2_iget5_set(&inode->v, &inum); bch2_inode_update_after_write(trans, inode, bi, ~0); - if (BCH_SUBVOLUME_SNAP(subvol)) - set_bit(EI_INODE_SNAPSHOT, &inode->ei_flags); - else - clear_bit(EI_INODE_SNAPSHOT, &inode->ei_flags); - inode->v.i_blocks = bi->bi_sectors; inode->v.i_ino = bi->bi_inum; inode->v.i_rdev = bi->bi_dev; @@ -1504,6 +1499,11 @@ static void bch2_vfs_inode_init(struct btree_trans *trans, subvol_inum inum, inode->ei_qid = bch_qid(bi); inode->ei_subvol = inum.subvol; + if (BCH_SUBVOLUME_SNAP(subvol)) + set_bit(EI_INODE_SNAPSHOT, &inode->ei_flags); + else + clear_bit(EI_INODE_SNAPSHOT, &inode->ei_flags); + inode->v.i_mapping->a_ops = &bch_address_space_operations; switch (inode->v.i_mode & S_IFMT) { -- 2.34.1