quota: Remove BUG_ON from dqget()
authorJan Kara <jack@suse.cz>
Fri, 20 Oct 2023 11:34:08 +0000 (13:34 +0200)
committerJan Kara <jack@suse.cz>
Mon, 22 Jan 2024 11:56:20 +0000 (12:56 +0100)
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

index 85edbbafaaa42b99fb001a38a5697f43d07643a7..5f5481c43d9843def2155cbefff973021bd812d3 100644 (file)
@@ -984,9 +984,8 @@ we_slept:
         * 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);