diff mbox series

common/module: fix patient module remover when module is not present

Message ID 20211115232834.4121190-1-mcgrof@kernel.org (mailing list archive)
State New, archived
Headers show
Series common/module: fix patient module remover when module is not present | expand

Commit Message

Luis Chamberlain Nov. 15, 2021, 11:28 p.m. UTC
When module is not present and the open coded patient module
remover is called we'll end up in a loop which never ends.
Fix this.

I actually found this issue not in fstests, but when applying this
open coded solution to blktests. In fstest we tend to only call
module remove when we have a module loaded. blktests is different,
and so I immediately spotted the issue there.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 common/module | 2 ++
 1 file changed, 2 insertions(+)

Comments

Luis Chamberlain Dec. 10, 2021, 7:55 p.m. UTC | #1
Poke

On Mon, Nov 15, 2021 at 03:28:34PM -0800, Luis Chamberlain wrote:
> When module is not present and the open coded patient module
> remover is called we'll end up in a loop which never ends.
> Fix this.
> 
> I actually found this issue not in fstests, but when applying this
> open coded solution to blktests. In fstest we tend to only call
> module remove when we have a module loaded. blktests is different,
> and so I immediately spotted the issue there.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  common/module | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/common/module b/common/module
> index ead0f881..6efab71d 100644
> --- a/common/module
> +++ b/common/module
> @@ -180,6 +180,8 @@ _patient_rmmod()
>  				continue
>  			fi
>  			let max_tries=$max_tries-1
> +		else
> +			break
>  		fi
>  	done
>  
> -- 
> 2.33.0
>
Eryu Guan Dec. 12, 2021, 12:59 p.m. UTC | #2
On Fri, Dec 10, 2021 at 11:55:26AM -0800, Luis Chamberlain wrote:
> Poke

Sorry, it got lost from my to-review queue, applied now, thanks!

Eryu

> 
> On Mon, Nov 15, 2021 at 03:28:34PM -0800, Luis Chamberlain wrote:
> > When module is not present and the open coded patient module
> > remover is called we'll end up in a loop which never ends.
> > Fix this.
> > 
> > I actually found this issue not in fstests, but when applying this
> > open coded solution to blktests. In fstest we tend to only call
> > module remove when we have a module loaded. blktests is different,
> > and so I immediately spotted the issue there.
> > 
> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> > ---
> >  common/module | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/common/module b/common/module
> > index ead0f881..6efab71d 100644
> > --- a/common/module
> > +++ b/common/module
> > @@ -180,6 +180,8 @@ _patient_rmmod()
> >  				continue
> >  			fi
> >  			let max_tries=$max_tries-1
> > +		else
> > +			break
> >  		fi
> >  	done
> >  
> > -- 
> > 2.33.0
> >
diff mbox series

Patch

diff --git a/common/module b/common/module
index ead0f881..6efab71d 100644
--- a/common/module
+++ b/common/module
@@ -180,6 +180,8 @@  _patient_rmmod()
 				continue
 			fi
 			let max_tries=$max_tries-1
+		else
+			break
 		fi
 	done