[Gluster-devel] FOP write success when volume of glusterfs is full with write-behind is on
Raghavendra G
raghavendra at gluster.com
Thu Jan 19 10:17:52 UTC 2017
On Fri, Jan 13, 2017 at 1:48 PM, Lian, George (Nokia - CN/Hangzhou) <
george.lian at nokia.com> wrote:
> Hi,
>
> I try write FOP test on case of volume of gusterfs is full, the detail
> process and some investigation is as the below:
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------
> 1) use dd to write full with volume export
> dd if=/dev/zero of=/mnt/export/large.tar bs=10M count=100000
>
> 2) set write-behind option on
> # echo "asdf" > /mnt/export/test
> #
> No error prompt here, and try cat the file with following information.
> # cat /mnt/export/test
> cat: /mnt/export/test: No such file or directory
>
> # strace echo "asdf" > /mnt/export/test
> write(1, "asdf\n", 5) = 5
> close(1) = -1 ENOSPC (No space left
> on device)
>
> 3) set write-behind option off
> # echo "asdf" > /mnt/export/test
> #-bash: echo: write error: No space left on device
> Have error prompt here.
> # cat /mnt/export/test
> cat: /mnt/export/test: No such file or directory
>
> # strace echo "asdf" > /mnt/export/test
> write(1, "asdf\n", 5) = -1 ENOSPC (No space left
> on device)
> close(1) = 0
> ------------------------------------------------------------
> -------------------------------------------------------------
> In my view , the action of FOP write is right to application.
> But when the write-behind option is set on, the write FOP return success
> but it can't really write to gluster volume.
> It will let application confuse, and it will lead to more application
> issue.
>
> Although the close will return error, but as you know, more application
> will not do close FOP until the application exit,
> In this case, write FOP show success, but when another thread want to read
> it, but it can't read anything.
>
> Do you think it is an issue?
>
No. The behavior of write-behind is posix-complaint. In fact I think this
is the behavior of any write-back cache implementation. As to Posix
compliance, man 2 write has this section:
<man 2 write>
NOTES
Not checking the return value of close() is a common but
nevertheless serious programming error. It is quite possible that errors
on a previous write(2) operation are first reported at the final close().
Not checking the return value when closing the file may lead to silent loss
of data. This can especially be observed with NFS and with disk quota.
A successful close does not guarantee that the data has been
successfully saved to disk, as the kernel defers writes. It is not common
for a file system to flush the buffers when the stream is closed. If you
need to be sure that the data is physically stored use fsync(2). (It will
depend on the disk hardware at this point.)
</man>
If not, do you have any comments for this inconvenient?
>
>
> Best Regards,
> George
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://www.gluster.org/mailman/listinfo/gluster-devel
>
--
Raghavendra G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20170119/a4bce090/attachment.html>
More information about the Gluster-devel
mailing list