diff mbox series

[3/3] quota: Remove BUG_ON from dqget()

Message ID 20231027162343.28366-3-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series quota: Remove BUG_ONs from quota code | expand

Commit Message

Jan Kara Oct. 27, 2023, 4:23 p.m. UTC
dqget() checks whether dquot->dq_sb is set when returning it using
BUG_ON. Firstly this doesn't work as an invalidation check for quite
some time (we release dquot with dq_sb set these days), secondly using
BUG_ON is quite harsh. Use WARN_ON_ONCE and check whether dquot is still
hashed instead.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index f0bb8367641f..7cd83443e3eb 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -990,9 +990,8 @@  struct dquot *dqget(struct super_block *sb, struct kqid qid)
 	 * smp_mb__before_atomic() in dquot_acquire().
 	 */
 	smp_rmb();
-#ifdef CONFIG_QUOTA_DEBUG
-	BUG_ON(!dquot->dq_sb);	/* Has somebody invalidated entry under us? */
-#endif
+	/* Has somebody invalidated entry under us? */
+	WARN_ON_ONCE(hlist_unhashed(&dquot->dq_hash));
 out:
 	if (empty)
 		do_destroy_dquot(empty);