Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422849AbcKPWaF (ORCPT ); Wed, 16 Nov 2016 17:30:05 -0500 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:48142 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938317AbcKPWYG (ORCPT ); Wed, 16 Nov 2016 17:24:06 -0500 x-originating-ip: 72.167.245.219 From: Matthew Wilcox To: linux-kernel@vger.kernel.org, Andrew Morton , Konstantin Khlebnikov , Ross Zwisler Cc: linux-fsdevel@vger.kernel.org, Matthew Wilcox , linux-mm@kvack.org, "Kirill A . Shutemov" Subject: [PATCH 18/29] btrfs: Fix race in btrfs_free_dummy_fs_info() Date: Wed, 16 Nov 2016 16:17:21 -0800 Message-Id: <1479341856-30320-57-git-send-email-mawilcox@linuxonhyperv.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> X-CMAE-Envelope: MS4wfBGzj7szfEWrsrJyWSPt3WE0BzMWXUn9UQzCodZilZ8Rqwo3A8lJel5uM5XSE+QF+RnEYMjC91y5cARd/Pvu+0f7skwUQkdT6m099GclRZu0MXI9HY6w /vzWehVI9cO3T9fTLqLX8ybvMuy5INroc7OBBmK4+bI0xAqPQUJzKsrNYdB03lV1a7HjA1b4t4sEU8hv50QYdj9L7a721jp4l2aBYFeuKMGv2BH4iDVSJodc AFBZAydNNi3ofT8kJSp5uEamX0C+gpoSI2SkfVq1EO6aGzfw0dEao08GK3mDCondKbD0UCXKYFhPzqWn7SgS3Y0vnzG9ZSPEM5PKduUwmJA43P6krPb28tnX gz/QXDgCzurgSox7cEkili0p2lRRpR9VbmlXHGFTF2HcKO6PP/izX2io7XotAtSogQ4SYaxXW2AUf6b/oCkNobspzNGIsxNjKXpxkO1QYitoP5wWoW0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 815 Lines: 25 From: Matthew Wilcox We drop the lock which protects the radix tree, so we must call radix_tree_iter_next() in order to avoid a modification to the tree invalidating the iterator state. Signed-off-by: Matthew Wilcox --- fs/btrfs/tests/btrfs-tests.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c index bf62ad9..73076a0 100644 --- a/fs/btrfs/tests/btrfs-tests.c +++ b/fs/btrfs/tests/btrfs-tests.c @@ -162,6 +162,7 @@ void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info) slot = radix_tree_iter_retry(&iter); continue; } + slot = radix_tree_iter_next(&iter); spin_unlock(&fs_info->buffer_lock); free_extent_buffer_stale(eb); spin_lock(&fs_info->buffer_lock); -- 2.10.2