[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch
From: |
Kevin Wolf |
Subject: |
[PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch |
Date: |
Fri, 9 Jul 2021 14:50:19 +0200 |
From: Max Reitz <mreitz@redhat.com>
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>
---
block/export/fuse.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/block/export/fuse.c b/block/export/fuse.c
index 4068250241..26ad644cd7 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);
--
2.31.1
- [PULL 02/28] block/rbd: Add support for rbd image encryption, (continued)
- [PULL 02/28] block/rbd: Add support for rbd image encryption, Kevin Wolf, 2021/07/09
- [PULL 03/28] block/rbd: bump librbd requirement to luminous release, Kevin Wolf, 2021/07/09
- [PULL 04/28] block/rbd: store object_size in BDRVRBDState, Kevin Wolf, 2021/07/09
- [PULL 05/28] block/rbd: update s->image_size in qemu_rbd_getlength, Kevin Wolf, 2021/07/09
- [PULL 06/28] block/rbd: migrate from aio to coroutines, Kevin Wolf, 2021/07/09
- [PULL 07/28] block/rbd: add write zeroes support, Kevin Wolf, 2021/07/09
- [PULL 08/28] block/rbd: drop qemu_rbd_refresh_limits, Kevin Wolf, 2021/07/09
- [PULL 09/28] util/uri: do not check argument of uri_free(), Kevin Wolf, 2021/07/09
- [PULL 10/28] export/fuse: Pass default_permissions for mount, Kevin Wolf, 2021/07/09
- [PULL 11/28] export/fuse: Add allow-other option, Kevin Wolf, 2021/07/09
- [PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch,
Kevin Wolf <=
- [PULL 13/28] export/fuse: Let permissions be adjustable, Kevin Wolf, 2021/07/09
- [PULL 14/28] iotests/308: Test +w on read-only FUSE exports, Kevin Wolf, 2021/07/09
- [PULL 15/28] iotests/fuse-allow-other: Test allow-other, Kevin Wolf, 2021/07/09
- [PULL 17/28] MAINTAINERS: add block/rbd.c reviewer, Kevin Wolf, 2021/07/09
- [PULL 16/28] block/rbd: fix type of task->complete, Kevin Wolf, 2021/07/09
- [PULL 19/28] blockdev: fix drive-backup transaction endless drained section, Kevin Wolf, 2021/07/09
- [PULL 20/28] qcow2: Prohibit backing file changes in 'qemu-img amend', Kevin Wolf, 2021/07/09
- [PULL 18/28] vhost-user: Fix backends without multiqueue support, Kevin Wolf, 2021/07/09
- [PULL 21/28] qemu-img: Require -F with -b backing image, Kevin Wolf, 2021/07/09
- [PULL 22/28] qemu-img: Improve error for rebase without backing format, Kevin Wolf, 2021/07/09