[v2,2/4] fs/fuse kio_pcs: handle error of submit_size_grow()

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

Details

Message ID 20180609130725.1576-3-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.
Before continuing write requests, we need to check the procedure size grow was
successful. If the size attribute of a file failed to increase, it makes no
sense to continue to push write requests because they will not be able to
succeed until the file size will match.

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

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 a4064904f963..cd6497080070 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -648,6 +648,7 @@  static void fuse_size_grow_work(struct work_struct *w)
 	struct inode *inode = &di->inode->inode;
 	struct pcs_int_request* ireq, *next;
 	unsigned long long size = 0;
+	int err;
 	LIST_HEAD(to_submit);
 
 	spin_lock(&di->lock);
@@ -667,7 +668,19 @@  static void fuse_size_grow_work(struct work_struct *w)
 	}
 	di->size.required = size;
 	spin_unlock(&di->lock);
-	submit_size_grow(inode, size);
+
+	err = submit_size_grow(inode, size);
+	if (err) {
+		LIST_HEAD(to_fail);
+
+		spin_lock(&di->lock);
+		di->size.required = 0;
+		list_splice_tail_init(&di->size.grow_queue, &to_fail);
+		spin_unlock(&di->lock);
+
+		pcs_ireq_queue_fail(&to_fail, err);
+		return;
+	}
 
 	spin_lock(&di->lock);
 	BUG_ON(di->size.shrink);