[RHEL7,COMMIT] ms/fuse: use list_first_entry() in flush_bg_queue()

Submitted by Konstantin Khorenko on Oct. 4, 2018, 9:31 a.m.

Details

Message ID 201810040931.w949VJWV022913@finist_ce7.work
State New
Series "ms/fuse: use list_first_entry() in flush_bg_queue()"
Headers show

Commit Message

Konstantin Khorenko Oct. 4, 2018, 9:31 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.2
------>
commit 06a4a11bd2f0c842e152d3f7ebe19d864c702652
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Thu Oct 4 12:31:19 2018 +0300

    ms/fuse: use list_first_entry() in flush_bg_queue()
    
    This cleanup patch makes the function to use the primitive
    instead of direct dereferencing.
    
    Also, move fiq dereferencing out of cycle, since it's
    always constant.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    =====================
    Patchset description:
    
    Relax lock contention and ms fixes
    
    https://pmc.acronis.com/browse/VSTOR-9810
    
    Port some ms fixes and begin first round of relaxing fc->lock contention.
    
    Kirill Tkhai (5):
          fuse: Fix use-after-free in fuse_dev_do_read()
          fuse: Fix use-after-free in fuse_dev_do_write()
          fuse: use list_first_entry() in flush_bg_queue()
          fuse: use READ_ONCE on congestion_threshold and max_background
          fuse: add locking to max_background and congestion_threshold changes
    
    Miklos Szeredi (2):
          fuse: set FR_SENT while locked
          fuse: fix blocked_waitq wakeup
---
 fs/fuse/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 71d862065e6a..03f9acca6e24 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -403,7 +403,7 @@  static void flush_bg_queue(struct fuse_conn *fc, struct fuse_iqueue *fiq)
 	       !list_empty(&fc->bg_queue)) {
 		struct fuse_req *req;
 
-		req = list_entry(fc->bg_queue.next, struct fuse_req, list);
+		req = list_first_entry(&fc->bg_queue, struct fuse_req, list);
 		list_del_init(&req->list);
 		fc->active_background++;