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

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


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 at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

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);
-- 
2.15.1



More information about the Devel mailing list