linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Report error on removing qgroup if del_qgroup_item fails
@ 2017-09-17  9:02 Sargun Dhillon
  2017-09-17 12:25 ` Qu Wenruo
  0 siblings, 1 reply; 2+ messages in thread
From: Sargun Dhillon @ 2017-09-17  9:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, quwenruo

Previously, we were calling del_qgroup_item, and ignoring the return code
resulting in a potential to have divergent in-memory state without an
error. Perhaps, it makes sense to handle this error code, and put the
filesystem into a read only, or similar state.

This patch only adds reporting of the error if the error is fatal,
(any error other than qgroup not found).

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
---
 fs/btrfs/qgroup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 770f667269f5..e172d4843eae 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1305,6 +1305,8 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans,
 		}
 	}
 	ret = del_qgroup_item(trans, quota_root, qgroupid);
+	if (ret && ret != -ENOENT)
+		goto out;
 
 	while (!list_empty(&qgroup->groups)) {
 		list = list_first_entry(&qgroup->groups,
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: Report error on removing qgroup if del_qgroup_item fails
  2017-09-17  9:02 [PATCH] btrfs: Report error on removing qgroup if del_qgroup_item fails Sargun Dhillon
@ 2017-09-17 12:25 ` Qu Wenruo
  0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2017-09-17 12:25 UTC (permalink / raw)
  To: Sargun Dhillon, linux-btrfs; +Cc: dsterba, quwenruo



On 2017年09月17日 17:02, Sargun Dhillon wrote:
> Previously, we were calling del_qgroup_item, and ignoring the return code
> resulting in a potential to have divergent in-memory state without an
> error. Perhaps, it makes sense to handle this error code, and put the
> filesystem into a read only, or similar state.
> 
> This patch only adds reporting of the error if the error is fatal,
> (any error other than qgroup not found).
> 
> Signed-off-by: Sargun Dhillon <sargun@sargun.me>

Looks good to me.

Reviewed-by: Qu Wenruo <quwenruo.btrfs@gmx.com>

Thanks,
Qu

> ---
>   fs/btrfs/qgroup.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 770f667269f5..e172d4843eae 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1305,6 +1305,8 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans,
>   		}
>   	}
>   	ret = del_qgroup_item(trans, quota_root, qgroupid);
> +	if (ret && ret != -ENOENT)
> +		goto out >
>   	while (!list_empty(&qgroup->groups)) {
>   		list = list_first_entry(&qgroup->groups,
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-17 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-17  9:02 [PATCH] btrfs: Report error on removing qgroup if del_qgroup_item fails Sargun Dhillon
2017-09-17 12:25 ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).