Skip to contentSkip to conversation

Query about fuse ->sync_fs and virtiofs

DISCUSSION Vivek Goyal 3 participants 4 messages Apr 12, 2021 – Apr 14, 2021 VFS

lore
Share & tools
lore
#0 lore raw

Hi Miklos,

Robert Krawitz drew attention to the fact that fuse does not seem to have a ->sync_fs implementation. That probably means that in case of virtiofs, upon sync()/syncfs(), host cache will not be written back to disk. And that's not something people expect.

I read somewhere that fuse did not implement ->sync_fs because file server might not be trusted and it could block sync().

In case of virtiofs, file server is trusted entity (w.r.t guest kernel), so it probably should be ok to implement ->sync_fs atleast for virtiofs?

Was looking for your thoughts on this before I look into implementing it.

Thanks
Vivek

#1 lore raw
Quoted 8 lines · Vivek Goyal

Hi Miklos,

Robert Krawitz drew attention to the fact that fuse does not seem to have a ->sync_fs implementation. That probably means that in case of virtiofs, upon sync()/syncfs(), host cache will not be written back to disk. And that's not something people expect.

Quoted 5 lines

I read somewhere that fuse did not implement ->sync_fs because file server might not be trusted and it could block sync().

In case of virtiofs, file server is trusted entity (w.r.t guest kernel), so it probably should be ok to implement ->sync_fs atleast for virtiofs?

Yes, that looks like a good idea.

Thanks,
Miklos

#2 lore raw
Quoted 9 lines · On Mon, 12 Apr 2021 17:08:26 +0200 Miklos Szeredi <[email protected]> wrote:
Quoted 8 lines · Vivek Goyal

Hi Miklos,

Robert Krawitz drew attention to the fact that fuse does not seem to have a ->sync_fs implementation. That probably means that in case of virtiofs, upon sync()/syncfs(), host cache will not be written back to disk. And that's not something people expect.

Quoted 8 lines
Quoted 5 lines

I read somewhere that fuse did not implement ->sync_fs because file server might not be trusted and it could block sync().

In case of virtiofs, file server is trusted entity (w.r.t guest kernel), so it probably should be ok to implement ->sync_fs atleast for virtiofs?

Yes, that looks like a good idea.

I've started looking into this. First observation is that implementing ->sync_fs() is file server agnostic, so if we want this to only be used by a trusted file server, we need to introduce such a notion in FUSE. Not sure where though... in struct fuse_fs_context maybe ?

Quoted 2 lines

Thanks,
Miklos

#3 lore raw
Quoted 19 lines · Greg Kurz
Quoted 15 lines · On Mon, 12 Apr 2021 17:08:26 +0200 Miklos Szeredi <[email protected]> wrote:
Quoted 13 lines · Vivek Goyal

Hi Miklos,

Robert Krawitz drew attention to the fact that fuse does not seem to have a ->sync_fs implementation. That probably means that in case of virtiofs, upon sync()/syncfs(), host cache will not be written back to disk. And that's not something people expect.

I read somewhere that fuse did not implement ->sync_fs because file server might not be trusted and it could block sync().

In case of virtiofs, file server is trusted entity (w.r.t guest kernel), so it probably should be ok to implement ->sync_fs atleast for virtiofs?

Quoted 7 lines
Quoted 2 lines

Yes, that looks like a good idea.

I've started looking into this. First observation is that implementing ->sync_fs() is file server agnostic, so if we want this to only be used by a trusted file server, we need to introduce such a notion in FUSE. Not sure where though... in struct fuse_fs_context maybe ?

Yep, makes sense.

Thanks,
Miklos