[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240509122154.782930-2-houtao@huaweicloud.com>
Date: Thu, 9 May 2024 20:21:53 +0800
From: Hou Tao <houtao@...weicloud.com>
To: linux-fsdevel@...r.kernel.org
Cc: Miklos Szeredi <miklos@...redi.hu>,
Zhao Chen <winters.zc@...group.com>,
linux-kernel@...r.kernel.org,
houtao1@...wei.com
Subject: [PATCH 1/2] fuse: set FR_PENDING atomically in fuse_resend()
From: Hou Tao <houtao1@...wei.com>
When fuse_resend() moves the requests from processing lists to pending
list, it uses __set_bit() to set FR_PENDING bit in req->flags.
Using __set_bit() is not safe, because other functions may update
req->flags concurrently (e.g., request_wait_answer() may call
set_bit(FR_INTERRUPTED, &flags)).
Fix it by using set_bit() instead.
Fixes: 760eac73f9f69 ("fuse: Introduce a new notification type for resend pending requests")
Signed-off-by: Hou Tao <houtao1@...wei.com>
---
fs/fuse/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 3ec8bb5e68ff5..8eb2ce7c0b012 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1813,7 +1813,7 @@ static void fuse_resend(struct fuse_conn *fc)
spin_unlock(&fc->lock);
list_for_each_entry_safe(req, next, &to_queue, list) {
- __set_bit(FR_PENDING, &req->flags);
+ set_bit(FR_PENDING, &req->flags);
/* mark the request as resend request */
req->in.h.unique |= FUSE_UNIQUE_RESEND;
}
--
2.29.2
Powered by blists - more mailing lists