how to retrun different size to different process when I use ecryptfs
Hi
a file named 1.txt ,and the content is 1234,when mounted ecryptfs, size
is 4,after umounted ecryptfs, size is 12288.
I have implemented a feature like this by modify ecryptfs source code:
1:when gedit read this file, return size is 4,and the content is 1234; 2:when some other process read this file, the content is like what
umounted read;
when file is close, I use i_size_write to write back the size of file;
after gedit close the file ,use stat ,size is 4;
after any other process close the file,use stat ,size is 12288;
what I want to ask is how can different size return when differentprocess read size by stat。
i.e:the file size is 100;when process a stats it, return size 1000,and
when process stats it, return size 100;
but when I use stat, it appears that stat direct read cache ,not goes
into ecryptfs's procedure;
thank you!
Quoted 14 lines · zhangzhilei
Hi
a file named 1.txt ,and the content is 1234,when mounted ecryptfs, size
is 4,after umounted ecryptfs, size is 12288.
I have implemented a feature like this by modify ecryptfs source code:
1:when gedit read this file, return size is 4,and the content is 1234; 2:when some other process read this file, the content is like what
umounted read;when file is close, I use i_size_write to write back the size of file; after gedit close the file ,use stat ,size is 4; after any other process close the file,use stat ,size is 12288; what I want to ask is how can different size return when different
Quoted 5 lines
process read size by stat。
i.e:the file size is 100;when process a stats it, return size 1000,and
when process stats it, return size 100;
but when I use stat, it appears that stat direct read cache ,not goes
into ecryptfs's procedure;
This is either a bug or the process seeing the encrypted file size is stat'ing the file in the lower mount point.
Can you please provide the (trimmed, if necessary) strace output of these two processes as they stat(2) the file? Please use the -v option of strace so that we can see the entire struct stat. Thanks!
Tyler