From patchwork Sun Jan 20 15:22:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 2008231 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3D6593FD1A for ; Sun, 20 Jan 2013 15:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752215Ab3ATPWm (ORCPT ); Sun, 20 Jan 2013 10:22:42 -0500 Received: from mail-ee0-f51.google.com ([74.125.83.51]:59803 "EHLO mail-ee0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090Ab3ATPWl (ORCPT ); Sun, 20 Jan 2013 10:22:41 -0500 Received: by mail-ee0-f51.google.com with SMTP id d17so2432295eek.24 for ; Sun, 20 Jan 2013 07:22:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=k7wHt6cYGWJm18ZeD/uQpcxNmIWoaCgGza4M9/0chwE=; b=hzWYeBc5IXSRObimUveCh/cDNMAqkDO/oszVk3kb79koLqWbJYyMynbxhDlJB2X7DZ kowO1T0FsadmZjuQOjy5DkT5FV7tWIL3PzFbaDfYBpU6jbnSfsswQXUr2vJBVrTiTO0l gfRsH7CaZ7asX9w0oyzs+/jqbXLFtkKlAMqwqtNgta3lAAp8y0W1428orXI9uYsA3G4w rSNxlCw+mZnLpxEUcQ/8yuRcr063f6BFfjyhg38dC/ZnGKRnY24zqX05oRn2Qb+ONQTJ 18RrRP6b427+x8iU2xCcBZG3pvkYIMNRF9iE4sbfn3vraodrLc6LajfcEAgUsj6kgf4j Cx6g== X-Received: by 10.14.173.65 with SMTP id u41mr49727444eel.13.1358695360227; Sun, 20 Jan 2013 07:22:40 -0800 (PST) Received: from localhost ([109.110.76.247]) by mx.google.com with ESMTPS id a2sm17828300eeo.1.2013.01.20.07.22.38 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 20 Jan 2013 07:22:39 -0800 (PST) From: Ilya Dryomov To: linux-btrfs@vger.kernel.org Cc: Chris Mason , Stefan Behrens , idryomov@gmail.com Subject: [PATCH 2/5] Btrfs: fix "mutually exclusive op is running" error code Date: Sun, 20 Jan 2013 17:22:29 +0200 Message-Id: <1358695352-7140-3-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1358695352-7140-1-git-send-email-idryomov@gmail.com> References: <1358695352-7140-1-git-send-email-idryomov@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The error code that is returned in response to starting a mutually exclusive operation when there is one already running got silently changed from EINVAL to EINPROGRESS by 5ac00add. Returning EINPROGRESS to, say, add_dev, when rm_dev is running is misleading. Furthermore, the operation itself may want to use EINPROGRESS for other purposes. Signed-off-by: Ilya Dryomov --- fs/btrfs/ioctl.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ab82636..3aebb28 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1337,7 +1337,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); mnt_drop_write_file(file); - return -EINPROGRESS; + return -EINVAL; } mutex_lock(&root->fs_info->volume_mutex); @@ -2193,7 +2193,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); - return -EINPROGRESS; + return -EINVAL; } ret = mnt_want_write_file(file); if (ret) { @@ -2267,7 +2267,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); - return -EINPROGRESS; + return -EINVAL; } mutex_lock(&root->fs_info->volume_mutex); @@ -2304,7 +2304,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); mnt_drop_write_file(file); - return -EINPROGRESS; + return -EINVAL; } mutex_lock(&root->fs_info->volume_mutex);