summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-inode-fd-ops.c
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2018-03-26 12:55:12 +0530
committerAmar Tumballi <amarts@redhat.com>2018-04-11 07:03:27 +0000
commit0002c36666c9b043a330ee08533a87fe7fd16491 (patch)
treeebfb62f5aebd7e2212adc0c256c6fc9bdb7641cd /xlators/storage/posix/src/posix-inode-fd-ops.c
parentd206fab73f6815c927a84171ee9361c9b31557b1 (diff)
posix: reserve option behavior is not correct while using fallocate
Problem: storage.reserve option is not working correctly while disk space is allocate throguh fallocate Solution: In posix_disk_space_check_thread_proc after every 5 sec interval it calls posix_disk_space_check to monitor disk space and set the flag in posix priv.In 5 sec timestamp user can create big file with fallocate that can reach posix reserve limit and no error is shown on terminal even limit has reached. To resolve the same call posix_disk_space for every fallocate fop instead to call by a thread after 5 second BUG: 1560411 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Change-Id: I39ba9390e2e6d084eedbf3bcf45cd6d708591577
Diffstat (limited to 'xlators/storage/posix/src/posix-inode-fd-ops.c')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 62f2c2aa1ee..ff82eb19f2d 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -602,6 +602,15 @@ posix_do_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO (fd, out);
priv = this->private;
+
+ /* fallocate case is special so call posix_disk_space_check separately
+ for every fallocate fop instead of calling posix_disk_space with
+ thread after every 5 sec sleep to working correctly storage.reserve
+ option behaviour
+ */
+ if (priv->disk_reserve)
+ posix_disk_space_check (this);
+
DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, ret, ret, out);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);