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
This commit is contained in:
Mohit Agrawal 2018-03-26 12:55:12 +05:30 committed by Amar Tumballi
parent d206fab73f
commit 0002c36666
2 changed files with 11 additions and 0 deletions

View File

@ -190,4 +190,6 @@ int
posix_check_internal_writes (xlator_t *this, fd_t *fd, int sysfd,
dict_t *xdata);
void
posix_disk_space_check (xlator_t *this);
#endif /* !_POSIX_HANDLE_H */

View File

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