[blivet][rhel7-branch] Try to do fsck if resize fails before giving up (#1251396)

Jiří Konečný jkonecny at redhat.com
Fri Sep 11 10:51:35 UTC 2015


On Fri, 2015-09-11 at 10:53 +0200, Vratislav Podzimek wrote:
> We may need to do fsck in many steps that go one after another -- 
> getting FS
> info, getting FS' minimum size, resize. It's usually not needed to 
> run the fsck
> multiple times so we could, theoretically, hold and check some 
> "fsck_ran" flag,
> but would it always work? A more robust approach seems to be to try 
> to run the
> FS operation and if it fails, try once more this time with a check 
> first. We
> already do this when getting FS info and minimum size so let's do the 
> same when
> doing resize.

Missing Related or Resolved label here.

> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  blivet/formats/fs.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
> index bad4624..7c5f4cd 100644
> --- a/blivet/formats/fs.py
> +++ b/blivet/formats/fs.py
> @@ -523,6 +523,14 @@ class FS(DeviceFormat):
>              raise FSResizeError(e, self.device)
>  
>          if ret:
> +            # fs check may be needed first so give it a try
> +            self.doCheck()
> +            try:
> +                ret = util.run_program([self.resizefsProg] + 
> self.resizeArgs)
> +            except OSError as e:
> +                raise FSResizeError(e, self.device)
> +
> +        if ret:
>              raise FSResizeError("resize failed: %s" % ret, 
> self.device)
>  
>          self.doCheck()

Seems good to me otherwise.
Ack.


More information about the anaconda-patches mailing list