-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some questions #57
Comments
Hi.
|
@SergeiShtepa thanks for reply
|
I apologize for the late response.
I mean duplicating the entire block device with btrfs. In its simplest form, it can be a "dd" call. I don't see any other ways to use btrfs together with btrfs. And if we remember that btrfs can be located on several devices, then the desire to invent something disappears. I think, if someone wants to use btrfs, then let them use their own snapshots.
No, copying is done only once. A chunk is copied to the difference storage once for the entire chunk. So, the users of the Round Robin Database should be happy. |
@SergeiShtepa thanks for reply
sorry if I still have a doubt, probably I not explained good or I should test better or ext4 write to different position more like cow filesystem like btrfs (and I don't remember good), because overriding the same files I had the difference storage that seems continue to increase at the "full" size that write even if probably with the same position (or at least partially). EDIT:
didn't created 5 diff storage of 1gb so my doubt was wrong |
@SergeiShtepa I did other tests and when I tried to delete diff storage files before snapshot destroy and I not found error or other logs related to this (in kern.log) and also stretch service seems didn't manage this unexpected cases EDIT: |
Hi! Of course, the problem of unexpected deletion of difference storage files exists. The module cannot use these files using the file system. Files are just one way to reserve an area of disk space. The module works with disk areas directly .
Alas, this is not the solution to the problem. If the file was deleted while holding the snapshot, then the file system may already be damaged. This should not be allowed. And the file can be overwritten by someone, or simply transferred during defragmentation. We can't control that. The only way to prevent the file from being deleted or moved is to set the immutable flag on it (FS_IMMUTABLE_FL). I plan to add this code. If there are any other ideas about this, I will be glad to know them. Hmm... Probably we need to see how such a problem is solved for loop devices. But on the other hand, nothing prevents from reserving a disk area otherwise, for example, a partition for difference storage may be allocated. The blksnap tool supports this. This is a safer, but less user-friendly way. P.S.: |
The chunk will store in the difference storage only the data that was on the disk before the snapshot was created. Only this data is needed for the snapshot image. If the data is repeatedly overwritten while the snapshot is being held, the module simply skips these requests. See diff_area_copy(). |
I saw this and related to this as wrote I don't have idea how can be possible protected from this on kernel side, probably is not possible. Probably can be good write on patch serie mail asking if someone have an idea.
May be useful asking on mail of patch serie also if someone have better idea to solve/improve it on tool side.
yes should be tested (is not on tests I did for now) for know if improvement is needed or if not possible have it working document it (for example in Documentation/block/blksnap.rst#difference-storage) |
Sorry, late to the party.
Drop the I don't like the FS_IMMUTABLE_FL too much.
I think, if the kernel module wants to use the file, it has to keep it open. |
Hi @buczek . I agree that the use of "FS_IMMUTABLE_FL" does not protect against deliberate destructive actions of the user. I have doubts that this is a problem. Support flag "FS_IMMUTABLE_FL" by not all file systems does not bother me for the reason that fallocate, FSMAP and FIEMAP requests are supported essentially only by EXT4 and XFS (and BTRFS with some features). The variant to use a loop device will not allow to determine which request to the disk is being made from applications, and which from the blksnap module itself when accessing the difference storage. Now the 'BIO_FILTERED' flag for 'bio' is used for this. Now a one request is being used to add area to the difference storage, regardless of whether it is a file or just a part of the disk. It seems to me that a special request 'IOCTL_BLKSNAP_SNAPSHOT_APPEND_FILE', similar to the request 'IOCTL_BLKSNAP_SNAPSHOT_APPEND_STORAGE', can be made. The input parameter for it will be a file descriptor (as for the loop devices). The module will keep it in exclusive access. At the same time, the module will have to request its location on the block device for the file itself by calling FSMAP, since the module will not be able to write data through the file system anyway. What do you think? Will such a new request solve the problem in full? Don't you think it's too difficult to execute an FSMAP request from the kernel module? I would like to keep the kernel module code simple. |
Or the accidental destructive action by the user or one of the tools the user is using, which also uses the
Oh, that's correct and unfortunately, I don't have any idea for another solution.
I'm not familiar enough with the blksnap code or block I/O in general to give recommendations. All my thoughts might be totally of track, just for you to consider, but feel free to ignore :-) Generally, I agree, that the code should be kept as simple as possible. So, no, I wouldn't vote for alternatives, unless another approach turn out to be superior (and works in the first place) but the old approach has to be kept as deprecated because of existing users. |
Thank you so much for your opinion. I have prepared a v4 patch . I plan to send it soon. it will be possible to discuss this issue in a wider circle. I will start an issue so as not to forget to try to implement a new ioctl. |
Hi, before I did only very fast "superficial" tests, today I started to do some more deep testing, I'll post here some questions based on tests I did.
The diff storage contain any difference without check if the "chunk" of same position of device was already present on same snapshot and override it right? (I mean if after snapshot_take same device part is "overwritten" more times is stored any time) I not checked good in kernel patch but from what seems from a look look seems.
Can seems strange but I tested snapshot also on btrfs, I think blksnap can be useful also with that in some cases, trying to mount the blksnap snapshot fails (seems for check that do for multiple device support):
Is there a safe way to mount blksnap snapshot done on btrfs block device?
Thanks for any reply and sorry for my bad english.
The text was updated successfully, but these errors were encountered: