Michael S. Tsirkin
2019-Sep-03 14:12 UTC
[PATCH v3 00/13] virtio-fs: shared file system for virtual machines
On Tue, Sep 03, 2019 at 10:07:52AM -0400, Vivek Goyal wrote:> On Tue, Sep 03, 2019 at 04:31:38AM -0400, Michael S. Tsirkin wrote: > > [..] > > + /* TODO lock */ > > give me pause. > > > > Cleanup generally seems broken to me - what pauses the FS > > I am looking into device removal aspect of it now. Thinking of adding > a reference count to virtiofs device and possibly also a bit flag to > indicate if device is still alive. That way, we should be able to cleanup > device more gracefully.Generally, the way to cleanup things is to first disconnect device from linux so linux won't send new requests, wait for old ones to finish.> > > > What about the rest of TODOs in that file? > > I will also take a closer look at TODOs now. Better device cleanup path > might get rid of some of them. Some of them might not be valid anymore. > > > > > use of usleep is hacky - can't we do better e.g. with a > > completion? > > Agreed. > > Thanks > Vivek
Vivek Goyal
2019-Sep-03 14:18 UTC
[PATCH v3 00/13] virtio-fs: shared file system for virtual machines
On Tue, Sep 03, 2019 at 10:12:16AM -0400, Michael S. Tsirkin wrote:> On Tue, Sep 03, 2019 at 10:07:52AM -0400, Vivek Goyal wrote: > > On Tue, Sep 03, 2019 at 04:31:38AM -0400, Michael S. Tsirkin wrote: > > > > [..] > > > + /* TODO lock */ > > > give me pause. > > > > > > Cleanup generally seems broken to me - what pauses the FS > > > > I am looking into device removal aspect of it now. Thinking of adding > > a reference count to virtiofs device and possibly also a bit flag to > > indicate if device is still alive. That way, we should be able to cleanup > > device more gracefully. > > Generally, the way to cleanup things is to first disconnect device from > linux so linux won't send new requests, wait for old ones to finish.I was thinking of following. - Set a flag on device to indicate device is dead and not queue new requests. Device removal call can set this flag. - Return errors when fs code tries to queue new request. - Drop device creation reference in device removal path. If device is mounted at the time of removal, that reference will still be active and device state will not be cleaned up in kernel yet. - User unmounts the fs, and that will drop last reference to device and will lead to cleanup of in kernel state of the device. Does that sound reasonable. Vivek
Michael S. Tsirkin
2019-Sep-03 17:15 UTC
[PATCH v3 00/13] virtio-fs: shared file system for virtual machines
On Tue, Sep 03, 2019 at 10:18:51AM -0400, Vivek Goyal wrote:> On Tue, Sep 03, 2019 at 10:12:16AM -0400, Michael S. Tsirkin wrote: > > On Tue, Sep 03, 2019 at 10:07:52AM -0400, Vivek Goyal wrote: > > > On Tue, Sep 03, 2019 at 04:31:38AM -0400, Michael S. Tsirkin wrote: > > > > > > [..] > > > > + /* TODO lock */ > > > > give me pause. > > > > > > > > Cleanup generally seems broken to me - what pauses the FS > > > > > > I am looking into device removal aspect of it now. Thinking of adding > > > a reference count to virtiofs device and possibly also a bit flag to > > > indicate if device is still alive. That way, we should be able to cleanup > > > device more gracefully. > > > > Generally, the way to cleanup things is to first disconnect device from > > linux so linux won't send new requests, wait for old ones to finish. > > I was thinking of following. > > - Set a flag on device to indicate device is dead and not queue new > requests. Device removal call can set this flag. > > - Return errors when fs code tries to queue new request. > > - Drop device creation reference in device removal path. If device is > mounted at the time of removal, that reference will still be active > and device state will not be cleaned up in kernel yet. > > - User unmounts the fs, and that will drop last reference to device and > will lead to cleanup of in kernel state of the device. > > Does that sound reasonable. > > VivekJust we aware of the fact that virtio device, all vqs etc will be gone by the time remove returns. -- MST
Apparently Analagous Threads
- [PATCH v3 00/13] virtio-fs: shared file system for virtual machines
- [PATCH v3 00/13] virtio-fs: shared file system for virtual machines
- [PATCH v3 00/13] virtio-fs: shared file system for virtual machines
- [PATCH v3 00/13] virtio-fs: shared file system for virtual machines
- [PATCH v3 00/13] virtio-fs: shared file system for virtual machines