aboutsummaryrefslogtreecommitdiff
path: root/block/export
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2021-06-25 16:23:14 +0200
committerKevin Wolf <kwolf@redhat.com>2021-07-09 12:26:05 +0200
commit9bad96a8cc669a3b399b9d739b505fdc592acaa4 (patch)
treeb1c37733f1ed4ad369027a8ae604972acee87dbe /block/export
parent8fc54f9428b9763f8003bd5f5dd440946210fc80 (diff)
downloadqemu-9bad96a8cc669a3b399b9d739b505fdc592acaa4.zip
qemu-9bad96a8cc669a3b399b9d739b505fdc592acaa4.tar.gz
qemu-9bad96a8cc669a3b399b9d739b505fdc592acaa4.tar.bz2
export/fuse: Give SET_ATTR_SIZE its own branch
In order to support changing other attributes than the file size in fuse_setattr(), we have to give each its own independent branch. This also applies to the only attribute we do support right now. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210625142317.271673-4-mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/export')
-rw-r--r--block/export/fuse.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/block/export/fuse.c b/block/export/fuse.c
index 4068250..26ad644 100644
--- a/block/export/fuse.c
+++ b/block/export/fuse.c
@@ -417,20 +417,22 @@ static void fuse_setattr(fuse_req_t req, fuse_ino_t inode, struct stat *statbuf,
FuseExport *exp = fuse_req_userdata(req);
int ret;
- if (!exp->writable) {
- fuse_reply_err(req, EACCES);
- return;
- }
-
if (to_set & ~FUSE_SET_ATTR_SIZE) {
fuse_reply_err(req, ENOTSUP);
return;
}
- ret = fuse_do_truncate(exp, statbuf->st_size, true, PREALLOC_MODE_OFF);
- if (ret < 0) {
- fuse_reply_err(req, -ret);
- return;
+ if (to_set & FUSE_SET_ATTR_SIZE) {
+ if (!exp->writable) {
+ fuse_reply_err(req, EACCES);
+ return;
+ }
+
+ ret = fuse_do_truncate(exp, statbuf->st_size, true, PREALLOC_MODE_OFF);
+ if (ret < 0) {
+ fuse_reply_err(req, -ret);
+ return;
+ }
}
fuse_getattr(req, inode, fi);