From patchwork Mon Jan 19 18:01:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 5660081 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 64F189F333 for ; Mon, 19 Jan 2015 18:02:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A60C720451 for ; Mon, 19 Jan 2015 18:02:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5E9F20450 for ; Mon, 19 Jan 2015 18:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752284AbbASSBL (ORCPT ); Mon, 19 Jan 2015 13:01:11 -0500 Received: from cantor2.suse.de ([195.135.220.15]:60454 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751939AbbASSBK (ORCPT ); Mon, 19 Jan 2015 13:01:10 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1C2C4AD94; Mon, 19 Jan 2015 18:01:09 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id C02F5DA9D2; Mon, 19 Jan 2015 19:01:08 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: zab@zabbo.net, David Sterba Subject: [PATCH] btrfs-progs: fix check of running scrub Date: Mon, 19 Jan 2015 19:01:05 +0100 Message-Id: <1421690465-2465-1-git-send-email-dsterba@suse.cz> X-Mailer: git-send-email 2.1.3 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Scrub on multiple devices may report wrong status if scrub finishes early on one of them. Reported-by: Sandy McArthur Jr Signed-off-by: David Sterba --- cmds-scrub.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmds-scrub.c b/cmds-scrub.c index eb50d8a65708..06c2a306f3b2 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -1073,15 +1073,11 @@ static int is_scrub_running_in_kernel(int fd, memset(&sp, 0, sizeof(sp)); sp.scrub_args.devid = di_args[i].devid; ret = ioctl(fd, BTRFS_IOC_SCRUB_PROGRESS, &sp.scrub_args); - if (ret < 0 && errno == ENODEV) - continue; - if (ret < 0 && errno == ENOTCONN) - return 0; if (!ret) return 1; } - return 1; + return 0; } static const char * const cmd_scrub_start_usage[];