From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 09859245014 for ; Sun, 4 Jan 2026 02:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767492502; cv=none; b=E2YYn9GtxraONfOrT9xhy6lVx3ExhvqTfa+HQ65LH8M3m9UwOP/oSZzX/vVSvZqQKkavhp2LJJUjjqLSw4Z5nXULbE0mTCF7KPN8MwammqqwaWfWVxwZLhjNMR/f7vJbgKd1ulEpW1XNA6bdu9gwbmfii3jRqwNQPXEzsgycqAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767492502; c=relaxed/simple; bh=i04Bk13G8JvXw51LzcCEHT7YmJ8DM1rKYrGoAlPDpsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nlenFsWSSVTmWq9ihyhbPLnNvBKGx1JiZB1h5WgyIftX2lk1Zt1S473S0CizGFtzZ/u04tnx5E1Bo9OUJj1HPGrbjhF5o1KZumVUYrk6birTgdlPiWvVBivVQgI0XrvUwIfi7J0i+i3YOZcNWSabMLS9JG84qrDdxOpHlrU+p84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EHQ46Rts; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EHQ46Rts" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B86DDC113D0; Sun, 4 Jan 2026 02:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767492501; bh=i04Bk13G8JvXw51LzcCEHT7YmJ8DM1rKYrGoAlPDpsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHQ46Rts0nqU+KkTAPgrAVZY0RKJTLK2tOcLcCiLNsIB3n5T/0zPicnRX2bQo6vdu Yo0gRHBdWtn0hdDhd1x21eMtyiaXXGQiGlrg6YScbchRtzAukYIgiEbtvC8/tCl4fI VcsKjIJNmcbTzXQKdMA7U6qtJFbIyf4yZBhN/N4E4IzBg78uuP/rHfmfaxTTDlx5ec Bq0L70tlLOO73xszSc9zVpIYkvbFDokd0sdIOba8gZfzbkxSbM+IKXleNukaqMPglo +/1xlbHNZZ7KkSxUQHYpy9F2cgP+zsoIeAEpVt8zDwpmVeW1brFQmns1Dc6RJ9wvLj OKbluwts/qEiQ== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 13/14] f2fs: introduce FAULT_LOCK_TIMEOUT Date: Sun, 4 Jan 2026 10:07:28 +0800 Message-ID: <20260104020729.1064529-13-chao@kernel.org> X-Mailer: git-send-email 2.52.0.358.g0dd7633a29-goog In-Reply-To: <20260104020729.1064529-1-chao@kernel.org> References: <20260104020729.1064529-1-chao@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch introduce a new fault type FAULT_LOCK_TIMEOUT, it can be used to inject timeout into lock duration. Timeout type can be set via /sys/fs/f2fs//inject_timeout_type Signed-off-by: Chao Yu --- Documentation/ABI/testing/sysfs-fs-f2fs | 1 + Documentation/filesystems/f2fs.rst | 1 + fs/f2fs/checkpoint.c | 3 +++ fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 1 + 5 files changed, 7 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index de5a80124e04..4b0bec3c0746 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -743,6 +743,7 @@ Description: Support configuring fault injection type, should be FAULT_INCONSISTENT_FOOTER 0x00200000 FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms) FAULT_VMALLOC 0x00800000 + FAULT_LOCK_TIMEOUT 0x01000000 (1000ms) =========================== ========== What: /sys/fs/f2fs//discard_io_aware_gran diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst index 2d71efa7db7a..33d2166ac6b7 100644 --- a/Documentation/filesystems/f2fs.rst +++ b/Documentation/filesystems/f2fs.rst @@ -217,6 +217,7 @@ fault_type=%d Support configuring fault injection type, should be FAULT_INCONSISTENT_FOOTER 0x00200000 FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms) FAULT_VMALLOC 0x00800000 + FAULT_LOCK_TIMEOUT 0x01000000 (1000ms) =========================== ========== mode=%s Control block allocation mode which supports "adaptive" and "lfs". In "lfs" mode, there should be no random diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 86656231ce83..f2ab5ba8fb6a 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -63,6 +63,9 @@ static inline void trace_lock_elapsed_time_end(struct f2fs_rwsem *sem, if (!lc->lock_trace) return; + if (time_to_inject(sem->sbi, FAULT_LOCK_TIMEOUT)) + f2fs_io_schedule_timeout_killable(DEFAULT_FAULT_TIMEOUT); + get_lock_elapsed_time(&tts); total_time = div_u64(tts.total_time - lc->ts.total_time, npm); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 8c0ce9fd954f..4f8eb1292ebf 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -65,6 +65,7 @@ enum { FAULT_INCONSISTENT_FOOTER, FAULT_ATOMIC_TIMEOUT, FAULT_VMALLOC, + FAULT_LOCK_TIMEOUT, FAULT_MAX, }; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 9e41fe39dbf6..1915d194153e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -69,6 +69,7 @@ const char *f2fs_fault_name[FAULT_MAX] = { [FAULT_INCONSISTENT_FOOTER] = "inconsistent footer", [FAULT_ATOMIC_TIMEOUT] = "atomic timeout", [FAULT_VMALLOC] = "vmalloc", + [FAULT_LOCK_TIMEOUT] = "lock timeout", }; int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate, -- 2.49.0