diff mbox

[v3,1/2] btrfs: Fail on removing qgroup if del_qgroup_item fails

Message ID d025c09108e653f88202d9f1480748cd42008852.1499941625.git.sargun@sargun.me (mailing list archive)
State New, archived
Headers show

Commit Message

Sargun Dhillon July 14, 2017, 3:12 p.m. UTC
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 | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 4ce351e..3abc517 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1309,6 +1309,9 @@  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,
 					struct btrfs_qgroup_list, next_group);