Re: [PATCH v2 2/2] mm/swapfile: release swap info when swap device is unpluged

From: Miaohe Lin
Date: Thu Jun 16 2022 - 03:00:39 EST


On 2022/6/15 19:22, Christoph Hellwig wrote:
> Sorry, but this is simply broken. We can't just do d_path magic
> here. That being said the problem is real, and I think the right
> answer is to offer a swapoff variant that doesn't need to open the
> underlying device or file, but useѕ some kind of handle. I'm just

When swap device is unplugged, the swap_file->f_path.dentry will be in the
d_unlinked() status. Could we use it to detect the problem instead? IMHO, we
can found the unplugged swap devices this way and further get the right swap
device to swapoff through comparing the swap device name with @specialfile.
Or am I miss something?

> not sure what would be a good handle here.

Using handle sounds like a good idea too. :) But can the above solution be acceptable?

> .
>

Thanks!