From patchwork Thu Aug 2 23:16:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Block X-Patchwork-Id: 1268261 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C5CC1DF223 for ; Thu, 2 Aug 2012 23:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754073Ab2HBXQb (ORCPT ); Thu, 2 Aug 2012 19:16:31 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:62997 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753613Ab2HBXQb (ORCPT ); Thu, 2 Aug 2012 19:16:31 -0400 Received: by weyx8 with SMTP id x8so47314wey.19 for ; Thu, 02 Aug 2012 16:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=2ViIEP3vqV/pH7GQfI+z4pH0EwUX4KIH9+7nv5ADUTE=; b=hyXJ0EkbDeiDFyxPZylXvv5Nk4oQNklFpbEurnGQJgTh+orYUsISjD2tv1vvHQlvU3 f7ftDxFDYTMsvpYuYlZWWMji2cyMjpRdh8Sm0HH/tghWbqjYeP/9v23QvTadH6I50q8C /7Zs0SaqTdv7atcQZvl3aps4mXD0p7DZTriSIu6PovYoEhegbb5UjgmviQde1tXtWInd E49rEk0ZmTqbcnhoO8qwwRbJQlyBaf/826VWujYoTjumfd6GikmI1dx0ljB2l8a+oYhT T4k+78sbHk5bKbKDdC1b8Wyfe3BbnpdyxcWGd5nDrrHSosU0naeubAi1EegDeCwU3+aH Kl4w== Received: by 10.180.105.6 with SMTP id gi6mr8405440wib.4.1343949389631; Thu, 02 Aug 2012 16:16:29 -0700 (PDT) Received: from localhost.localdomain (p579F6478.dip.t-dialin.net. [87.159.100.120]) by mx.google.com with ESMTPS id w7sm36252882wiz.0.2012.08.02.16.16.27 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Aug 2012 16:16:28 -0700 (PDT) From: Alexander Block To: linux-btrfs@vger.kernel.org Cc: Alexander Block Subject: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol Date: Fri, 3 Aug 2012 01:16:20 +0200 Message-Id: <1343949380-15398-1-git-send-email-ablock84@googlemail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We got a recursive lock in mksubvol because the caller already held a lock. I think we got into this due to a merge error. Commit a874a63 removed the mnt_want_write call from btrfs_mksubvol and added a replacement call to mnt_want_write_file in btrfs_ioctl_snap_create_transid. Commit e7848683 however tried to move all calls to mnt_want_write above i_mutex. So somewhere while merging this, it got mixed up. The solution is to remove the mnt_want_write call completely from mksubvol. Reported-by: David Sterba Signed-off-by: Alexander Block --- fs/btrfs/ioctl.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 00ddf22..9df50fa 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -664,10 +664,6 @@ static noinline int btrfs_mksubvol(struct path *parent, struct dentry *dentry; int error; - error = mnt_want_write(parent->mnt); - if (error) - return error; - mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); dentry = lookup_one_len(name, parent->dentry, namelen); @@ -703,7 +699,6 @@ out_dput: dput(dentry); out_unlock: mutex_unlock(&dir->i_mutex); - mnt_drop_write(parent->mnt); return error; }