fuse: optimize fallocate on permanent failure
If userspace filesystem doesn't support fallocate, remember this and don't send
request next time.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index e3fee88..bbfd571 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2185,6 +2185,9 @@
};
int err;
+ if (fc->no_fallocate)
+ return -EOPNOTSUPP;
+
req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);
@@ -2196,6 +2199,10 @@
req->in.args[0].value = &inarg;
fuse_request_send(fc, req);
err = req->out.h.error;
+ if (err == -ENOSYS) {
+ fc->no_fallocate = 1;
+ err = -EOPNOTSUPP;
+ }
fuse_put_request(fc, req);
return err;