提交 d9e08399 编写于 作者: B Bob Peterson 提交者: Yang Yingliang

gfs2: report "already frozen/thawed" errors

[ Upstream commit ff132c5f ]

Before this patch, gfs2's freeze function failed to report an error
when the target file system was already frozen as it should (and as
generic vfs function freeze_super does. Similarly, gfs2's thaw function
failed to report an error when trying to thaw a file system that is not
frozen, as vfs function thaw_super does. The errors were checked, but
it always returned a 0 return code.

This patch adds the missing error return codes to gfs2 freeze and thaw.
Signed-off-by: NBob Peterson <rpeterso@redhat.com>
Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3579b3e6
...@@ -1000,11 +1000,13 @@ void gfs2_freeze_func(struct work_struct *work) ...@@ -1000,11 +1000,13 @@ void gfs2_freeze_func(struct work_struct *work)
static int gfs2_freeze(struct super_block *sb) static int gfs2_freeze(struct super_block *sb)
{ {
struct gfs2_sbd *sdp = sb->s_fs_info; struct gfs2_sbd *sdp = sb->s_fs_info;
int error = 0; int error;
mutex_lock(&sdp->sd_freeze_mutex); mutex_lock(&sdp->sd_freeze_mutex);
if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) {
error = -EBUSY;
goto out; goto out;
}
if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) { if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) {
error = -EINVAL; error = -EINVAL;
...@@ -1046,10 +1048,10 @@ static int gfs2_unfreeze(struct super_block *sb) ...@@ -1046,10 +1048,10 @@ static int gfs2_unfreeze(struct super_block *sb)
struct gfs2_sbd *sdp = sb->s_fs_info; struct gfs2_sbd *sdp = sb->s_fs_info;
mutex_lock(&sdp->sd_freeze_mutex); mutex_lock(&sdp->sd_freeze_mutex);
if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN || if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
!gfs2_holder_initialized(&sdp->sd_freeze_gh)) { !gfs2_holder_initialized(&sdp->sd_freeze_gh)) {
mutex_unlock(&sdp->sd_freeze_mutex); mutex_unlock(&sdp->sd_freeze_mutex);
return 0; return -EINVAL;
} }
gfs2_glock_dq_uninit(&sdp->sd_freeze_gh); gfs2_glock_dq_uninit(&sdp->sd_freeze_gh);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册