lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230904143018.5709-2-shikemeng@huaweicloud.com>
Date:   Mon,  4 Sep 2023 22:30:16 +0800
From:   Kemeng Shi <shikemeng@...weicloud.com>
To:     miklos@...redi.hu, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     shikemeng@...weicloud.com
Subject: [PATCH 1/3] fuse: move FR_WAITING set from fuse_request_queue_background to fuse_simple_background

Current way to set FR_WAITING in fuse_simple_background:
fuse_simple_background
	if (args->force)
		fuse_request_alloc
		/* need to increase num_waiting before request is queued */
	else
		fuse_get_req
			atomic_inc(&fc->num_waiting);
			__set_bit(FR_WAITING, &req->flags);

	fuse_request_queue_background
		if (!test_bit(FR_WAITING, &req->flags)
			__set_bit(FR_WAITING, &req->flags);
			atomic_inc(&fc->num_waiting);

We only need to increase num_waiting for force allocated reqeust in
fuse_request_queue_background. Simply increase num_waiting in force block
to remove unnecessary test_bit(FR_WAITING).
This patch also makes it more intuitive to remove FR_WATING usage in next
commit.

Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
---
 fs/fuse/dev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 1a8f82f478cb..59e1357d4880 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -528,10 +528,6 @@ static bool fuse_request_queue_background(struct fuse_req *req)
 	bool queued = false;
 
 	WARN_ON(!test_bit(FR_BACKGROUND, &req->flags));
-	if (!test_bit(FR_WAITING, &req->flags)) {
-		__set_bit(FR_WAITING, &req->flags);
-		atomic_inc(&fc->num_waiting);
-	}
 	__set_bit(FR_ISREPLY, &req->flags);
 	spin_lock(&fc->bg_lock);
 	if (likely(fc->connected)) {
@@ -553,10 +549,14 @@ int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args,
 	struct fuse_req *req;
 
 	if (args->force) {
+		struct fuse_conn *fc = fm->fc;
+
 		WARN_ON(!args->nocreds);
 		req = fuse_request_alloc(fm, gfp_flags);
 		if (!req)
 			return -ENOMEM;
+		atomic_inc(&fc->num_waiting);
+		__set_bit(FR_WAITING, &req->flags);
 		__set_bit(FR_BACKGROUND, &req->flags);
 	} else {
 		WARN_ON(args->nocreds);
-- 
2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ