All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, jack@suse.com
Subject: Re: [PATCH 1/4] vfs: make freeze_super abort when sync_filesystem returns error
Date: Wed, 26 Jan 2022 11:43:50 +0100	[thread overview]
Message-ID: <20220126104350.tk3v4mez37qbr7yx@quack3.lan> (raw)
In-Reply-To: <164316349509.2600168.11461158492068710281.stgit@magnolia>

On Tue 25-01-22 18:18:15, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If we fail to synchronize the filesystem while preparing to freeze the
> fs, abort the freeze.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/super.c |   19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> 
> 
> diff --git a/fs/super.c b/fs/super.c
> index 7af820ba5ad5..f1d4a193602d 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1616,11 +1616,9 @@ static void lockdep_sb_freeze_acquire(struct super_block *sb)
>  		percpu_rwsem_acquire(sb->s_writers.rw_sem + level, 0, _THIS_IP_);
>  }
>  
> -static void sb_freeze_unlock(struct super_block *sb)
> +static void sb_freeze_unlock(struct super_block *sb, int level)
>  {
> -	int level;
> -
> -	for (level = SB_FREEZE_LEVELS - 1; level >= 0; level--)
> +	for (level--; level >= 0; level--)
>  		percpu_up_write(sb->s_writers.rw_sem + level);
>  }
>  
> @@ -1691,7 +1689,14 @@ int freeze_super(struct super_block *sb)
>  	sb_wait_write(sb, SB_FREEZE_PAGEFAULT);
>  
>  	/* All writers are done so after syncing there won't be dirty data */
> -	sync_filesystem(sb);
> +	ret = sync_filesystem(sb);
> +	if (ret) {
> +		sb->s_writers.frozen = SB_UNFROZEN;
> +		sb_freeze_unlock(sb, SB_FREEZE_PAGEFAULT);
> +		wake_up(&sb->s_writers.wait_unfrozen);
> +		deactivate_locked_super(sb);
> +		return ret;
> +	}
>  
>  	/* Now wait for internal filesystem counter */
>  	sb->s_writers.frozen = SB_FREEZE_FS;
> @@ -1703,7 +1708,7 @@ int freeze_super(struct super_block *sb)
>  			printk(KERN_ERR
>  				"VFS:Filesystem freeze failed\n");
>  			sb->s_writers.frozen = SB_UNFROZEN;
> -			sb_freeze_unlock(sb);
> +			sb_freeze_unlock(sb, SB_FREEZE_FS);
>  			wake_up(&sb->s_writers.wait_unfrozen);
>  			deactivate_locked_super(sb);
>  			return ret;
> @@ -1748,7 +1753,7 @@ static int thaw_super_locked(struct super_block *sb)
>  	}
>  
>  	sb->s_writers.frozen = SB_UNFROZEN;
> -	sb_freeze_unlock(sb);
> +	sb_freeze_unlock(sb, SB_FREEZE_FS);
>  out:
>  	wake_up(&sb->s_writers.wait_unfrozen);
>  	deactivate_locked_super(sb);
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2022-01-26 10:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  2:18 [PATCHSET 0/4] vfs: actually return fs errors from ->sync_fs Darrick J. Wong
2022-01-26  2:18 ` [PATCH 1/4] vfs: make freeze_super abort when sync_filesystem returns error Darrick J. Wong
2022-01-26 10:43   ` Jan Kara [this message]
2022-01-26 17:01   ` Christoph Hellwig
2022-01-26  2:18 ` [PATCH 2/4] vfs: make sync_filesystem return errors from ->sync_fs Darrick J. Wong
2022-01-26 10:44   ` Jan Kara
2022-01-26 17:01   ` Christoph Hellwig
2022-01-26  2:18 ` [PATCH 3/4] quota: make dquot_quota_sync " Darrick J. Wong
2022-01-26 10:45   ` Jan Kara
2022-01-26 17:03   ` Christoph Hellwig
2022-01-26  2:18 ` [PATCH 4/4] xfs: return errors in xfs_fs_sync_fs Darrick J. Wong
2022-01-26 10:45   ` Jan Kara
2022-01-26 17:03   ` Christoph Hellwig
2022-01-26  8:21 ` [PATCHSET 0/4] vfs: actually return fs errors from ->sync_fs Christian Brauner
2022-01-26 18:05   ` Darrick J. Wong
2022-01-27  9:11     ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220126104350.tk3v4mez37qbr7yx@quack3.lan \
    --to=jack@suse.cz \
    --cc=djwong@kernel.org \
    --cc=jack@suse.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.