Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp896367pxp; Wed, 16 Mar 2022 20:31:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhz4Sxmw2vmDHrMLHwWGCE25sc0nQIaJtmqG4Xgagsws4OUBqRWCcljDylq5Whgl8oTCFo X-Received: by 2002:a05:6a00:815:b0:4f6:ee04:30af with SMTP id m21-20020a056a00081500b004f6ee0430afmr2611888pfk.15.1647487890798; Wed, 16 Mar 2022 20:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647487890; cv=none; d=google.com; s=arc-20160816; b=VL6Mj5OcJQkmgl5jVLMdFm6CUB2w1h/5Jcy1GD8EtBEZl0UjjdDSDdKIE40RfmrIaL zBNdC9rJBmmEWVr7c1BXVCOMNqtRTLCD8rBBRE8RnbXUz42BZmEKoagv1x/R+deBt4ST XwB6w44kL3saS0QxG0q0G97ZMqYnAUbS9eoMvfep62eQtR8MvxVntzlgG82wcjvx83XM /w9J6S1SkdlxPQxqxTYoZXUsexjfpAipVn9yQKoKbAnTZLh55zvxtXujHGX75Rjyf5Yj hIFSNXIa0XShfK5ZpdU6rqEIWKjTSnp9dOoBk9OTpyniteJ7RndAAY85jz2chmH0paFr N+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=UuAeFhHcYfc/PM7qFOhissSVPvjmlLQlFV4f+xjGmZs=; b=JV//OPypNDKWYNYOhIAb71d6HKjF7+x47MlSAoze/w62GeVUV9/eu4eQayuZJ/PDxs SGQvYogBtBM6WBQ/aUKpzRtyM0H/jXzJgxsr1PXIJcxXXa8Fin+fa/FAth/Lwl5nqIvm gAltTqPI3HIg5RW5Sdlr/LS+LgKM7MC9PEfzwvhjXDk3R36pC2vvD8Bpu6oNYUbxRj/V jEnU4wT7z5Oj8ocThr9Qdk4c+I985WVzt1QdeLQN3mN4fqlFbMmKCvEKca0s5vqhOgUm BNCCHCVuTIQub1/s0iscDyooqY90dA2gQjFmN6EWMZaDlPfvtGXQVUGx3VJeD5sGXw7q rGBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t12-20020a17090a448c00b001bd14e03064si1220035pjg.60.2022.03.16.20.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:31:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C14410FD6; Wed, 16 Mar 2022 20:28:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236311AbiCOVpF (ORCPT + 99 others); Tue, 15 Mar 2022 17:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235470AbiCOVpE (ORCPT ); Tue, 15 Mar 2022 17:45:04 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 597E613D40 for ; Tue, 15 Mar 2022 14:43:51 -0700 (PDT) Received: from cwcc.thunk.org (pool-108-7-220-252.bstnma.fios.verizon.net [108.7.220.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 22FLhhYd018945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Mar 2022 17:43:43 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 3CC9515C3E98; Tue, 15 Mar 2022 17:43:43 -0400 (EDT) Date: Tue, 15 Mar 2022 17:43:43 -0400 From: "Theodore Ts'o" To: Ritesh Harjani Cc: linux-ext4@vger.kernel.org, Jan Kara , Harshad Shirwadkar Subject: Re: [PATCHv3 05/10] ext4: Return early for non-eligible fast_commit track events Message-ID: References: <3cd025d9c490218a92e6d8fb30b6123e693373e3.1647057583.git.riteshh@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3cd025d9c490218a92e6d8fb30b6123e693373e3.1647057583.git.riteshh@linux.ibm.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-ext4@vger.kernel.org On Sat, Mar 12, 2022 at 11:09:50AM +0530, Ritesh Harjani wrote: > Currently ext4_fc_track_template() checks, whether the trace event > path belongs to replay or does sb has ineligible set, if yes it simply > returns. This patch pulls those checks before calling > ext4_fc_track_template() in the callers of ext4_fc_track_template(). > > Signed-off-by: Ritesh Harjani I had to add the following patch to this commit in order to prevent a BUG when using ext4 to mount a file system without a journal. This is because ext4_rename() calls the __ext4_fc_track_* functions directly, and moving the checks from __ext4_fc_track_* to ext4_fc_track_* would result in a NULL pointer dereference. - Ted diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 39e223f7bf64..e37da8d5cd0c 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3891,12 +3891,19 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, ext4_fc_mark_ineligible(old.inode->i_sb, EXT4_FC_REASON_RENAME_DIR, handle); } else { + struct super_block *sb = old.inode->i_sb; + if (new.inode) ext4_fc_track_unlink(handle, new.dentry); - __ext4_fc_track_link(handle, old.inode, new.dentry); - __ext4_fc_track_unlink(handle, old.inode, old.dentry); - if (whiteout) - __ext4_fc_track_create(handle, whiteout, old.dentry); + if (test_opt2(sb, JOURNAL_FAST_COMMIT) && + !(EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY) && + !(ext4_test_mount_flag(sb, EXT4_MF_FC_INELIGIBLE))) { + __ext4_fc_track_link(handle, old.inode, new.dentry); + __ext4_fc_track_unlink(handle, old.inode, old.dentry); + if (whiteout) + __ext4_fc_track_create(handle, whiteout, + old.dentry); + } } if (new.inode) {