From patchwork Mon Mar 8 17:39:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ball X-Patchwork-Id: 84109 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o28HfH9Y003333 for ; Mon, 8 Mar 2010 17:41:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752331Ab0CHRlQ (ORCPT ); Mon, 8 Mar 2010 12:41:16 -0500 Received: from void.printf.net ([89.145.121.20]:33223 "EHLO void.printf.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750985Ab0CHRlQ (ORCPT ); Mon, 8 Mar 2010 12:41:16 -0500 Received: from pullcord.laptop.org ([18.85.46.20]) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1Nogx9-0002kb-3X; Mon, 08 Mar 2010 17:41:15 +0000 From: Chris Ball To: Bruce Guenter Cc: linux-btrfs@vger.kernel.org Subject: Re: Cross-subvolume link causes kernel BUG References: <20100308172438.GA5506@untroubled.org> Date: Mon, 08 Mar 2010 12:39:38 -0500 In-Reply-To: <20100308172438.GA5506@untroubled.org> (Bruce Guenter's message of "Mon, 8 Mar 2010 11:24:38 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 08 Mar 2010 17:41:18 +0000 (UTC) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 168e8c0..da76cad 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4462,6 +4462,10 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, if (inode->i_nlink == 0) return -ENOENT; + /* do not allow sys_link's with other subvols of the same device */ + if (root->objectid != BTRFS_I(inode)->root->objectid) + return -EPERM; + /* * 1 item for inode ref * 2 items for dir items