[Devel] [PATCH RHEL7 COMMIT] ms/fuse: Protect ff->reserved_req via corresponding fi->lock

Konstantin Khorenko khorenko at virtuozzo.com
Tue Apr 30 14:35:39 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.1.vz7.95.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.1.vz7.95.2
------>
commit 23199e5387ea7be744270d4c606fa04cee5bc680
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Apr 30 14:35:37 2019 +0300

    ms/fuse: Protect ff->reserved_req via corresponding fi->lock
    
    ms commit 6b675738ce90
    
    This is rather natural action after previous patches, and it just decreases
    load of fc->lock.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Signed-off-by: Miklos Szeredi <mszeredi at redhat.com>
    
    =====================
    Patchset description:
    
    fuse: Backport of ms locking patches part 2
    
    Here is backport of locking patches: introducing of fc->bg_lock and fi->lock.
    
    This may need additional changes for kio and NOT verified for fast-path.
    
    Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    
    Kirill Tkhai (9):
          fuse: introduce fc->bg_lock
          fuse: Remove bogus list_del_init() from-fuse_request_send_background
          fuse: do not take fc->lock in fuse_request_send_background()
          fuse: Add fuse_inode argument to fuse_prepare_release()
          fuse: Convert fc->attr_version into atomic64_t
          fuse: Introduce fi->lock to protect write related fields
          fuse: Protect fi->nlookup with fi->lock
          fuse: Protect ff->reserved_req via corresponding fi->lock
          fuse: do not take fc->lock in fuse_request_send_background() - fixup
---
 fs/fuse/dev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 1355f4a0a8e4..d10e7edd8711 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -238,16 +238,17 @@ static struct fuse_req *get_reserved_req(struct fuse_conn *fc,
 {
 	struct fuse_req *req = NULL;
 	struct fuse_file *ff = file->private_data;
+	struct fuse_inode *fi = get_fuse_inode(file_inode(file));
 
 	do {
 		wait_event(fc->reserved_req_waitq, ff->reserved_req);
-		spin_lock(&fc->lock);
+		spin_lock(&fi->lock);
 		if (ff->reserved_req) {
 			req = ff->reserved_req;
 			ff->reserved_req = NULL;
 			req->stolen_file = get_file(file);
 		}
-		spin_unlock(&fc->lock);
+		spin_unlock(&fi->lock);
 	} while (!req);
 
 	return req;
@@ -260,13 +261,14 @@ static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req)
 {
 	struct file *file = req->stolen_file;
 	struct fuse_file *ff = file->private_data;
+	struct fuse_inode *fi = get_fuse_inode(file_inode(file));
 
-	spin_lock(&fc->lock);
+	spin_lock(&fi->lock);
 	fuse_request_init(fc, req, req->pages, req->page_descs, req->max_pages);
 	BUG_ON(ff->reserved_req);
 	ff->reserved_req = req;
 	wake_up_all(&fc->reserved_req_waitq);
-	spin_unlock(&fc->lock);
+	spin_unlock(&fi->lock);
 	fput(file);
 }
 



More information about the Devel mailing list