[Devel] [PATCH RHEL7 COMMIT] ms/fuse: use READ_ONCE on congestion_threshold and max_background

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 4 12:31:21 MSK 2018


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 b9765b8c48643c1e8e180ba56f278c01ac0eb1f0
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Oct 4 12:31:20 2018 +0300

    ms/fuse: use READ_ONCE on congestion_threshold and max_background
    
    Since they are of unsigned int type, it's allowed to read them
    unlocked during reporting to userspace. Let's underline this fact
    with READ_ONCE() macroses.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    Signed-off-by: Miklos Szeredi <mszeredi at 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/control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 5f74b50d6ce8..9a072ff3c0cd 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -108,7 +108,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file,
 	if (!fc)
 		return 0;
 
-	val = fc->max_background;
+	val = READ_ONCE(fc->max_background);
 	fuse_conn_put(fc);
 
 	return fuse_conn_limit_read(file, buf, len, ppos, val);
@@ -145,7 +145,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file,
 	if (!fc)
 		return 0;
 
-	val = fc->congestion_threshold;
+	val = READ_ONCE(fc->congestion_threshold);
 	fuse_conn_put(fc);
 
 	return fuse_conn_limit_read(file, buf, len, ppos, val);



More information about the Devel mailing list