[Devel] [PATCH RHEL7 COMMIT] ms/fuse: Add fuse_inode argument to fuse_prepare_release()
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Apr 30 14:35:37 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 16177c39dec9b574fc03f65d17cd140d10ddd602
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue Apr 30 14:35:35 2019 +0300
ms/fuse: Add fuse_inode argument to fuse_prepare_release()
ms commit ebf84d0c7220
Here is preparation for next patches, which introduce new fi->lock for
protection of ff->write_entry linked into fi->write_files.
This patch just passes new argument to the function.
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/cuse.c | 3 ++-
fs/fuse/dir.c | 6 ++++--
fs/fuse/file.c | 10 ++++++----
fs/fuse/fuse_i.h | 2 +-
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index c1e0dcf281f9..cb338b469574 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -145,10 +145,11 @@ static int cuse_open(struct inode *inode, struct file *file)
static int cuse_release(struct inode *inode, struct file *file)
{
+ struct fuse_inode *fi = get_fuse_inode(inode);
struct fuse_file *ff = file->private_data;
struct fuse_conn *fc = ff->fc;
- fuse_sync_release(ff, file->f_flags);
+ fuse_sync_release(fi, ff, file->f_flags);
fuse_conn_put(fc);
return 0;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 087ea22d66f9..12fc2dd71a5c 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -424,6 +424,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
struct fuse_create_in inarg;
struct fuse_open_out outopen;
struct fuse_entry_out outentry;
+ struct fuse_inode *fi;
struct fuse_file *ff;
/* Userspace expects S_IFREG in create mode */
@@ -489,7 +490,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
&outentry.attr, entry_attr_timeout(&outentry), 0);
if (!inode) {
flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
- fuse_sync_release(ff, flags);
+ fuse_sync_release(NULL, ff, flags);
fuse_queue_forget(fc, forget, outentry.nodeid, 1);
err = -ENOMEM;
goto out_err;
@@ -500,7 +501,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
fuse_invalidate_attr(dir);
err = finish_open(file, entry, generic_file_open, opened);
if (err) {
- fuse_sync_release(ff, flags);
+ fi = get_fuse_inode(inode);
+ fuse_sync_release(fi, ff, flags);
return err;
}
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6bffa1eef4dd..abeb36e5fe8f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -329,7 +329,8 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir)
return 0;
}
-static void fuse_prepare_release(struct fuse_file *ff, int flags, int opcode)
+static void fuse_prepare_release(struct fuse_inode *fi, struct fuse_file *ff,
+ int flags, int opcode)
{
struct fuse_conn *fc = ff->fc;
struct fuse_req *req = ff->reserved_req;
@@ -356,6 +357,7 @@ static void fuse_prepare_release(struct fuse_file *ff, int flags, int opcode)
void fuse_release_common(struct file *file, int opcode)
{
+ struct fuse_inode *fi = get_fuse_inode(file_inode(file));
struct fuse_file *ff;
struct fuse_req *req;
@@ -364,7 +366,7 @@ void fuse_release_common(struct file *file, int opcode)
return;
req = ff->reserved_req;
- fuse_prepare_release(ff, file->f_flags, opcode);
+ fuse_prepare_release(fi, ff, file->f_flags, opcode);
if (ff->flock) {
struct fuse_release_in *inarg = &req->misc.release.in;
@@ -468,11 +470,11 @@ static int fuse_release(struct inode *inode, struct file *file)
return 0;
}
-void fuse_sync_release(struct fuse_file *ff, int flags)
+void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, int flags)
{
WARN_ON(atomic_read(&ff->count) > 1);
fuse_file_list_del(ff);
- fuse_prepare_release(ff, flags, FUSE_RELEASE);
+ fuse_prepare_release(fi, ff, flags, FUSE_RELEASE);
__set_bit(FR_FORCE, &ff->reserved_req->flags);
__clear_bit(FR_BACKGROUND, &ff->reserved_req->flags);
fuse_request_send(ff->fc, ff->reserved_req);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index ee8b367f2956..1597bf3ed1f1 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -854,7 +854,7 @@ struct fuse_file *fuse_file_get(struct fuse_file *ff);
void fuse_file_free(struct fuse_file *ff);
void fuse_finish_open(struct inode *inode, struct file *file);
-void fuse_sync_release(struct fuse_file *ff, int flags);
+void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, int flags);
/**
* Send RELEASE or RELEASEDIR request
More information about the Devel
mailing list