linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce()
@ 2018-10-08 15:24 Jack Wang
  2018-10-15 11:53 ` Jinpu Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Jack Wang @ 2018-10-08 15:24 UTC (permalink / raw)
  To: shli, neilb, linux-raid, linux-kernel; +Cc: Jack Wang

From: Jack Wang <jinpu.wang@profitbricks.com>

After 9e1cc0a54556 ("md: use mddev_suspend/resume instead of ->quiesce()")
We still have similar left in bitmap functions.

Replace quiesce() with mddev_suspend/resume.

Also move md_bitmap_create out of mddev_suspend. and move mddev_resume
after md_bitmap_destroy. as we did in set_bitmap_file.

Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Gioh Kim <gi-oh.kim@profitbricks.com>

---
v3->v2: Drop the change in md_bitmap_resize, as Shaohua noticed
mddev_suspend/resume is supposed to be called with reconfig_mutex hold, it's not
the case here.
v2->v1: add reviewed-by.
---
 drivers/md/md-bitmap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 2fc8c113977f..1cd4f991792c 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2288,9 +2288,9 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
 			goto out;
 		}
 		if (mddev->pers) {
-			mddev->pers->quiesce(mddev, 1);
+			mddev_suspend(mddev);
 			md_bitmap_destroy(mddev);
-			mddev->pers->quiesce(mddev, 0);
+			mddev_resume(mddev);
 		}
 		mddev->bitmap_info.offset = 0;
 		if (mddev->bitmap_info.file) {
@@ -2327,8 +2327,8 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
 			mddev->bitmap_info.offset = offset;
 			if (mddev->pers) {
 				struct bitmap *bitmap;
-				mddev->pers->quiesce(mddev, 1);
 				bitmap = md_bitmap_create(mddev, -1);
+				mddev_suspend(mddev);
 				if (IS_ERR(bitmap))
 					rv = PTR_ERR(bitmap);
 				else {
@@ -2337,11 +2337,12 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
 					if (rv)
 						mddev->bitmap_info.offset = 0;
 				}
-				mddev->pers->quiesce(mddev, 0);
 				if (rv) {
 					md_bitmap_destroy(mddev);
+					mddev_resume(mddev);
 					goto out;
 				}
+				mddev_resume(mddev);
 			}
 		}
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce()
  2018-10-08 15:24 [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce() Jack Wang
@ 2018-10-15 11:53 ` Jinpu Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Jinpu Wang @ 2018-10-15 11:53 UTC (permalink / raw)
  To: Wang Jinpu; +Cc: Shaohua Li, NeilBrown, linux-raid, linux-kernel

On Mon, Oct 8, 2018 at 5:24 PM Jack Wang <xjtuwjp@gmail.com> wrote:
>
> From: Jack Wang <jinpu.wang@profitbricks.com>
>
> After 9e1cc0a54556 ("md: use mddev_suspend/resume instead of ->quiesce()")
> We still have similar left in bitmap functions.
>
> Replace quiesce() with mddev_suspend/resume.
>
> Also move md_bitmap_create out of mddev_suspend. and move mddev_resume
> after md_bitmap_destroy. as we did in set_bitmap_file.
>
> Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
> Reviewed-by: Gioh Kim <gi-oh.kim@profitbricks.com>
>
> ---
> v3->v2: Drop the change in md_bitmap_resize, as Shaohua noticed
> mddev_suspend/resume is supposed to be called with reconfig_mutex hold, it's not
> the case here.
> v2->v1: add reviewed-by.

ping?


-- 
Jack Wang
Linux Kernel Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Tel:       +49 30 577 008  042
Fax:      +49 30 577 008 299
Email:    jinpu.wang@profitbricks.com
URL:      https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg, Christoph Steffens

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce()
  2018-09-28 18:30 ` Shaohua Li
@ 2018-10-08  8:23   ` Jinpu Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Jinpu Wang @ 2018-10-08  8:23 UTC (permalink / raw)
  To: Shaohua Li; +Cc: Wang Jinpu, NeilBrown, linux-raid, linux-kernel

On Fri, Sep 28, 2018 at 8:30 PM Shaohua Li <shli@kernel.org> wrote:
>
> On Thu, Sep 27, 2018 at 10:07:57AM +0200, Jack Wang wrote:
> > From: Jack Wang <jinpu.wang@profitbricks.com>
> >
> > After 9e1cc0a54556 ("md: use mddev_suspend/resume instead of ->quiesce()")
> > We still have similar left in bitmap functions.
> >
> > Replace quiesce() with mddev_suspend/resume.
> >
> > Also move md_bitmap_create out of mddev_suspend. and move mddev_resume
> > after md_bitmap_destroy. as we did in set_bitmap_file.
> >
> > Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
> > Reviewed-by: Gioh Kim <gi-oh.kim@profitbricks.com>
> >
> > ---
> > v2->v1: add reviewed-by.
> > ---
> >  drivers/md/md-bitmap.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> > index 2fc8c113977f..c369f1753ea6 100644
> > --- a/drivers/md/md-bitmap.c
> > +++ b/drivers/md/md-bitmap.c
> > @@ -2123,7 +2123,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
> >       }
> >
> >       if (!init)
> > -             bitmap->mddev->pers->quiesce(bitmap->mddev, 1);
> > +             mddev_suspend(bitmap->mddev);
>
>
> mddev_suspend is supposed to be called with reconfig_mutex hold. At least one
> place this isn't true with this change, for example, raid_preresume doesn't
> call md_bitmap_resize with the lock hold. Could you please double check the
> lock usage?
You're right, I missed this one, will double check.

Thanks for review!



-- 
Jack Wang
Linux Kernel Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Tel:       +49 30 577 008  042
Fax:      +49 30 577 008 299
Email:    jinpu.wang@profitbricks.com
URL:      https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg, Christoph Steffens

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce()
  2018-09-27  8:07 Jack Wang
@ 2018-09-28 18:30 ` Shaohua Li
  2018-10-08  8:23   ` Jinpu Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Shaohua Li @ 2018-09-28 18:30 UTC (permalink / raw)
  To: Jack Wang; +Cc: neilb, linux-raid, linux-kernel, Jack Wang

On Thu, Sep 27, 2018 at 10:07:57AM +0200, Jack Wang wrote:
> From: Jack Wang <jinpu.wang@profitbricks.com>
> 
> After 9e1cc0a54556 ("md: use mddev_suspend/resume instead of ->quiesce()")
> We still have similar left in bitmap functions.
> 
> Replace quiesce() with mddev_suspend/resume.
> 
> Also move md_bitmap_create out of mddev_suspend. and move mddev_resume
> after md_bitmap_destroy. as we did in set_bitmap_file.
> 
> Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
> Reviewed-by: Gioh Kim <gi-oh.kim@profitbricks.com>
> 
> ---
> v2->v1: add reviewed-by.
> ---
>  drivers/md/md-bitmap.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index 2fc8c113977f..c369f1753ea6 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -2123,7 +2123,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
>  	}
>  
>  	if (!init)
> -		bitmap->mddev->pers->quiesce(bitmap->mddev, 1);
> +		mddev_suspend(bitmap->mddev);


mddev_suspend is supposed to be called with reconfig_mutex hold. At least one
place this isn't true with this change, for example, raid_preresume doesn't
call md_bitmap_resize with the lock hold. Could you please double check the
lock usage?
 
>  	store.file = bitmap->storage.file;
>  	bitmap->storage.file = NULL;
> @@ -2239,7 +2239,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
>  
>  	if (!init) {
>  		md_bitmap_unplug(bitmap);
> -		bitmap->mddev->pers->quiesce(bitmap->mddev, 0);
> +		mddev_resume(bitmap->mddev);
>  	}
>  	ret = 0;
>  err:
> @@ -2288,9 +2288,9 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
>  			goto out;
>  		}
>  		if (mddev->pers) {
> -			mddev->pers->quiesce(mddev, 1);
> +			mddev_suspend(mddev);
>  			md_bitmap_destroy(mddev);
> -			mddev->pers->quiesce(mddev, 0);
> +			mddev_resume(mddev);
>  		}
>  		mddev->bitmap_info.offset = 0;
>  		if (mddev->bitmap_info.file) {
> @@ -2327,8 +2327,8 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
>  			mddev->bitmap_info.offset = offset;
>  			if (mddev->pers) {
>  				struct bitmap *bitmap;
> -				mddev->pers->quiesce(mddev, 1);
>  				bitmap = md_bitmap_create(mddev, -1);
> +				mddev_suspend(mddev);
>  				if (IS_ERR(bitmap))
>  					rv = PTR_ERR(bitmap);
>  				else {
> @@ -2337,11 +2337,12 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
>  					if (rv)
>  						mddev->bitmap_info.offset = 0;
>  				}
> -				mddev->pers->quiesce(mddev, 0);
>  				if (rv) {
>  					md_bitmap_destroy(mddev);
> +					mddev_resume(mddev);
>  					goto out;
>  				}
> +				mddev_resume(mddev);
>  			}
>  		}
>  	}
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce()
@ 2018-09-27  8:07 Jack Wang
  2018-09-28 18:30 ` Shaohua Li
  0 siblings, 1 reply; 5+ messages in thread
From: Jack Wang @ 2018-09-27  8:07 UTC (permalink / raw)
  To: shli, neilb, linux-raid, linux-kernel; +Cc: Jack Wang

From: Jack Wang <jinpu.wang@profitbricks.com>

After 9e1cc0a54556 ("md: use mddev_suspend/resume instead of ->quiesce()")
We still have similar left in bitmap functions.

Replace quiesce() with mddev_suspend/resume.

Also move md_bitmap_create out of mddev_suspend. and move mddev_resume
after md_bitmap_destroy. as we did in set_bitmap_file.

Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Gioh Kim <gi-oh.kim@profitbricks.com>

---
v2->v1: add reviewed-by.
---
 drivers/md/md-bitmap.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 2fc8c113977f..c369f1753ea6 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2123,7 +2123,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
 	}
 
 	if (!init)
-		bitmap->mddev->pers->quiesce(bitmap->mddev, 1);
+		mddev_suspend(bitmap->mddev);
 
 	store.file = bitmap->storage.file;
 	bitmap->storage.file = NULL;
@@ -2239,7 +2239,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
 
 	if (!init) {
 		md_bitmap_unplug(bitmap);
-		bitmap->mddev->pers->quiesce(bitmap->mddev, 0);
+		mddev_resume(bitmap->mddev);
 	}
 	ret = 0;
 err:
@@ -2288,9 +2288,9 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
 			goto out;
 		}
 		if (mddev->pers) {
-			mddev->pers->quiesce(mddev, 1);
+			mddev_suspend(mddev);
 			md_bitmap_destroy(mddev);
-			mddev->pers->quiesce(mddev, 0);
+			mddev_resume(mddev);
 		}
 		mddev->bitmap_info.offset = 0;
 		if (mddev->bitmap_info.file) {
@@ -2327,8 +2327,8 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
 			mddev->bitmap_info.offset = offset;
 			if (mddev->pers) {
 				struct bitmap *bitmap;
-				mddev->pers->quiesce(mddev, 1);
 				bitmap = md_bitmap_create(mddev, -1);
+				mddev_suspend(mddev);
 				if (IS_ERR(bitmap))
 					rv = PTR_ERR(bitmap);
 				else {
@@ -2337,11 +2337,12 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
 					if (rv)
 						mddev->bitmap_info.offset = 0;
 				}
-				mddev->pers->quiesce(mddev, 0);
 				if (rv) {
 					md_bitmap_destroy(mddev);
+					mddev_resume(mddev);
 					goto out;
 				}
+				mddev_resume(mddev);
 			}
 		}
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-15 11:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 15:24 [PATCH] md/bitmap: use mddev_suspend/resume instead of ->quiesce() Jack Wang
2018-10-15 11:53 ` Jinpu Wang
  -- strict thread matches above, loose matches on Subject: below --
2018-09-27  8:07 Jack Wang
2018-09-28 18:30 ` Shaohua Li
2018-10-08  8:23   ` Jinpu Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).