[RH7,1/5] ploop: Clear PLOOP_S_NO_FALLOC_DISCARD on restart

Submitted by Kirill Tkhai on Aug. 27, 2020, 3:40 p.m.

Details

Message ID 159854285062.335074.12122690562392675423.stgit@localhost.localdomain
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Aug. 27, 2020, 3:40 p.m.
It looks there is no a better place to do that,
since we do not remove device after it becomes
unused (stop+last delta is removed).

This is indicator of cached ploop device was reused
for another mount.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/dev.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 197faa5db05d..64127fa10c45 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3420,8 +3420,10 @@  static int ploop_add_delta(struct ploop_device * plo, unsigned long arg)
 	if (err)
 		goto out_destroy;
 
-	if (list_empty(&plo->map.delta_list))
+	if (list_empty(&plo->map.delta_list)) {
 		plo->fmt_version = PLOOP_FMT_UNDEFINED;
+		clear_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
+	}
 
 	err = delta->ops->open(delta);
 	if (err)

Comments

Kirill Tkhai Aug. 27, 2020, 3:44 p.m.
https://jira.sw.ru/browse/PSBM-105347

On 27.08.2020 18:40, Kirill Tkhai wrote:
> It looks there is no a better place to do that,
> since we do not remove device after it becomes
> unused (stop+last delta is removed).
> 
> This is indicator of cached ploop device was reused
> for another mount.
> 
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> ---
>  drivers/block/ploop/dev.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index 197faa5db05d..64127fa10c45 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -3420,8 +3420,10 @@ static int ploop_add_delta(struct ploop_device * plo, unsigned long arg)
>  	if (err)
>  		goto out_destroy;
>  
> -	if (list_empty(&plo->map.delta_list))
> +	if (list_empty(&plo->map.delta_list)) {
>  		plo->fmt_version = PLOOP_FMT_UNDEFINED;
> +		clear_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
> +	}
>  
>  	err = delta->ops->open(delta);
>  	if (err)
> 
>