[Devel] [PATCH v2 4/4] fs/fuse kio_pcs: pass the file handle for FUSE_SETATTR request

Pavel Butsykin pbutsykin at virtuozzo.com
Sat Jun 9 16:07:25 MSK 2018


Add to pass the file handle (if it is) for FUSE_SETATTR request inside
submit_size_grow().

Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index cd6497080070..af82b043f786 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -602,6 +602,7 @@ void ireq_destroy(struct pcs_int_request *ireq)
 static int submit_size_grow(struct inode *inode, unsigned long long size)
 {
 	struct fuse_conn *fc = get_fuse_conn(inode);
+	struct fuse_file *ff;
 	struct fuse_setattr_in inarg;
 	struct fuse_attr_out outarg;
 	struct fuse_req *req;
@@ -624,6 +625,11 @@ static int submit_size_grow(struct inode *inode, unsigned long long size)
 	inarg.valid |= FATTR_SIZE;
 	inarg.size = size;
 
+	ff = fuse_write_file(fc, get_fuse_inode(inode));
+	if (ff) {
+		inarg.valid |= FATTR_FH;
+		inarg.fh = ff->fh;
+	}
 	req->io_inode = inode;
 	req->in.h.opcode = FUSE_SETATTR;
 	req->in.h.nodeid = get_node_id(inode);
@@ -635,7 +641,9 @@ static int submit_size_grow(struct inode *inode, unsigned long long size)
 	req->out.args[0].value = &outarg;
 
 	fuse_request_send(fc, req);
+
 	err = req->out.h.error;
+	fuse_release_ff(inode, ff);
 	fuse_put_request(fc, req);
 
 	return err;
-- 
2.15.1



More information about the Devel mailing list