Reading the quota tree root may fail with ENOENT
if there is no quota, which is fine, but the code was
ignoring every other error as well, which is not fine.

Signed-off-by: Eric Sandeen <[email protected]>
---
 fs/btrfs/disk-io.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e6746be..28d35a8 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2733,7 +2733,12 @@ retry_root_backup:
 
        location.objectid = BTRFS_QUOTA_TREE_OBJECTID;
        quota_root = btrfs_read_tree_root(tree_root, &location);
-       if (!IS_ERR(quota_root)) {
+       if (IS_ERR(quota_root)) {
+               ret = PTR_ERR(quota_root);
+               /* It's fine to not have quotas */
+               if (ret != -ENOENT)
+                       goto recovery_tree_root;
+       } else {
                set_bit(BTRFS_ROOT_TRACK_DIRTY, &quota_root->state);
                fs_info->quota_enabled = 1;
                fs_info->pending_quota_state = 1;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to