diff mbox series

FUSE: dev: Change the posiion of spin_lock

Message ID 20230529015656.3099390-1-lijun01@kylinos.cn (mailing list archive)
State Handled Elsewhere
Headers show
Series FUSE: dev: Change the posiion of spin_lock | expand

Commit Message

lijun May 29, 2023, 1:56 a.m. UTC
just list_del need spin_lock ,so the spin_lock should be close to
"list_del(&req->list)", this may add a little benefit.

Signed-off-by: lijun <lijun01@kylinos.cn>
---
 fs/fuse/dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 1a8f82f478cb..c3a0a04ea9b4 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -388,16 +388,15 @@  static void request_wait_answer(struct fuse_req *req)
 		if (!err)
 			return;
 
-		spin_lock(&fiq->lock);
 		/* Request is not yet in userspace, bail out */
 		if (test_bit(FR_PENDING, &req->flags)) {
+			spin_lock(&fiq->lock);
 			list_del(&req->list);
 			spin_unlock(&fiq->lock);
 			__fuse_put_request(req);
 			req->out.h.error = -EINTR;
 			return;
 		}
-		spin_unlock(&fiq->lock);
 	}
 
 	/*