[Devel] [PATCH RHEL7 COMMIT] fuse kio: Do not try to populate fuse_inode::private on second open
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Oct 16 15:37:13 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.8
------>
commit b14c0afdcf8593f91fed0657fbfd1905bee79531
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue Oct 16 15:37:11 2018 +0300
fuse kio: Do not try to populate fuse_inode::private on second open
Introduce flag to mark files served by userspace. It helps kio to understand
it's not needed to send a request to userspace, when private is NULL.
Introducing some special value to encode inodes, served in userspace,
(for example ~0UL), does not look better, since it makes !fi->private checks
more difficult (also we have a lot free bits in inode flags).
Synchronization is "caller owns inode->i_mutex".
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
fs/fuse/fuse_i.h | 3 +++
fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 11 +++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 69dfd0c318fe..d7dd571c08f6 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -147,6 +147,9 @@ enum {
FUSE_I_SIZE_UNSTABLE,
/** i_mtime has been updated locally; a flush to userspace needed */
FUSE_I_MTIME_UPDATED,
+
+ /** kdirect open try has already made */
+ FUSE_I_KIO_OPEN_TRY_MADE,
};
struct fuse_conn;
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 6007768c6f00..85fe69f4db89 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -359,7 +359,7 @@ int kpcs_file_open(struct fuse_conn *fc, struct file *file, struct inode *inode)
struct fuse_inode *fi = get_fuse_inode(inode);
struct pcs_dentry_info *di = fi->private;
struct pcs_mds_fileinfo info;
- int ret;
+ int ret = 0;
if (!S_ISREG(inode->i_mode))
return 0;
@@ -378,7 +378,14 @@ int kpcs_file_open(struct fuse_conn *fc, struct file *file, struct inode *inode)
spin_unlock(&di->lock);
return 0;
}
- return kpcs_do_file_open(fc, file, inode);
+
+ if (!test_bit(FUSE_I_KIO_OPEN_TRY_MADE, &fi->state)) {
+ ret = kpcs_do_file_open(fc, file, inode);
+ if (!ret)
+ set_bit(FUSE_I_KIO_OPEN_TRY_MADE, &fi->state);
+ }
+
+ return ret;
}
void kpcs_inode_release(struct fuse_inode *fi)
More information about the Devel
mailing list