]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fuse: refactor fuse_conn_put() to remove negative logic.
authorLuis Henriques <luis@igalia.com>
Tue, 16 Sep 2025 13:53:10 +0000 (14:53 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 12 Nov 2025 10:45:03 +0000 (11:45 +0100)
There is no functional change with this patch.  It simply refactors
function fuse_conn_put() to not use negative logic, which makes it more
easier to read.

Signed-off-by: Luis Henriques <luis@igalia.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/inode.c

index 3087165a6004291c5487f9b1cbe987f73db4fb47..21e04c394a80e49048f7eaf5db6a1c4872c77d2b 100644 (file)
@@ -1022,27 +1022,28 @@ static void delayed_release(struct rcu_head *p)
 
 void fuse_conn_put(struct fuse_conn *fc)
 {
-       if (refcount_dec_and_test(&fc->count)) {
-               struct fuse_iqueue *fiq = &fc->iq;
-               struct fuse_sync_bucket *bucket;
-
-               if (IS_ENABLED(CONFIG_FUSE_DAX))
-                       fuse_dax_conn_free(fc);
-               if (fc->timeout.req_timeout)
-                       cancel_delayed_work_sync(&fc->timeout.work);
-               cancel_work_sync(&fc->epoch_work);
-               if (fiq->ops->release)
-                       fiq->ops->release(fiq);
-               put_pid_ns(fc->pid_ns);
-               bucket = rcu_dereference_protected(fc->curr_bucket, 1);
-               if (bucket) {
-                       WARN_ON(atomic_read(&bucket->count) != 1);
-                       kfree(bucket);
-               }
-               if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
-                       fuse_backing_files_free(fc);
-               call_rcu(&fc->rcu, delayed_release);
+       struct fuse_iqueue *fiq = &fc->iq;
+       struct fuse_sync_bucket *bucket;
+
+       if (!refcount_dec_and_test(&fc->count))
+               return;
+
+       if (IS_ENABLED(CONFIG_FUSE_DAX))
+               fuse_dax_conn_free(fc);
+       if (fc->timeout.req_timeout)
+               cancel_delayed_work_sync(&fc->timeout.work);
+       cancel_work_sync(&fc->epoch_work);
+       if (fiq->ops->release)
+               fiq->ops->release(fiq);
+       put_pid_ns(fc->pid_ns);
+       bucket = rcu_dereference_protected(fc->curr_bucket, 1);
+       if (bucket) {
+               WARN_ON(atomic_read(&bucket->count) != 1);
+               kfree(bucket);
        }
+       if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
+               fuse_backing_files_free(fc);
+       call_rcu(&fc->rcu, delayed_release);
 }
 EXPORT_SYMBOL_GPL(fuse_conn_put);