This is a discussion on Pls Help: How to write immediately to crypted fs? (cryptoloop) within the Linux Security forums, part of the System Security and Security Related category; Hi, I use the cryptoloop via the losetup (with twofish) to encrypt a partition. Within the encrypted partition I use ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I use the cryptoloop via the losetup (with twofish) to encrypt a partition. Within the encrypted partition I use the ext3 fs, which I've "tuned" with commit=<x>, data=journal, mounted with -o sync etc. But nevertheless the time until a write() from my application is on the disk can be up to 30 seconds?!?! Even a subsequent fsync() from the app doesn't has any effect. So, what happens is like this: 1. losetup /dev/hdaX /dev/loop1 (w/ twofish) 2. mke2fs -t ext3 /dev/loop1 3. mount /dev/loop1 /home 4. Start App 5. fd = open(/home/file.dat) 6. write(fd, data) [6a. fsync(fd)] 7. close(fd) 8. Leave App ... 9. Wait up to X seconds 10. de-energize the system 11. Power-on, boot again 12. /home/file.dat is like before 4. Is this normal??? How can I reduce the time to near null? I think, the lap must be in (?) the loopdevice, because on a plain ext3 partition it seems to work (write immediately). Thanks in advance, Thorben |
|
|||
|
Thorben Suhr wrote:
> Hi, > > I use the cryptoloop via the losetup (with twofish) to encrypt a > partition. Within the encrypted partition I use the ext3 fs, which > I've "tuned" with commit=<x>, data=journal, mounted with -o sync etc. > > But nevertheless the time until a write() from my application is on > the disk can be up to 30 seconds?!?! Even a subsequent fsync() from > the app doesn't has any effect. > > So, what happens is like this: > > 1. losetup /dev/hdaX /dev/loop1 (w/ twofish) > 2. mke2fs -t ext3 /dev/loop1 > 3. mount /dev/loop1 /home > 4. Start App > 5. fd = open(/home/file.dat) > 6. write(fd, data) > [6a. fsync(fd)] > 7. close(fd) > 8. Leave App > ... > 9. Wait up to X seconds > 10. de-energize the system > 11. Power-on, boot again > 12. /home/file.dat is like before 4. > > Is this normal??? How can I reduce the time to near null? Go back and re-read the man page for the open system call (man 2 read). Pay special attention to the comments about the flags O_SYNC, O_DIRECT, and the restrictions on their use. |