Commit d0f6dc26 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by Jakub Kicinski

af_unix: Replace BUG_ON() with WARN_ON_ONCE().

This is a prep patch for the last patch in this series so that
checkpatch will not warn about BUG_ON().
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: default avatarJens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240129190435.57228-2-kuniyu@amazon.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2dc23b6f
...@@ -145,7 +145,7 @@ static void scan_children(struct sock *x, void (*func)(struct unix_sock *), ...@@ -145,7 +145,7 @@ static void scan_children(struct sock *x, void (*func)(struct unix_sock *),
/* An embryo cannot be in-flight, so it's safe /* An embryo cannot be in-flight, so it's safe
* to use the list link. * to use the list link.
*/ */
BUG_ON(!list_empty(&u->link)); WARN_ON_ONCE(!list_empty(&u->link));
list_add_tail(&u->link, &embryos); list_add_tail(&u->link, &embryos);
} }
spin_unlock(&x->sk_receive_queue.lock); spin_unlock(&x->sk_receive_queue.lock);
...@@ -213,8 +213,8 @@ static void __unix_gc(struct work_struct *work) ...@@ -213,8 +213,8 @@ static void __unix_gc(struct work_struct *work)
total_refs = file_count(u->sk.sk_socket->file); total_refs = file_count(u->sk.sk_socket->file);
BUG_ON(!u->inflight); WARN_ON_ONCE(!u->inflight);
BUG_ON(total_refs < u->inflight); WARN_ON_ONCE(total_refs < u->inflight);
if (total_refs == u->inflight) { if (total_refs == u->inflight) {
list_move_tail(&u->link, &gc_candidates); list_move_tail(&u->link, &gc_candidates);
__set_bit(UNIX_GC_CANDIDATE, &u->gc_flags); __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags);
...@@ -294,7 +294,7 @@ static void __unix_gc(struct work_struct *work) ...@@ -294,7 +294,7 @@ static void __unix_gc(struct work_struct *work)
list_move_tail(&u->link, &gc_inflight_list); list_move_tail(&u->link, &gc_inflight_list);
/* All candidates should have been detached by now. */ /* All candidates should have been detached by now. */
BUG_ON(!list_empty(&gc_candidates)); WARN_ON_ONCE(!list_empty(&gc_candidates));
/* Paired with READ_ONCE() in wait_for_unix_gc(). */ /* Paired with READ_ONCE() in wait_for_unix_gc(). */
WRITE_ONCE(gc_in_progress, false); WRITE_ONCE(gc_in_progress, false);
......
...@@ -51,10 +51,10 @@ void unix_inflight(struct user_struct *user, struct file *fp) ...@@ -51,10 +51,10 @@ void unix_inflight(struct user_struct *user, struct file *fp)
if (u) { if (u) {
if (!u->inflight) { if (!u->inflight) {
BUG_ON(!list_empty(&u->link)); WARN_ON_ONCE(!list_empty(&u->link));
list_add_tail(&u->link, &gc_inflight_list); list_add_tail(&u->link, &gc_inflight_list);
} else { } else {
BUG_ON(list_empty(&u->link)); WARN_ON_ONCE(list_empty(&u->link));
} }
u->inflight++; u->inflight++;
/* Paired with READ_ONCE() in wait_for_unix_gc() */ /* Paired with READ_ONCE() in wait_for_unix_gc() */
...@@ -71,8 +71,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp) ...@@ -71,8 +71,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp)
spin_lock(&unix_gc_lock); spin_lock(&unix_gc_lock);
if (u) { if (u) {
BUG_ON(!u->inflight); WARN_ON_ONCE(!u->inflight);
BUG_ON(list_empty(&u->link)); WARN_ON_ONCE(list_empty(&u->link));
u->inflight--; u->inflight--;
if (!u->inflight) if (!u->inflight)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment