[linux-lvm] [PATCH] [PATCH] stable-2.02 - lvresize: deny operation on swap dev without force option

heming.zhao at suse.com heming.zhao at suse.com
Wed Mar 24 11:02:55 UTC 2021


On 3/24/21 5:07 PM, Zdenek Kabelac wrote:
> 
> 
> ----- Original Message -----
> From: "Zhao Heming" <heming.zhao at suse.com>
> To: linux-lvm at redhat.com, zkabelac at redhat.com, teigland at redhat.com
> Cc: "Zhao Heming" <heming.zhao at suse.com>
> Sent: Wednesday, March 24, 2021 6:09:09 AM
> Subject: [PATCH] [PATCH] stable-2.02 - lvresize: deny operation on swap dev without force option
> 
> When lvmetad is active on system and some memory pages of lvmetad
> swapout, user may issue lvextend/lvresize on swap LV. The resize
> operation will suspend & resume swap device (by reload dm table).
> After suspended swap device, lvmetad will be in UN status for waiting
> swapin pages from suspended swap dev. lvmetad will hung, then
> lvresize will fail to conection to lvmetad. then the resize operation
> will fail, lvresize leaves suspended swap, the logic dead lock is
> happending.
> 
>   
> Hi
> 
> It seems there is something wrong elsewhere.
> There should be no contact to lvmetad while ANY devices are in suspend state.
> Maybe something got reshuffled into wrong place.
> 
> Can you please provide  'lvextend -vvvvv'  when it hangs ?
> 

I can't show your "-vvvvv", the issue was reported from one suse customer.
the syslog shows machine was running lvextend at the start time of lvmetad UN.
the machine running lvm2 version is 2.02.120. some code may different with latest stable-2.02 branch.
the machine became no response and triggered coredump later.

> There should be no contact to lvmetad while ANY devices are in suspend state.

lvextend promise itself doesn't need to contact lvmetad. and if my understanding is correct,
critical_section_inc() is only process internal protection. if another lvm2 cmd calling
lvmetad when lvextend executing, the story will happen on my way.

(in my opinion) the flow:
1. lvmetad some page swapped out
2. lvextend was running, swap device was suspended successfully. (enter critical section)
3. lvmetad kept running (by whatever calling)
4. lvmetad need to swap in some pages but swap device suspended. lvmetad status become UN.
5. the lvextend resumed suspended swap device but failed.
    I guess lvmetad UN may trigger/block kernel dm layer failed to resume. I can't find log/info
    to show the reason of resume failed. From the coredump, lvmetad stacks show lvmetad in
    UN state, and swap status is suspended (dm dev with flags: DMF_BLOCK_IO_FOR_SUSPEND, DMF_SUSPENDED).

Thanks,
heming




More information about the linux-lvm mailing list