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

Submitted by Pavel Butsykin on June 9, 2018, 1:07 p.m.

Details

Message ID 20180609130725.1576-5-pbutsykin@virtuozzo.com
State New
Series "fuse_kdirect: fsync hungs after unlink fixes"
Headers show

Commit Message

Pavel Butsykin June 9, 2018, 1:07 p.m.
Add to pass the file handle (if it is) for FUSE_SETATTR request inside
submit_size_grow().

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

Patch hide | download patch | download mbox

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;