diff mbox series

[v4,02/17] vfs: add missing blkdev_put() in get_tree_bdev()

Message ID 157009832879.13858.5261547183927327078.stgit@fedora-28 (mailing list archive)
State Superseded, archived
Headers show
Series xfs: mount API patch series | expand

Commit Message

Ian Kent Oct. 3, 2019, 10:25 a.m. UTC
There appear to be a couple of missing blkdev_put() in get_tree_bdev().
---
 fs/super.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong Oct. 3, 2019, 2:56 p.m. UTC | #1
On Thu, Oct 03, 2019 at 06:25:28PM +0800, Ian Kent wrote:
> There appear to be a couple of missing blkdev_put() in get_tree_bdev().

No SOB, not reviewable......

--D

> ---
>  fs/super.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index a7f62c964e58..fd816014bd7d 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1268,6 +1268,7 @@ int get_tree_bdev(struct fs_context *fc,
>  	mutex_lock(&bdev->bd_fsfreeze_mutex);
>  	if (bdev->bd_fsfreeze_count > 0) {
>  		mutex_unlock(&bdev->bd_fsfreeze_mutex);
> +		blkdev_put(bdev, mode);
>  		warnf(fc, "%pg: Can't mount, blockdev is frozen", bdev);
>  		return -EBUSY;
>  	}
> @@ -1276,8 +1277,10 @@ int get_tree_bdev(struct fs_context *fc,
>  	fc->sget_key = bdev;
>  	s = sget_fc(fc, test_bdev_super_fc, set_bdev_super_fc);
>  	mutex_unlock(&bdev->bd_fsfreeze_mutex);
> -	if (IS_ERR(s))
> +	if (IS_ERR(s)) {
> +		blkdev_put(bdev, mode);
>  		return PTR_ERR(s);
> +	}
>  
>  	if (s->s_root) {
>  		/* Don't summarily change the RO/RW state. */
>
Ian Kent Oct. 4, 2019, 6:49 a.m. UTC | #2
On Thu, 2019-10-03 at 07:56 -0700, Darrick J. Wong wrote:
> On Thu, Oct 03, 2019 at 06:25:28PM +0800, Ian Kent wrote:
> > There appear to be a couple of missing blkdev_put() in
> > get_tree_bdev().
> 
> No SOB, not reviewable......

It's not expected to be but is needed if anyone wants to test
the series.

I sent this to Al asking if these are in fact missing.
If they are I expect he will push an update to Linus pretty
quickly.

> 
> --D
> 
> > ---
> >  fs/super.c |    5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/super.c b/fs/super.c
> > index a7f62c964e58..fd816014bd7d 100644
> > --- a/fs/super.c
> > +++ b/fs/super.c
> > @@ -1268,6 +1268,7 @@ int get_tree_bdev(struct fs_context *fc,
> >  	mutex_lock(&bdev->bd_fsfreeze_mutex);
> >  	if (bdev->bd_fsfreeze_count > 0) {
> >  		mutex_unlock(&bdev->bd_fsfreeze_mutex);
> > +		blkdev_put(bdev, mode);
> >  		warnf(fc, "%pg: Can't mount, blockdev is frozen",
> > bdev);
> >  		return -EBUSY;
> >  	}
> > @@ -1276,8 +1277,10 @@ int get_tree_bdev(struct fs_context *fc,
> >  	fc->sget_key = bdev;
> >  	s = sget_fc(fc, test_bdev_super_fc, set_bdev_super_fc);
> >  	mutex_unlock(&bdev->bd_fsfreeze_mutex);
> > -	if (IS_ERR(s))
> > +	if (IS_ERR(s)) {
> > +		blkdev_put(bdev, mode);
> >  		return PTR_ERR(s);
> > +	}
> >  
> >  	if (s->s_root) {
> >  		/* Don't summarily change the RO/RW state. */
> >
Ian Kent Oct. 4, 2019, 6:59 a.m. UTC | #3
On Fri, 2019-10-04 at 14:49 +0800, Ian Kent wrote:
> On Thu, 2019-10-03 at 07:56 -0700, Darrick J. Wong wrote:
> > On Thu, Oct 03, 2019 at 06:25:28PM +0800, Ian Kent wrote:
> > > There appear to be a couple of missing blkdev_put() in
> > > get_tree_bdev().
> > 
> > No SOB, not reviewable......
> 
> It's not expected to be but is needed if anyone wants to test
> the series.
> 
> I sent this to Al asking if these are in fact missing.
> If they are I expect he will push an update to Linus pretty
> quickly.

But he hasn't responded so perhaps I should have annotated
it, just in case ...

> 
> > --D
> > 
> > > ---
> > >  fs/super.c |    5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/super.c b/fs/super.c
> > > index a7f62c964e58..fd816014bd7d 100644
> > > --- a/fs/super.c
> > > +++ b/fs/super.c
> > > @@ -1268,6 +1268,7 @@ int get_tree_bdev(struct fs_context *fc,
> > >  	mutex_lock(&bdev->bd_fsfreeze_mutex);
> > >  	if (bdev->bd_fsfreeze_count > 0) {
> > >  		mutex_unlock(&bdev->bd_fsfreeze_mutex);
> > > +		blkdev_put(bdev, mode);
> > >  		warnf(fc, "%pg: Can't mount, blockdev is frozen",
> > > bdev);
> > >  		return -EBUSY;
> > >  	}
> > > @@ -1276,8 +1277,10 @@ int get_tree_bdev(struct fs_context *fc,
> > >  	fc->sget_key = bdev;
> > >  	s = sget_fc(fc, test_bdev_super_fc, set_bdev_super_fc);
> > >  	mutex_unlock(&bdev->bd_fsfreeze_mutex);
> > > -	if (IS_ERR(s))
> > > +	if (IS_ERR(s)) {
> > > +		blkdev_put(bdev, mode);
> > >  		return PTR_ERR(s);
> > > +	}
> > >  
> > >  	if (s->s_root) {
> > >  		/* Don't summarily change the RO/RW state. */
> > >
Al Viro Oct. 4, 2019, 12:25 p.m. UTC | #4
On Fri, Oct 04, 2019 at 02:59:57PM +0800, Ian Kent wrote:
> On Fri, 2019-10-04 at 14:49 +0800, Ian Kent wrote:
> > On Thu, 2019-10-03 at 07:56 -0700, Darrick J. Wong wrote:
> > > On Thu, Oct 03, 2019 at 06:25:28PM +0800, Ian Kent wrote:
> > > > There appear to be a couple of missing blkdev_put() in
> > > > get_tree_bdev().
> > > 
> > > No SOB, not reviewable......
> > 
> > It's not expected to be but is needed if anyone wants to test
> > the series.
> > 
> > I sent this to Al asking if these are in fact missing.
> > If they are I expect he will push an update to Linus pretty
> > quickly.
> 
> But he hasn't responded so perhaps I should have annotated
> it, just in case ...

Sorry, just getting out of flu ;-/  I'll apply that fix and push out.
diff mbox series

Patch

diff --git a/fs/super.c b/fs/super.c
index a7f62c964e58..fd816014bd7d 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1268,6 +1268,7 @@  int get_tree_bdev(struct fs_context *fc,
 	mutex_lock(&bdev->bd_fsfreeze_mutex);
 	if (bdev->bd_fsfreeze_count > 0) {
 		mutex_unlock(&bdev->bd_fsfreeze_mutex);
+		blkdev_put(bdev, mode);
 		warnf(fc, "%pg: Can't mount, blockdev is frozen", bdev);
 		return -EBUSY;
 	}
@@ -1276,8 +1277,10 @@  int get_tree_bdev(struct fs_context *fc,
 	fc->sget_key = bdev;
 	s = sget_fc(fc, test_bdev_super_fc, set_bdev_super_fc);
 	mutex_unlock(&bdev->bd_fsfreeze_mutex);
-	if (IS_ERR(s))
+	if (IS_ERR(s)) {
+		blkdev_put(bdev, mode);
 		return PTR_ERR(s);
+	}
 
 	if (s->s_root) {
 		/* Don't summarily change the RO/RW state. */