btrfs: do not consider send context as valid when trying to flush qgroups
[sfrench/cifs-2.6.git] / fs / btrfs / qgroup.c
index 2319c923c9e6993019f88ad9fff8686690373232..b1caf5acf1e2c6ade5a020d58fe2a36364eedb63 100644 (file)
@@ -3545,11 +3545,15 @@ static int try_flush_qgroup(struct btrfs_root *root)
        struct btrfs_trans_handle *trans;
        int ret;
 
-       /* Can't hold an open transaction or we run the risk of deadlocking */
-       ASSERT(current->journal_info == NULL ||
-              current->journal_info == BTRFS_SEND_TRANS_STUB);
-       if (WARN_ON(current->journal_info &&
-                   current->journal_info != BTRFS_SEND_TRANS_STUB))
+       /*
+        * Can't hold an open transaction or we run the risk of deadlocking,
+        * and can't either be under the context of a send operation (where
+        * current->journal_info is set to BTRFS_SEND_TRANS_STUB), as that
+        * would result in a crash when starting a transaction and does not
+        * make sense either (send is a read-only operation).
+        */
+       ASSERT(current->journal_info == NULL);
+       if (WARN_ON(current->journal_info))
                return 0;
 
        /*