race-condition in ram_fs and fs_query?

Guido Witmond guido at witmond.nl
Mon May 20 14:08:14 CEST 2019


Hi All,

Reading release-notes 18.08 it states that RAM_FS and VFS are supposed 
to be equal.

However, I don't get any errors when I replace my ram_fs config with 
this vfs:

         <start name="pdf_share">
                 <binary name="vfs"/>
                 <resource name="RAM" quantum="128M"/>
                 <provides> <service name="File_system"/> </provides>
                 <config verbose="yes">
                         <vfs>
                                 <ram />
                         </vfs>
                         <default-policy root="/" writeable="yes" />
                 </config>
         </start>

It perfectly reports the filename and contents in the report_rom. :-)



Now the next step: create a dynamic ROM to start the pdf_view component 
on demand. Any pointers to run files that help me get going?

Cheers, Guido.



On 5/20/19 1:27 PM, Guido Witmond wrote:
> Hi Genodians,
> 
> I'm working on my HnH19-project to create a component listening on a 
> shared filesystem to open each pdf file into a separate instance of 
> mupdf. Goal is to tie the share to a linux-vm in vbox so firefox and 
> thunderbird can have a simple 'cp' command to get pdfs rendered outside 
> that vm.
> 
> I add a RAM-FS, FS-QUERY and REPORT-ROM to mupdf.run. The file gets put 
> in the ram-fs, fs-query should pick that up and report it to the 
> report-rom.
> 
>      <start name="pdf_share">
>              <binary name="ram_fs"/>
>              <resource name="RAM" quantum="128M"/>
>              <provides> <service name="File_system"/> </provides>
>              <config verbose="yes">
>                      <default-policy root="/" writeable="yes" />
>              </config>
>      </start>
> 
>      <start name="report_new_pdf">
>              <binary name="report_rom"/>
>              <resource name="RAM" quantum="1M"/>
>              <provides> <service name="Report"/> <service name="ROM"/> 
> </provides>
>              <config verbose="yes"/>
>      </start>
> 
>      <start name="fs_query">
>              <resource name="RAM" quantum="1M"/>
>              <config verbose="yes">
>                      <vfs> <fs writeable="yes"/> </vfs>
>                      <query path="/" content="yes"/>
>              </config>
>      </start>
> 
> I change the test-scenario to copy a pdf into the share and start the 
> pdf-viewer. The viewer picks up the pdf and renders it. So far so good.
> 
> 
> The problem is that while the 'add'-test copies the file, it gets 
> detected by fs_query but fs_query thinks it's gone:
> 
> [init -> test -> add] --- noux started ---
> [init -> fs_query] Error: failed to watch '//foo.pdf'
> [init -> fs_query] Warning: could not obtain content of nonexistent file 
> foo.pdf
> 
> (The error comes from gems/vfs.h L556, the warning from fs_query/main.cc 
> L80.)
> 
> Fs_quey does send a new report but does not show the file, it show an 
> empty directory.
> 
> [init -> report_new_pdf] report 'fs_query -> listing'
> [init -> report_new_pdf]   <listing>
> [init -> report_new_pdf]        <dir path="/"/>
> [init -> report_new_pdf]   </listing>
> 
> However, a ls -laR shows it's there:
> 
> [init -> test -> ls-after] /dest:
> [init -> test -> ls-after] total 1
> [init -> test -> ls-after] drwxr-xr-x 0 root 0    0 Jan  1 00:00 .
> [init -> test -> ls-after] drwxr-xr-x 0 root 0    0 Jan  1 00:00 ..
> [init -> test -> ls-after] -rwxrwxrwx 0 root 0 8192 Jan  1 00:00 foo.pdf
> 
> 
> Now the race condition:
> 
> When I set the fs-query option to show the content to "no", it gives the 
> same error: failed to watch '//foo.pdf' but it now it does send the file 
> name to the report:
> 
> [init -> report_new_pdf]                <file name="foo.pdf"/>
> 
> 
> So it seems that somehow that fs_query watch learns there is a file 
> while the contents are not yet committed. Accessing that triggers a 
> file-not-found error.
> 
> Did I discover a race condition or am I doing something wrong?
> 
> 
> With regards, Guido.
> 
> PS. I added the complete run-file and logs for completeness. (log-1 
> shows the contents-flag to no).
> PPS. I'm testing with Qemu in a linux VM on my AMD nixos host.
> 
> _______________________________________________
> Genode users mailing list
> users at lists.genode.org
> https://lists.genode.org/listinfo/users
> 




More information about the users mailing list